Code Duplication    Length = 27-27 lines in 2 locations

src/voku/db/DB.php 2 locations

@@ 669-695 (lines=27) @@
666
   *
667
   *    * @throws QueryException
668
   */
669
  public function delete($table, $where, $databaseName = null)
670
  {
671
    // init
672
    $table = trim($table);
673
674
    if ($table === '') {
675
      $this->_debug->displayError('Invalid table name, table name in empty.', false);
676
677
      return false;
678
    }
679
680
    if (is_string($where)) {
681
      $WHERE = $this->escape($where, false);
682
    } elseif (is_array($where)) {
683
      $WHERE = $this->_parseArrayPair($where, 'AND');
684
    } else {
685
      $WHERE = '';
686
    }
687
688
    if ($databaseName) {
689
      $databaseName = $this->quote_string(trim($databaseName)) . '.';
690
    }
691
692
    $sql = 'DELETE FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);";
693
694
    return $this->query($sql);
695
  }
696
697
  /**
698
   * Ends a transaction and commits if no errors, then ends autocommit.
@@ 1681-1707 (lines=27) @@
1678
   *
1679
   * @throws QueryException
1680
   */
1681
  public function select($table, $where = '1=1', $databaseName = null)
1682
  {
1683
    // init
1684
    $table = trim($table);
1685
1686
    if ($table === '') {
1687
      $this->_debug->displayError('Invalid table name, table name in empty.', false);
1688
1689
      return false;
1690
    }
1691
1692
    if (is_string($where)) {
1693
      $WHERE = $this->escape($where, false);
1694
    } elseif (is_array($where)) {
1695
      $WHERE = $this->_parseArrayPair($where, 'AND');
1696
    } else {
1697
      $WHERE = '';
1698
    }
1699
1700
    if ($databaseName) {
1701
      $databaseName = $this->quote_string(trim($databaseName)) . '.';
1702
    }
1703
1704
    $sql = 'SELECT * FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);";
1705
1706
    return $this->query($sql);
1707
  }
1708
1709
  /**
1710
   * Set the current charset.