Code Duplication    Length = 27-27 lines in 2 locations

src/voku/db/DB.php 2 locations

@@ 719-745 (lines=27) @@
716
   *
717
   *    * @throws QueryException
718
   */
719
  public function delete($table, $where, $databaseName = null)
720
  {
721
    // init
722
    $table = trim($table);
723
724
    if ($table === '') {
725
      $this->_debug->displayError('Invalid table name, table name in empty.', false);
726
727
      return false;
728
    }
729
730
    if (is_string($where)) {
731
      $WHERE = $this->escape($where, false);
732
    } elseif (is_array($where)) {
733
      $WHERE = $this->_parseArrayPair($where, 'AND');
734
    } else {
735
      $WHERE = '';
736
    }
737
738
    if ($databaseName) {
739
      $databaseName = $this->quote_string(trim($databaseName)) . '.';
740
    }
741
742
    $sql = 'DELETE FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);";
743
744
    return $this->query($sql);
745
  }
746
747
  /**
748
   * Ends a transaction and commits if no errors, then ends autocommit.
@@ 1780-1806 (lines=27) @@
1777
   *
1778
   * @throws QueryException
1779
   */
1780
  public function select($table, $where = '1=1', $databaseName = null)
1781
  {
1782
    // init
1783
    $table = trim($table);
1784
1785
    if ($table === '') {
1786
      $this->_debug->displayError('Invalid table name, table name in empty.', false);
1787
1788
      return false;
1789
    }
1790
1791
    if (is_string($where)) {
1792
      $WHERE = $this->escape($where, false);
1793
    } elseif (is_array($where)) {
1794
      $WHERE = $this->_parseArrayPair($where, 'AND');
1795
    } else {
1796
      $WHERE = '';
1797
    }
1798
1799
    if ($databaseName) {
1800
      $databaseName = $this->quote_string(trim($databaseName)) . '.';
1801
    }
1802
1803
    $sql = 'SELECT * FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);";
1804
1805
    return $this->query($sql);
1806
  }
1807
1808
  /**
1809
   * Selects a different database than the one specified on construction.