Code Duplication    Length = 27-27 lines in 2 locations

src/voku/db/DB.php 2 locations

@@ 701-727 (lines=27) @@
698
   *
699
   *    * @throws QueryException
700
   */
701
  public function delete($table, $where, $databaseName = null)
702
  {
703
    // init
704
    $table = trim($table);
705
706
    if ($table === '') {
707
      $this->_debug->displayError('Invalid table name, table name in empty.', false);
708
709
      return false;
710
    }
711
712
    if (is_string($where)) {
713
      $WHERE = $this->escape($where, false);
714
    } elseif (is_array($where)) {
715
      $WHERE = $this->_parseArrayPair($where, 'AND');
716
    } else {
717
      $WHERE = '';
718
    }
719
720
    if ($databaseName) {
721
      $databaseName = $this->quote_string(trim($databaseName)) . '.';
722
    }
723
724
    $sql = 'DELETE FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);";
725
726
    return $this->query($sql);
727
  }
728
729
  /**
730
   * Ends a transaction and commits if no errors, then ends autocommit.
@@ 1704-1730 (lines=27) @@
1701
   *
1702
   * @throws QueryException
1703
   */
1704
  public function select($table, $where = '1=1', $databaseName = null)
1705
  {
1706
    // init
1707
    $table = trim($table);
1708
1709
    if ($table === '') {
1710
      $this->_debug->displayError('Invalid table name, table name in empty.', false);
1711
1712
      return false;
1713
    }
1714
1715
    if (is_string($where)) {
1716
      $WHERE = $this->escape($where, false);
1717
    } elseif (is_array($where)) {
1718
      $WHERE = $this->_parseArrayPair($where, 'AND');
1719
    } else {
1720
      $WHERE = '';
1721
    }
1722
1723
    if ($databaseName) {
1724
      $databaseName = $this->quote_string(trim($databaseName)) . '.';
1725
    }
1726
1727
    $sql = 'SELECT * FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);";
1728
1729
    return $this->query($sql);
1730
  }
1731
1732
  /**
1733
   * Selects a different database than the one specified on construction.