Code Duplication    Length = 21-23 lines in 2 locations

src/voku/db/DB.php 2 locations

@@ 1619-1641 (lines=23) @@
1616
   *
1617
   * @return false|int false on error
1618
   */
1619
  public function delete($table, $where)
1620
  {
1621
1622
    $table = trim($table);
1623
1624
    if ($table === '') {
1625
      $this->_displayError('invalid table name');
1626
1627
      return false;
1628
    }
1629
1630
    if (is_string($where)) {
1631
      $WHERE = $this->escape($where, false, false);
1632
    } elseif (is_array($where)) {
1633
      $WHERE = $this->_parseArrayPair($where, 'AND');
1634
    } else {
1635
      $WHERE = '';
1636
    }
1637
1638
    $sql = 'DELETE FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1639
1640
    return $this->query($sql);
1641
  }
1642
1643
  /**
1644
   * Execute a "select"-query.
@@ 1651-1671 (lines=21) @@
1648
   *
1649
   * @return false|Result false on error
1650
   */
1651
  public function select($table, $where = '1=1')
1652
  {
1653
1654
    if ($table === '') {
1655
      $this->_displayError('invalid table name');
1656
1657
      return false;
1658
    }
1659
1660
    if (is_string($where)) {
1661
      $WHERE = $this->escape($where, false, false);
1662
    } elseif (is_array($where)) {
1663
      $WHERE = $this->_parseArrayPair($where, 'AND');
1664
    } else {
1665
      $WHERE = '';
1666
    }
1667
1668
    $sql = 'SELECT * FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1669
1670
    return $this->query($sql);
1671
  }
1672
1673
  /**
1674
   * Get the last sql-error.