| @@ 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. |
|
| @@ 1577-1603 (lines=27) @@ | ||
| 1574 | * |
|
| 1575 | * @throws QueryException |
|
| 1576 | */ |
|
| 1577 | public function select($table, $where = '1=1', $databaseName = null) |
|
| 1578 | { |
|
| 1579 | // init |
|
| 1580 | $table = trim($table); |
|
| 1581 | ||
| 1582 | if ($table === '') { |
|
| 1583 | $this->_debug->displayError('Invalid table name, table name in empty.', false); |
|
| 1584 | ||
| 1585 | return false; |
|
| 1586 | } |
|
| 1587 | ||
| 1588 | if (is_string($where)) { |
|
| 1589 | $WHERE = $this->escape($where, false); |
|
| 1590 | } elseif (is_array($where)) { |
|
| 1591 | $WHERE = $this->_parseArrayPair($where, 'AND'); |
|
| 1592 | } else { |
|
| 1593 | $WHERE = ''; |
|
| 1594 | } |
|
| 1595 | ||
| 1596 | if ($databaseName) { |
|
| 1597 | $databaseName = $this->quote_string(trim($databaseName)) . '.'; |
|
| 1598 | } |
|
| 1599 | ||
| 1600 | $sql = 'SELECT * FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);"; |
|
| 1601 | ||
| 1602 | return $this->query($sql); |
|
| 1603 | } |
|
| 1604 | ||
| 1605 | /** |
|
| 1606 | * Set the current charset. |
|