src/wcmf/lib/model/mapper/impl/AbstractRDBMapper.php
public function executeSql($sql, $parameters=[]) {
    if ($this->adapter == null) {
      $this->connect();
    }
    try {
      $stmt = $this->adapter->createStatement($sql, $parameters);
      $results = $stmt->execute();
      if ($results->isQueryResult()) {
        return $results->getResource()->fetchAll();
      }
      else {
        return $results->getAffectedRows();
      }
    }
    catch (\Exception $ex) {
      self::$logger->error("The query: ".$sql."\ncaused the following exception:\n".$ex->getMessage());
      throw new PersistenceException("Error in persistent operation. See log file for details.");
    }
  }
public function executeSql($sql, $parameters=[]) {
    if ($this->adapter == null) {
      $this->connect();
    }
    try {
      $stmt = $this->adapter->createStatement($sql, $parameters);
      $results = $stmt->execute();
      if ($results->isQueryResult()) {
        return $results->getResource()->fetchAll();
      }
      else {
        return $results->getAffectedRows();
      }
    }
    catch (\Exception $ex) {
      self::$logger->error("The query: ".$sql."\ncaused the following exception:\n".$ex->getMessage());
      throw new PersistenceException("Error in persistent operation. See log file for details.");
    }
  }
public function executeSql ( $ sql , $ parameters = [ ] ) { if ( $ this -> adapter == null ) { $ this -> connect ( ) ; } try { $ stmt = $ this -> adapter -> createStatement ( $ sql , $ parameters ) ; $ results = $ stmt -> execute ( ) ; if ( $ results -> isQueryResult ( ) ) { return $ results -> getResource ( ) -> fetchAll ( ) ; } else { return $ results -> getAffectedRows ( ) ; } } catch ( \ Exception $ ex ) { self :: $ logger -> error ( "The query: " . $ sql . "\ncaused the following exception:\n" . $ ex -> getMessage ( ) ) ; throw new PersistenceException ( "Error in persistent operation. See log file for details." ) ; } }
Execute a query on the connection.
@param $sql The SQL statement as string
@param $parameters An associative array of parameter name/values pairs to replace the placeholders with (optional, default: empty array)
@return If the query is a select, an array of associative arrays containing the selected data,
the number of affected rows else
Execute a query on the connection .