| @@ 696-722 (lines=27) @@ | ||
| 693 | * |
|
| 694 | * * @throws QueryException |
|
| 695 | */ |
|
| 696 | public function delete($table, $where, $databaseName = null) |
|
| 697 | { |
|
| 698 | // init |
|
| 699 | $table = trim($table); |
|
| 700 | ||
| 701 | if ($table === '') { |
|
| 702 | $this->_debug->displayError('Invalid table name, table name in empty.', false); |
|
| 703 | ||
| 704 | return false; |
|
| 705 | } |
|
| 706 | ||
| 707 | if (is_string($where)) { |
|
| 708 | $WHERE = $this->escape($where, false); |
|
| 709 | } elseif (is_array($where)) { |
|
| 710 | $WHERE = $this->_parseArrayPair($where, 'AND'); |
|
| 711 | } else { |
|
| 712 | $WHERE = ''; |
|
| 713 | } |
|
| 714 | ||
| 715 | if ($databaseName) { |
|
| 716 | $databaseName = $this->quote_string(trim($databaseName)) . '.'; |
|
| 717 | } |
|
| 718 | ||
| 719 | $sql = 'DELETE FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);"; |
|
| 720 | ||
| 721 | return $this->query($sql); |
|
| 722 | } |
|
| 723 | ||
| 724 | /** |
|
| 725 | * Ends a transaction and commits if no errors, then ends autocommit. |
|
| @@ 1667-1693 (lines=27) @@ | ||
| 1664 | * |
|
| 1665 | * @throws QueryException |
|
| 1666 | */ |
|
| 1667 | public function select($table, $where = '1=1', $databaseName = null) |
|
| 1668 | { |
|
| 1669 | // init |
|
| 1670 | $table = trim($table); |
|
| 1671 | ||
| 1672 | if ($table === '') { |
|
| 1673 | $this->_debug->displayError('Invalid table name, table name in empty.', false); |
|
| 1674 | ||
| 1675 | return false; |
|
| 1676 | } |
|
| 1677 | ||
| 1678 | if (is_string($where)) { |
|
| 1679 | $WHERE = $this->escape($where, false); |
|
| 1680 | } elseif (is_array($where)) { |
|
| 1681 | $WHERE = $this->_parseArrayPair($where, 'AND'); |
|
| 1682 | } else { |
|
| 1683 | $WHERE = ''; |
|
| 1684 | } |
|
| 1685 | ||
| 1686 | if ($databaseName) { |
|
| 1687 | $databaseName = $this->quote_string(trim($databaseName)) . '.'; |
|
| 1688 | } |
|
| 1689 | ||
| 1690 | $sql = 'SELECT * FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);"; |
|
| 1691 | ||
| 1692 | return $this->query($sql); |
|
| 1693 | } |
|
| 1694 | ||
| 1695 | /** |
|
| 1696 | * Selects a different database than the one specified on construction. |
|