english/libraries/joomla/database/database/sqlsrv.php
/**
	 * Execute the SQL statement.
	 *
	 * @return  mixed  A database cursor resource on success, boolean false on failure.
	 *
	 * @since   11.1
	 * @throws  DatabaseException
	 */
Execute the SQL statement.
@return  mixed  A database cursor resource on success, boolean false on failure.


Execute the SQL statement . @return mixed A database cursor resource on success boolean false on failure .
public function query()
	{
		if (!is_resource($this->connection)) {
			if (JError::$legacy) {
				if ($this->debug) {
					JError::raiseError(500, 'JDatabaseDriverSQLAzure::query: '.$this->errorNum.' - '.$this->errorMsg);
				}
				return false;
			}
			else {
				JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'database');
				throw new DatabaseException;
			}
		}
		$sql = $this->replacePrefix((string) $this->sql);
		if ($this->limit > 0 || $this->offset > 0) {
			$sql = $this->_limit($sql, $this->limit, $this->offset);
		}
		if ($this->debug) {
			$this->count++;
			$this->log[] = $sql;
			JLog::add($sql, JLog::DEBUG, 'databasequery');
		}
		$this->errorNum = 0;
		$this->errorMsg = '';
		if (JString::startsWith(ltrim(strtoupper($sql)), 'SELECT')) {
			$array = array('Scrollable' => SQLSRV_CURSOR_KEYSET);
		}
		else {
			$array = array();
		}
		$this->cursor = sqlsrv_query($this->connection, $sql, array(), $array);
		if (!$this->cursor) {
			$errors = sqlsrv_errors();
			$this->errorNum = $errors[0]['SQLSTATE'];
			$this->errorMsg = $errors[0]['message'].'SQL='.$sql;
			if (JError::$legacy) {
				if ($this->debug) {
					JError::raiseError(500, 'JDatabaseDriverSQLAzure::query: '.$this->errorNum.' - '.$this->errorMsg);
				}
				return false;
			}
			else {
				JLog::add(JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg), JLog::ERROR, 'databasequery');
				throw new DatabaseException;
			}
		}
		return $this->cursor;
	}
public function query ( ) { if ( ! is_resource ( $ this -> connection ) ) { if ( JError :: $ legacy ) { if ( $ this -> debug ) { JError :: raiseError ( 500 , 'JDatabaseDriverSQLAzure::query: ' . $ this -> errorNum . ' - ' . $ this -> errorMsg ) ; } return false ; } else { JLog :: add ( JText :: sprintf ( 'JLIB_DATABASE_QUERY_FAILED' , $ this -> errorNum , $ this -> errorMsg ) , JLog :: ERROR , 'database' ) ; throw new DatabaseException ; } } $ sql = $ this -> replacePrefix ( ( string ) $ this -> sql ) ; if ( $ this -> limit > 0 || $ this -> offset > 0 ) { $ sql = $ this -> _limit ( $ sql , $ this -> limit , $ this -> offset ) ; } if ( $ this -> debug ) { $ this -> count ++ ; $ this -> log [ ] = $ sql ; JLog :: add ( $ sql , JLog :: DEBUG , 'databasequery' ) ; } $ this -> errorNum = 0 ; $ this -> errorMsg = '' ; if ( JString :: startsWith ( ltrim ( strtoupper ( $ sql ) ) , 'SELECT' ) ) { $ array = array ( 'Scrollable' => SQLSRV_CURSOR_KEYSET ) ; } else { $ array = array ( ) ; } $ this -> cursor = sqlsrv_query ( $ this -> connection , $ sql , array ( ) , $ array ) ; if ( ! $ this -> cursor ) { $ errors = sqlsrv_errors ( ) ; $ this -> errorNum = $ errors [ 0 ] [ 'SQLSTATE' ] ; $ this -> errorMsg = $ errors [ 0 ] [ 'message' ] . 'SQL=' . $ sql ; if ( JError :: $ legacy ) { if ( $ this -> debug ) { JError :: raiseError ( 500 , 'JDatabaseDriverSQLAzure::query: ' . $ this -> errorNum . ' - ' . $ this -> errorMsg ) ; } return false ; } else { JLog :: add ( JText :: sprintf ( 'JLIB_DATABASE_QUERY_FAILED' , $ this -> errorNum , $ this -> errorMsg ) , JLog :: ERROR , 'databasequery' ) ; throw new DatabaseException ; } } return $ this -> cursor ; }
Execute the SQL statement.
Execute the SQL statement .
// Legacy error handling switch based on the JError::$legacy switch. // @deprecated  11.3 // Take a local copy so that we don't modify the original query and cause issues later // If debugging is enabled then let's log the query. // Increment the query counter and add the query to the object queue. // Reset the error values. // sqlsrv_num_rows requires a static or keyset cursor. // Execute the query. // If an error occurred handle it. // Populate the errors. // Legacy error handling switch based on the JError::$legacy switch. // @deprecated  11.3