| @@ 617-643 (lines=27) @@ | ||
| 614 | * |
|
| 615 | * * @throws QueryException |
|
| 616 | */ |
|
| 617 | public function delete($table, $where, $databaseName = null) |
|
| 618 | { |
|
| 619 | // init |
|
| 620 | $table = trim($table); |
|
| 621 | ||
| 622 | if ($table === '') { |
|
| 623 | $this->_debug->displayError('Invalid table name, table name in empty.', false); |
|
| 624 | ||
| 625 | return false; |
|
| 626 | } |
|
| 627 | ||
| 628 | if (is_string($where)) { |
|
| 629 | $WHERE = $this->escape($where, false); |
|
| 630 | } elseif (is_array($where)) { |
|
| 631 | $WHERE = $this->_parseArrayPair($where, 'AND'); |
|
| 632 | } else { |
|
| 633 | $WHERE = ''; |
|
| 634 | } |
|
| 635 | ||
| 636 | if ($databaseName) { |
|
| 637 | $databaseName = $this->quote_string(trim($databaseName)) . '.'; |
|
| 638 | } |
|
| 639 | ||
| 640 | $sql = 'DELETE FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);"; |
|
| 641 | ||
| 642 | return $this->query($sql); |
|
| 643 | } |
|
| 644 | ||
| 645 | /** |
|
| 646 | * Ends a transaction and commits if no errors, then ends autocommit. |
|
| @@ 1557-1583 (lines=27) @@ | ||
| 1554 | * |
|
| 1555 | * @throws QueryException |
|
| 1556 | */ |
|
| 1557 | public function select($table, $where = '1=1', $databaseName = null) |
|
| 1558 | { |
|
| 1559 | // init |
|
| 1560 | $table = trim($table); |
|
| 1561 | ||
| 1562 | if ($table === '') { |
|
| 1563 | $this->_debug->displayError('Invalid table name, table name in empty.', false); |
|
| 1564 | ||
| 1565 | return false; |
|
| 1566 | } |
|
| 1567 | ||
| 1568 | if (is_string($where)) { |
|
| 1569 | $WHERE = $this->escape($where, false); |
|
| 1570 | } elseif (is_array($where)) { |
|
| 1571 | $WHERE = $this->_parseArrayPair($where, 'AND'); |
|
| 1572 | } else { |
|
| 1573 | $WHERE = ''; |
|
| 1574 | } |
|
| 1575 | ||
| 1576 | if ($databaseName) { |
|
| 1577 | $databaseName = $this->quote_string(trim($databaseName)) . '.'; |
|
| 1578 | } |
|
| 1579 | ||
| 1580 | $sql = 'SELECT * FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);"; |
|
| 1581 | ||
| 1582 | return $this->query($sql); |
|
| 1583 | } |
|
| 1584 | ||
| 1585 | /** |
|
| 1586 | * Set the current charset. |
|