Code Duplication    Length = 21-23 lines in 2 locations

src/voku/db/DB.php 2 locations

@@ 1433-1455 (lines=23) @@
1430
   *
1431
   * @return false|int false on error
1432
   */
1433
  public function delete($table, $where)
1434
  {
1435
1436
    $table = trim($table);
1437
1438
    if ($table === '') {
1439
      $this->_debug->displayError('invalid table name');
1440
1441
      return false;
1442
    }
1443
1444
    if (is_string($where)) {
1445
      $WHERE = $this->escape($where, false);
1446
    } elseif (is_array($where)) {
1447
      $WHERE = $this->_parseArrayPair($where, 'AND');
1448
    } else {
1449
      $WHERE = '';
1450
    }
1451
1452
    $sql = 'DELETE FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1453
1454
    return $this->query($sql);
1455
  }
1456
1457
  /**
1458
   * Execute a "select"-query.
@@ 1465-1485 (lines=21) @@
1462
   *
1463
   * @return false|Result false on error
1464
   */
1465
  public function select($table, $where = '1=1')
1466
  {
1467
1468
    if ($table === '') {
1469
      $this->_debug->displayError('invalid table name');
1470
1471
      return false;
1472
    }
1473
1474
    if (is_string($where)) {
1475
      $WHERE = $this->escape($where, false);
1476
    } elseif (is_array($where)) {
1477
      $WHERE = $this->_parseArrayPair($where, 'AND');
1478
    } else {
1479
      $WHERE = '';
1480
    }
1481
1482
    $sql = 'SELECT * FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1483
1484
    return $this->query($sql);
1485
  }
1486
1487
  /**
1488
   * Get the last sql-error.