src/Mysqli/MysqliDriver.php
protected function executeUnpreparedQuery($sql)
	{
		$this->connect();

		$cursor = $this->connection->query($sql);

		// If an error occurred handle it.
		if (!$cursor)
		{
			$this->errorNum = (int) $this->connection->errno;
			$this->errorMsg = (string) $this->connection->error;

			// Check if the server was disconnected.
			if (!$this->connected())
			{
				try
				{
					// Attempt to reconnect.
					$this->connection = null;
					$this->connect();
				}
				catch (ConnectionFailureException $e)
				{
					// If connect fails, ignore that exception and throw the normal exception.
					$this->log(
						Log\LogLevel::ERROR,
						'Database query failed (error #{code}): {message}; Failed query: {sql}',
						array('code' => $this->errorNum, 'message' => $this->errorMsg, 'sql' => $sql)
					);

					throw new ExecutionFailureException($sql, $this->errorMsg, $this->errorNum);
				}

				// Since we were able to reconnect, run the query again.
				return $this->executeUnpreparedQuery($sql);
			}

			// The server was not disconnected.
			$this->log(
				Log\LogLevel::ERROR,
				'Database query failed (error #{code}): {message}; Failed query: {sql}',
				array('code' => $this->errorNum, 'message' => $this->errorMsg, 'sql' => $sql)
			);

			throw new ExecutionFailureException($sql, $this->errorMsg, $this->errorNum);
		}

		$this->freeResult($cursor);

		return true;
	}
protected function executeUnpreparedQuery($sql)
	{
		$this->connect();

		$cursor = $this->connection->query($sql);

		// If an error occurred handle it.
		if (!$cursor)
		{
			$this->errorNum = (int) $this->connection->errno;
			$this->errorMsg = (string) $this->connection->error;

			// Check if the server was disconnected.
			if (!$this->connected())
			{
				try
				{
					// Attempt to reconnect.
					$this->connection = null;
					$this->connect();
				}
				catch (ConnectionFailureException $e)
				{
					// If connect fails, ignore that exception and throw the normal exception.
					$this->log(
						Log\LogLevel::ERROR,
						'Database query failed (error #{code}): {message}; Failed query: {sql}',
						array('code' => $this->errorNum, 'message' => $this->errorMsg, 'sql' => $sql)
					);

					throw new ExecutionFailureException($sql, $this->errorMsg, $this->errorNum);
				}

				// Since we were able to reconnect, run the query again.
				return $this->executeUnpreparedQuery($sql);
			}

			// The server was not disconnected.
			$this->log(
				Log\LogLevel::ERROR,
				'Database query failed (error #{code}): {message}; Failed query: {sql}',
				array('code' => $this->errorNum, 'message' => $this->errorMsg, 'sql' => $sql)
			);

			throw new ExecutionFailureException($sql, $this->errorMsg, $this->errorNum);
		}

		$this->freeResult($cursor);

		return true;
	}
protected function executeUnpreparedQuery ( $ sql ) { $ this -> connect ( ) ; $ cursor = $ this -> connection -> query ( $ sql ) ; // If an error occurred handle it. if ( ! $ cursor ) { $ this -> errorNum = ( int ) $ this -> connection -> errno ; $ this -> errorMsg = ( string ) $ this -> connection -> error ; // Check if the server was disconnected. if ( ! $ this -> connected ( ) ) { try { // Attempt to reconnect. $ this -> connection = null ; $ this -> connect ( ) ; } catch ( ConnectionFailureException $ e ) { // If connect fails, ignore that exception and throw the normal exception. $ this -> log ( Log \ LogLevel :: ERROR , 'Database query failed (error #{code}): {message}; Failed query: {sql}' , array ( 'code' => $ this -> errorNum , 'message' => $ this -> errorMsg , 'sql' => $ sql ) ) ; throw new ExecutionFailureException ( $ sql , $ this -> errorMsg , $ this -> errorNum ) ; } // Since we were able to reconnect, run the query again. return $ this -> executeUnpreparedQuery ( $ sql ) ; } // The server was not disconnected. $ this -> log ( Log \ LogLevel :: ERROR , 'Database query failed (error #{code}): {message}; Failed query: {sql}' , array ( 'code' => $ this -> errorNum , 'message' => $ this -> errorMsg , 'sql' => $ sql ) ) ; throw new ExecutionFailureException ( $ sql , $ this -> errorMsg , $ this -> errorNum ) ; } $ this -> freeResult ( $ cursor ) ; return true ; }
Internal method to execute queries which cannot be run as prepared statements.

@param   string  $sql  SQL statement to execute.

@return  boolean

@since   1.5.0
Internal method to execute queries which cannot be run as prepared statements .