Code Duplication    Length = 27-27 lines in 2 locations

src/voku/db/DB.php 2 locations

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