Code Duplication    Length = 27-27 lines in 2 locations

src/voku/db/DB.php 2 locations

@@ 561-587 (lines=27) @@
558
   *
559
   *    * @throws QueryException
560
   */
561
  public function delete($table, $where, $databaseName = null)
562
  {
563
    // init
564
    $table = trim($table);
565
566
    if ($table === '') {
567
      $this->_debug->displayError('Invalid table name, table name in empty.', false);
568
569
      return false;
570
    }
571
572
    if (is_string($where)) {
573
      $WHERE = $this->escape($where, false);
574
    } elseif (is_array($where)) {
575
      $WHERE = $this->_parseArrayPair($where, 'AND');
576
    } else {
577
      $WHERE = '';
578
    }
579
580
    if ($databaseName) {
581
      $databaseName = $this->quote_string(trim($databaseName)) . '.';
582
    }
583
584
    $sql = 'DELETE FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);";
585
586
    return $this->query($sql);
587
  }
588
589
  /**
590
   * Ends a transaction and commits if no errors, then ends autocommit.
@@ 1487-1513 (lines=27) @@
1484
   *
1485
   * @throws QueryException
1486
   */
1487
  public function select($table, $where = '1=1', $databaseName = null)
1488
  {
1489
    // init
1490
    $table = trim($table);
1491
1492
    if ($table === '') {
1493
      $this->_debug->displayError('Invalid table name, table name in empty.', false);
1494
1495
      return false;
1496
    }
1497
1498
    if (is_string($where)) {
1499
      $WHERE = $this->escape($where, false);
1500
    } elseif (is_array($where)) {
1501
      $WHERE = $this->_parseArrayPair($where, 'AND');
1502
    } else {
1503
      $WHERE = '';
1504
    }
1505
1506
    if ($databaseName) {
1507
      $databaseName = $this->quote_string(trim($databaseName)) . '.';
1508
    }
1509
1510
    $sql = 'SELECT * FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);";
1511
1512
    return $this->query($sql);
1513
  }
1514
1515
  /**
1516
   * Set the current charset.