Code Duplication    Length = 27-27 lines in 2 locations

src/voku/db/DB.php 2 locations

@@ 707-733 (lines=27) @@
704
   *
705
   *    * @throws QueryException
706
   */
707
  public function delete($table, $where, $databaseName = null)
708
  {
709
    // init
710
    $table = trim($table);
711
712
    if ($table === '') {
713
      $this->_debug->displayError('Invalid table name, table name in empty.', false);
714
715
      return false;
716
    }
717
718
    if (is_string($where)) {
719
      $WHERE = $this->escape($where, false);
720
    } elseif (is_array($where)) {
721
      $WHERE = $this->_parseArrayPair($where, 'AND');
722
    } else {
723
      $WHERE = '';
724
    }
725
726
    if ($databaseName) {
727
      $databaseName = $this->quote_string(trim($databaseName)) . '.';
728
    }
729
730
    $sql = 'DELETE FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);";
731
732
    return $this->query($sql);
733
  }
734
735
  /**
736
   * Ends a transaction and commits if no errors, then ends autocommit.
@@ 1726-1752 (lines=27) @@
1723
   *
1724
   * @throws QueryException
1725
   */
1726
  public function select($table, $where = '1=1', $databaseName = null)
1727
  {
1728
    // init
1729
    $table = trim($table);
1730
1731
    if ($table === '') {
1732
      $this->_debug->displayError('Invalid table name, table name in empty.', false);
1733
1734
      return false;
1735
    }
1736
1737
    if (is_string($where)) {
1738
      $WHERE = $this->escape($where, false);
1739
    } elseif (is_array($where)) {
1740
      $WHERE = $this->_parseArrayPair($where, 'AND');
1741
    } else {
1742
      $WHERE = '';
1743
    }
1744
1745
    if ($databaseName) {
1746
      $databaseName = $this->quote_string(trim($databaseName)) . '.';
1747
    }
1748
1749
    $sql = 'SELECT * FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);";
1750
1751
    return $this->query($sql);
1752
  }
1753
1754
  /**
1755
   * Selects a different database than the one specified on construction.