| @@ 653-679 (lines=27) @@ | ||
| 650 | * |
|
| 651 | * * @throws QueryException |
|
| 652 | */ |
|
| 653 | public function delete($table, $where, $databaseName = null) |
|
| 654 | { |
|
| 655 | // init |
|
| 656 | $table = trim($table); |
|
| 657 | ||
| 658 | if ($table === '') { |
|
| 659 | $this->_debug->displayError('Invalid table name, table name in empty.', false); |
|
| 660 | ||
| 661 | return false; |
|
| 662 | } |
|
| 663 | ||
| 664 | if (is_string($where)) { |
|
| 665 | $WHERE = $this->escape($where, false); |
|
| 666 | } elseif (is_array($where)) { |
|
| 667 | $WHERE = $this->_parseArrayPair($where, 'AND'); |
|
| 668 | } else { |
|
| 669 | $WHERE = ''; |
|
| 670 | } |
|
| 671 | ||
| 672 | if ($databaseName) { |
|
| 673 | $databaseName = $this->quote_string(trim($databaseName)) . '.'; |
|
| 674 | } |
|
| 675 | ||
| 676 | $sql = 'DELETE FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);"; |
|
| 677 | ||
| 678 | return $this->query($sql); |
|
| 679 | } |
|
| 680 | ||
| 681 | /** |
|
| 682 | * Ends a transaction and commits if no errors, then ends autocommit. |
|
| @@ 1663-1689 (lines=27) @@ | ||
| 1660 | * |
|
| 1661 | * @throws QueryException |
|
| 1662 | */ |
|
| 1663 | public function select($table, $where = '1=1', $databaseName = null) |
|
| 1664 | { |
|
| 1665 | // init |
|
| 1666 | $table = trim($table); |
|
| 1667 | ||
| 1668 | if ($table === '') { |
|
| 1669 | $this->_debug->displayError('Invalid table name, table name in empty.', false); |
|
| 1670 | ||
| 1671 | return false; |
|
| 1672 | } |
|
| 1673 | ||
| 1674 | if (is_string($where)) { |
|
| 1675 | $WHERE = $this->escape($where, false); |
|
| 1676 | } elseif (is_array($where)) { |
|
| 1677 | $WHERE = $this->_parseArrayPair($where, 'AND'); |
|
| 1678 | } else { |
|
| 1679 | $WHERE = ''; |
|
| 1680 | } |
|
| 1681 | ||
| 1682 | if ($databaseName) { |
|
| 1683 | $databaseName = $this->quote_string(trim($databaseName)) . '.'; |
|
| 1684 | } |
|
| 1685 | ||
| 1686 | $sql = 'SELECT * FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);"; |
|
| 1687 | ||
| 1688 | return $this->query($sql); |
|
| 1689 | } |
|
| 1690 | ||
| 1691 | /** |
|
| 1692 | * Set the current charset. |
|