getSQL() public method

Returns a string containing the most recent SQL query processed by the database adapter, thus conforming to the interface:
See also: Adapter::getSQL Methods like get(), getRow() and exec() cause this SQL cache to get filled. If no SQL query has been processed yet this function will return an empty string.
public getSQL ( ) : string
return string
Example #1
0
 /**
  * Checks if the previous query had a keep-cache tag.
  * If so, the cache will persist, otherwise the cache will be flushed.
  *
  * Returns TRUE if the cache will remain and FALSE if a flush has
  * been performed.
  *
  * @return boolean
  */
 private function updateCache()
 {
     $sql = $this->adapter->getSQL();
     if (strpos($sql, '-- keep-cache') !== strlen($sql) - 13) {
         // If SQL has been taken place outside of this method then something else then
         // a select query might have happened! (or instruct to keep cache)
         $this->cache = array();
         return FALSE;
     }
     return TRUE;
 }