| @@ 664-690 (lines=27) @@ | ||
| 661 | * |
|
| 662 | * * @throws QueryException |
|
| 663 | */ |
|
| 664 | public function delete($table, $where, $databaseName = null) |
|
| 665 | { |
|
| 666 | // init |
|
| 667 | $table = trim($table); |
|
| 668 | ||
| 669 | if ($table === '') { |
|
| 670 | $this->_debug->displayError('Invalid table name, table name in empty.', false); |
|
| 671 | ||
| 672 | return false; |
|
| 673 | } |
|
| 674 | ||
| 675 | if (is_string($where)) { |
|
| 676 | $WHERE = $this->escape($where, false); |
|
| 677 | } elseif (is_array($where)) { |
|
| 678 | $WHERE = $this->_parseArrayPair($where, 'AND'); |
|
| 679 | } else { |
|
| 680 | $WHERE = ''; |
|
| 681 | } |
|
| 682 | ||
| 683 | if ($databaseName) { |
|
| 684 | $databaseName = $this->quote_string(trim($databaseName)) . '.'; |
|
| 685 | } |
|
| 686 | ||
| 687 | $sql = 'DELETE FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);"; |
|
| 688 | ||
| 689 | return $this->query($sql); |
|
| 690 | } |
|
| 691 | ||
| 692 | /** |
|
| 693 | * Ends a transaction and commits if no errors, then ends autocommit. |
|
| @@ 1679-1705 (lines=27) @@ | ||
| 1676 | * |
|
| 1677 | * @throws QueryException |
|
| 1678 | */ |
|
| 1679 | public function select($table, $where = '1=1', $databaseName = null) |
|
| 1680 | { |
|
| 1681 | // init |
|
| 1682 | $table = trim($table); |
|
| 1683 | ||
| 1684 | if ($table === '') { |
|
| 1685 | $this->_debug->displayError('Invalid table name, table name in empty.', false); |
|
| 1686 | ||
| 1687 | return false; |
|
| 1688 | } |
|
| 1689 | ||
| 1690 | if (is_string($where)) { |
|
| 1691 | $WHERE = $this->escape($where, false); |
|
| 1692 | } elseif (is_array($where)) { |
|
| 1693 | $WHERE = $this->_parseArrayPair($where, 'AND'); |
|
| 1694 | } else { |
|
| 1695 | $WHERE = ''; |
|
| 1696 | } |
|
| 1697 | ||
| 1698 | if ($databaseName) { |
|
| 1699 | $databaseName = $this->quote_string(trim($databaseName)) . '.'; |
|
| 1700 | } |
|
| 1701 | ||
| 1702 | $sql = 'SELECT * FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);"; |
|
| 1703 | ||
| 1704 | return $this->query($sql); |
|
| 1705 | } |
|
| 1706 | ||
| 1707 | /** |
|
| 1708 | * Set the current charset. |
|