Code Duplication    Length = 27-27 lines in 2 locations

src/voku/db/DB.php 2 locations

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