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.
@@ 1680-1706 (lines=27) @@
1677
   *
1678
   * @throws QueryException
1679
   */
1680
  public function select($table, $where = '1=1', $databaseName = null)
1681
  {
1682
    // init
1683
    $table = trim($table);
1684
1685
    if ($table === '') {
1686
      $this->_debug->displayError('Invalid table name, table name in empty.', false);
1687
1688
      return false;
1689
    }
1690
1691
    if (is_string($where)) {
1692
      $WHERE = $this->escape($where, false);
1693
    } elseif (is_array($where)) {
1694
      $WHERE = $this->_parseArrayPair($where, 'AND');
1695
    } else {
1696
      $WHERE = '';
1697
    }
1698
1699
    if ($databaseName) {
1700
      $databaseName = $this->quote_string(trim($databaseName)) . '.';
1701
    }
1702
1703
    $sql = 'SELECT * FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);";
1704
1705
    return $this->query($sql);
1706
  }
1707
1708
  /**
1709
   * Set the current charset.