Code Duplication    Length = 27-27 lines in 2 locations

src/voku/db/DB.php 2 locations

@@ 617-643 (lines=27) @@
614
   *
615
   *    * @throws QueryException
616
   */
617
  public function delete($table, $where, $databaseName = null)
618
  {
619
    // init
620
    $table = trim($table);
621
622
    if ($table === '') {
623
      $this->_debug->displayError('Invalid table name, table name in empty.', false);
624
625
      return false;
626
    }
627
628
    if (is_string($where)) {
629
      $WHERE = $this->escape($where, false);
630
    } elseif (is_array($where)) {
631
      $WHERE = $this->_parseArrayPair($where, 'AND');
632
    } else {
633
      $WHERE = '';
634
    }
635
636
    if ($databaseName) {
637
      $databaseName = $this->quote_string(trim($databaseName)) . '.';
638
    }
639
640
    $sql = 'DELETE FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);";
641
642
    return $this->query($sql);
643
  }
644
645
  /**
646
   * Ends a transaction and commits if no errors, then ends autocommit.
@@ 1543-1569 (lines=27) @@
1540
   *
1541
   * @throws QueryException
1542
   */
1543
  public function select($table, $where = '1=1', $databaseName = null)
1544
  {
1545
    // init
1546
    $table = trim($table);
1547
1548
    if ($table === '') {
1549
      $this->_debug->displayError('Invalid table name, table name in empty.', false);
1550
1551
      return false;
1552
    }
1553
1554
    if (is_string($where)) {
1555
      $WHERE = $this->escape($where, false);
1556
    } elseif (is_array($where)) {
1557
      $WHERE = $this->_parseArrayPair($where, 'AND');
1558
    } else {
1559
      $WHERE = '';
1560
    }
1561
1562
    if ($databaseName) {
1563
      $databaseName = $this->quote_string(trim($databaseName)) . '.';
1564
    }
1565
1566
    $sql = 'SELECT * FROM ' . $databaseName . $this->quote_string($table) . " WHERE ($WHERE);";
1567
1568
    return $this->query($sql);
1569
  }
1570
1571
  /**
1572
   * Set the current charset.