Code Duplication    Length = 27-27 lines in 2 locations

src/voku/db/DB.php 2 locations

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