Code Duplication    Length = 27-27 lines in 2 locations

src/voku/db/DB.php 2 locations

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