| @@ 711-737 (lines=27) @@ | ||
| 708 | * |
|
| 709 | * * @throws QueryException |
|
| 710 | */ |
|
| 711 | public function delete($table, $where, $databaseName = null) |
|
| 712 | { |
|
| 713 | // init |
|
| 714 | $table = trim($table); |
|
| 715 | ||
| 716 | if ($table === '') { |
|
| 717 | $this->_debug->displayError('Invalid table name, table name in empty.', false); |
|
| 718 | ||
| 719 | return false; |
|
| 720 | } |
|
| 721 | ||
| 722 | if (is_string($where)) { |
|
| 723 | $WHERE = $this->escape($where, false); |
|
| 724 | } elseif (is_array($where)) { |
|
| 725 | $WHERE = $this->_parseArrayPair($where, 'AND'); |
|
| 726 | } else { |
|
| 727 | $WHERE = ''; |
|
| 728 | } |
|
| 729 | ||
| 730 | if ($databaseName) { |
|
| 731 | $databaseName = $this->quote_string(trim($databaseName)) . '.'; |
|
| 732 | } |
|
| 733 | ||
| 734 | $sql = 'DELETE FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);"; |
|
| 735 | ||
| 736 | return $this->query($sql); |
|
| 737 | } |
|
| 738 | ||
| 739 | /** |
|
| 740 | * Ends a transaction and commits if no errors, then ends autocommit. |
|
| @@ 1764-1790 (lines=27) @@ | ||
| 1761 | * |
|
| 1762 | * @throws QueryException |
|
| 1763 | */ |
|
| 1764 | public function select($table, $where = '1=1', $databaseName = null) |
|
| 1765 | { |
|
| 1766 | // init |
|
| 1767 | $table = trim($table); |
|
| 1768 | ||
| 1769 | if ($table === '') { |
|
| 1770 | $this->_debug->displayError('Invalid table name, table name in empty.', false); |
|
| 1771 | ||
| 1772 | return false; |
|
| 1773 | } |
|
| 1774 | ||
| 1775 | if (is_string($where)) { |
|
| 1776 | $WHERE = $this->escape($where, false); |
|
| 1777 | } elseif (is_array($where)) { |
|
| 1778 | $WHERE = $this->_parseArrayPair($where, 'AND'); |
|
| 1779 | } else { |
|
| 1780 | $WHERE = ''; |
|
| 1781 | } |
|
| 1782 | ||
| 1783 | if ($databaseName) { |
|
| 1784 | $databaseName = $this->quote_string(trim($databaseName)) . '.'; |
|
| 1785 | } |
|
| 1786 | ||
| 1787 | $sql = 'SELECT * FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);"; |
|
| 1788 | ||
| 1789 | return $this->query($sql); |
|
| 1790 | } |
|
| 1791 | ||
| 1792 | /** |
|
| 1793 | * Selects a different database than the one specified on construction. |
|