Code Duplication    Length = 27-27 lines in 2 locations

src/voku/db/DB.php 2 locations

@@ 1564-1590 (lines=27) @@
1561
   *
1562
   *    * @throws QueryException
1563
   */
1564
  public function delete($table, $where, $databaseName = null)
1565
  {
1566
    // init
1567
    $table = trim($table);
1568
1569
    if ($table === '') {
1570
      $this->_debug->displayError('Invalid table name, table name in empty.', false);
1571
1572
      return false;
1573
    }
1574
1575
    if (is_string($where)) {
1576
      $WHERE = $this->escape($where, false);
1577
    } elseif (is_array($where)) {
1578
      $WHERE = $this->_parseArrayPair($where, 'AND');
1579
    } else {
1580
      $WHERE = '';
1581
    }
1582
1583
    if ($databaseName) {
1584
      $databaseName = $this->quote_string(trim($databaseName)) . '.';
1585
    }
1586
1587
    $sql = 'DELETE FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);";
1588
1589
    return $this->query($sql);
1590
  }
1591
1592
  /**
1593
   * Execute a "select"-query.
@@ 1603-1629 (lines=27) @@
1600
   *
1601
   * @throws QueryException
1602
   */
1603
  public function select($table, $where = '1=1', $databaseName = null)
1604
  {
1605
    // init
1606
    $table = trim($table);
1607
1608
    if ($table === '') {
1609
      $this->_debug->displayError('Invalid table name, table name in empty.', false);
1610
1611
      return false;
1612
    }
1613
1614
    if (is_string($where)) {
1615
      $WHERE = $this->escape($where, false);
1616
    } elseif (is_array($where)) {
1617
      $WHERE = $this->_parseArrayPair($where, 'AND');
1618
    } else {
1619
      $WHERE = '';
1620
    }
1621
1622
    if ($databaseName) {
1623
      $databaseName = $this->quote_string(trim($databaseName)) . '.';
1624
    }
1625
1626
    $sql = 'SELECT * FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);";
1627
1628
    return $this->query($sql);
1629
  }
1630
1631
  /**
1632
   * Get the last sql-error.