Code Duplication    Length = 21-23 lines in 2 locations

src/voku/db/DB.php 2 locations

@@ 1459-1481 (lines=23) @@
1456
   *
1457
   * @return false|int false on error
1458
   */
1459
  public function delete($table, $where)
1460
  {
1461
1462
    $table = trim($table);
1463
1464
    if ($table === '') {
1465
      $this->_debug->displayError('invalid table name');
1466
1467
      return false;
1468
    }
1469
1470
    if (is_string($where)) {
1471
      $WHERE = $this->escape($where, false);
1472
    } elseif (is_array($where)) {
1473
      $WHERE = $this->_parseArrayPair($where, 'AND');
1474
    } else {
1475
      $WHERE = '';
1476
    }
1477
1478
    $sql = 'DELETE FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1479
1480
    return $this->query($sql);
1481
  }
1482
1483
  /**
1484
   * Execute a "select"-query.
@@ 1491-1511 (lines=21) @@
1488
   *
1489
   * @return false|Result false on error
1490
   */
1491
  public function select($table, $where = '1=1')
1492
  {
1493
1494
    if ($table === '') {
1495
      $this->_debug->displayError('invalid table name');
1496
1497
      return false;
1498
    }
1499
1500
    if (is_string($where)) {
1501
      $WHERE = $this->escape($where, false);
1502
    } elseif (is_array($where)) {
1503
      $WHERE = $this->_parseArrayPair($where, 'AND');
1504
    } else {
1505
      $WHERE = '';
1506
    }
1507
1508
    $sql = 'SELECT * FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1509
1510
    return $this->query($sql);
1511
  }
1512
1513
  /**
1514
   * Get the last sql-error.