Code Duplication    Length = 21-23 lines in 2 locations

src/voku/db/DB.php 2 locations

@@ 1423-1445 (lines=23) @@
1420
   *
1421
   * @return false|int false on error
1422
   */
1423
  public function delete($table, $where)
1424
  {
1425
1426
    $table = trim($table);
1427
1428
    if ($table === '') {
1429
      $this->_debug->displayError('invalid table name');
1430
1431
      return false;
1432
    }
1433
1434
    if (is_string($where)) {
1435
      $WHERE = $this->escape($where, false);
1436
    } elseif (is_array($where)) {
1437
      $WHERE = $this->_parseArrayPair($where, 'AND');
1438
    } else {
1439
      $WHERE = '';
1440
    }
1441
1442
    $sql = 'DELETE FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1443
1444
    return $this->query($sql);
1445
  }
1446
1447
  /**
1448
   * Execute a "select"-query.
@@ 1455-1475 (lines=21) @@
1452
   *
1453
   * @return false|Result false on error
1454
   */
1455
  public function select($table, $where = '1=1')
1456
  {
1457
1458
    if ($table === '') {
1459
      $this->_debug->displayError('invalid table name');
1460
1461
      return false;
1462
    }
1463
1464
    if (is_string($where)) {
1465
      $WHERE = $this->escape($where, false);
1466
    } elseif (is_array($where)) {
1467
      $WHERE = $this->_parseArrayPair($where, 'AND');
1468
    } else {
1469
      $WHERE = '';
1470
    }
1471
1472
    $sql = 'SELECT * FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1473
1474
    return $this->query($sql);
1475
  }
1476
1477
  /**
1478
   * Get the last sql-error.