Back to Nested class

Method _runQuery

protected void
_runQuery
(mixed $query, mixed $errorMessage)
Runs a query and unlocks the database on an error.
Parameters
  • mixed $query A string or DatabaseQuery object.
  • string $errorMessage Unused.
Returns
  • void
Since
  • 1.7.0
-
  • Since 3.0.0 this method returns void and will rethrow the database exception.
  • \Exception on database error.
Class: Nested
Project: Joomla

Method _runQuery - Source code

/**
 * Runs a query and unlocks the database on an error.
 *
 * @param   mixed   $query         A string or DatabaseQuery object.
 * @param   string  $errorMessage  Unused.
 *
 * @return  void
 *
 * @note    Since 3.0.0 this method returns void and will rethrow the database exception.
 * @since   1.7.0
 * @throws  \Exception on database error.
 */
protected function _runQuery($query, $errorMessage)
{
    // Prepare to catch an exception.
    try {
        $this->_db->setQuery($query)->execute();
        if ($this->_debug) {
            $this->_logtable();
        }
    } catch (\Exception $e) {
        // Unlock the tables and rethrow.
        $this->_unlock();
        throw $e;
    }
}