Code Duplication    Length = 21-23 lines in 2 locations

src/voku/db/DB.php 2 locations

@@ 1378-1400 (lines=23) @@
1375
   *
1376
   * @return false|int false on error
1377
   */
1378
  public function delete($table, $where)
1379
  {
1380
1381
    $table = trim($table);
1382
1383
    if ($table === '') {
1384
      $this->_debug->displayError('invalid table name');
1385
1386
      return false;
1387
    }
1388
1389
    if (is_string($where)) {
1390
      $WHERE = $this->escape($where, false);
1391
    } elseif (is_array($where)) {
1392
      $WHERE = $this->_parseArrayPair($where, 'AND');
1393
    } else {
1394
      $WHERE = '';
1395
    }
1396
1397
    $sql = 'DELETE FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1398
1399
    return $this->query($sql);
1400
  }
1401
1402
  /**
1403
   * Execute a "select"-query.
@@ 1410-1430 (lines=21) @@
1407
   *
1408
   * @return false|Result false on error
1409
   */
1410
  public function select($table, $where = '1=1')
1411
  {
1412
1413
    if ($table === '') {
1414
      $this->_debug->displayError('invalid table name');
1415
1416
      return false;
1417
    }
1418
1419
    if (is_string($where)) {
1420
      $WHERE = $this->escape($where, false);
1421
    } elseif (is_array($where)) {
1422
      $WHERE = $this->_parseArrayPair($where, 'AND');
1423
    } else {
1424
      $WHERE = '';
1425
    }
1426
1427
    $sql = 'SELECT * FROM ' . $this->quote_string($table) . " WHERE ($WHERE);";
1428
1429
    return $this->query($sql);
1430
  }
1431
1432
  /**
1433
   * Get the last sql-error.