Code Duplication    Length = 27-27 lines in 2 locations

src/voku/db/DB.php 2 locations

@@ 710-736 (lines=27) @@
707
   *
708
   *    * @throws QueryException
709
   */
710
  public function delete($table, $where, $databaseName = null)
711
  {
712
    // init
713
    $table = trim($table);
714
715
    if ($table === '') {
716
      $this->_debug->displayError('Invalid table name, table name in empty.', false);
717
718
      return false;
719
    }
720
721
    if (is_string($where)) {
722
      $WHERE = $this->escape($where, false);
723
    } elseif (is_array($where)) {
724
      $WHERE = $this->_parseArrayPair($where, 'AND');
725
    } else {
726
      $WHERE = '';
727
    }
728
729
    if ($databaseName) {
730
      $databaseName = $this->quote_string(trim($databaseName)) . '.';
731
    }
732
733
    $sql = 'DELETE FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);";
734
735
    return $this->query($sql);
736
  }
737
738
  /**
739
   * Ends a transaction and commits if no errors, then ends autocommit.
@@ 1763-1789 (lines=27) @@
1760
   *
1761
   * @throws QueryException
1762
   */
1763
  public function select($table, $where = '1=1', $databaseName = null)
1764
  {
1765
    // init
1766
    $table = trim($table);
1767
1768
    if ($table === '') {
1769
      $this->_debug->displayError('Invalid table name, table name in empty.', false);
1770
1771
      return false;
1772
    }
1773
1774
    if (is_string($where)) {
1775
      $WHERE = $this->escape($where, false);
1776
    } elseif (is_array($where)) {
1777
      $WHERE = $this->_parseArrayPair($where, 'AND');
1778
    } else {
1779
      $WHERE = '';
1780
    }
1781
1782
    if ($databaseName) {
1783
      $databaseName = $this->quote_string(trim($databaseName)) . '.';
1784
    }
1785
1786
    $sql = 'SELECT * FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);";
1787
1788
    return $this->query($sql);
1789
  }
1790
1791
  /**
1792
   * Selects a different database than the one specified on construction.