Code Duplication    Length = 21-23 lines in 2 locations

src/voku/db/DB.php 2 locations

@@ 1632-1654 (lines=23) @@
1629
   *
1630
   * @return false|int false on error
1631
   */
1632
  public function delete($table, $where)
1633
  {
1634
1635
    $table = trim($table);
1636
1637
    if ($table === '') {
1638
      $this->_displayError('invalid table name');
1639
1640
      return false;
1641
    }
1642
1643
    if (is_string($where)) {
1644
      $WHERE = $this->escape($where, false, false);
1645
    } elseif (is_array($where)) {
1646
      $WHERE = $this->_parseArrayPair($where, 'AND');
1647
    } else {
1648
      $WHERE = '';
1649
    }
1650
1651
    $sql = 'DELETE FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1652
1653
    return $this->query($sql);
1654
  }
1655
1656
  /**
1657
   * Execute a "select"-query.
@@ 1664-1684 (lines=21) @@
1661
   *
1662
   * @return false|Result false on error
1663
   */
1664
  public function select($table, $where = '1=1')
1665
  {
1666
1667
    if ($table === '') {
1668
      $this->_displayError('invalid table name');
1669
1670
      return false;
1671
    }
1672
1673
    if (is_string($where)) {
1674
      $WHERE = $this->escape($where, false, false);
1675
    } elseif (is_array($where)) {
1676
      $WHERE = $this->_parseArrayPair($where, 'AND');
1677
    } else {
1678
      $WHERE = '';
1679
    }
1680
1681
    $sql = 'SELECT * FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1682
1683
    return $this->query($sql);
1684
  }
1685
1686
  /**
1687
   * Get the last sql-error.