Code Duplication    Length = 27-27 lines in 2 locations

src/voku/db/DB.php 2 locations

@@ 642-668 (lines=27) @@
639
   *
640
   *    * @throws QueryException
641
   */
642
  public function delete($table, $where, $databaseName = null)
643
  {
644
    // init
645
    $table = trim($table);
646
647
    if ($table === '') {
648
      $this->_debug->displayError('Invalid table name, table name in empty.', false);
649
650
      return false;
651
    }
652
653
    if (is_string($where)) {
654
      $WHERE = $this->escape($where, false);
655
    } elseif (is_array($where)) {
656
      $WHERE = $this->_parseArrayPair($where, 'AND');
657
    } else {
658
      $WHERE = '';
659
    }
660
661
    if ($databaseName) {
662
      $databaseName = $this->quote_string(trim($databaseName)) . '.';
663
    }
664
665
    $sql = 'DELETE FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);";
666
667
    return $this->query($sql);
668
  }
669
670
  /**
671
   * Ends a transaction and commits if no errors, then ends autocommit.
@@ 1653-1679 (lines=27) @@
1650
   *
1651
   * @throws QueryException
1652
   */
1653
  public function select($table, $where = '1=1', $databaseName = null)
1654
  {
1655
    // init
1656
    $table = trim($table);
1657
1658
    if ($table === '') {
1659
      $this->_debug->displayError('Invalid table name, table name in empty.', false);
1660
1661
      return false;
1662
    }
1663
1664
    if (is_string($where)) {
1665
      $WHERE = $this->escape($where, false);
1666
    } elseif (is_array($where)) {
1667
      $WHERE = $this->_parseArrayPair($where, 'AND');
1668
    } else {
1669
      $WHERE = '';
1670
    }
1671
1672
    if ($databaseName) {
1673
      $databaseName = $this->quote_string(trim($databaseName)) . '.';
1674
    }
1675
1676
    $sql = 'SELECT * FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);";
1677
1678
    return $this->query($sql);
1679
  }
1680
1681
  /**
1682
   * Set the current charset.