Skip to content

Instantly share code, notes, and snippets.

@nayibor
Created July 10, 2015 00:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nayibor/51843133896296d67fbc to your computer and use it in GitHub Desktop.
Save nayibor/51843133896296d67fbc to your computer and use it in GitHub Desktop.
rawQuery_puzzle
* @param string $sql SQL statement
* @param array $params Additional options for the query.
* @return mixed Resource or object representing the result set, or false on failure
*/
public function rawQuery($sql, $params = array()) {
$this->took = $this->numRows = false;
return $this->execute($sql, $params);
}
/**
* Queries the database with given SQL statement, and obtains some metadata about the result
* (rows affected, timing, any errors, number of rows in resultset). The query is also logged.
* If Configure::read('debug') is set, the log is shown all the time, else it is only shown on errors.
*
* ### Options
*
* - log - Whether or not the query should be logged to the memory log.
*
* @param string $sql SQL statement
* @param array $options The options for executing the query.
* @param array $params values to be bound to the query.
* @return mixed Resource or object representing the result set, or false on failure
*/
public function execute($sql, $options = array(), $params = array()) {
$options += array('log' => $this->fullDebug);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment