SqlsrvStatement

Implements StatementInterface

SQL Server Database Statement.

This class is modeled on \Doctrine\DBAL\Driver\SQLSrv\SQLSrvStatement

since

2.0.0

package

Joomla Framework

Methods

__construct

Constructor.

__construct( connection,  query) : 
since

2.0.0

throws

PrepareStatementFailureException

Arguments

connection

resourceThe database connection resource

query

stringThe query this statement will process

Response

mixed

bindParam

Binds a parameter to the specified variable name.

bindParam(string|int parameter,  &variable,  dataType = ParameterType::STRING, int length = null, array driverOptions = null) : 
since

2.0.0

Arguments

parameter

string|intParameter identifier. For a prepared statement using named placeholders, this will be a parameter name of the form :name. For a prepared statement using question mark placeholders, this will be the 1-indexed position of the parameter.

variable

mixedName of the PHP variable to bind to the SQL statement parameter.

dataType

stringConstant corresponding to a SQL datatype, this should be the processed type from the QueryInterface.

length

int|nullThe length of the variable. Usually required for OUTPUT parameters.

driverOptions

array<string|int, mixed>|nullOptional driver options to be used.

Response

bool

bindValue

Binds a value to the specified variable.

bindValue(string|int parameter,  variable,  dataType = ParameterType::STRING) : 
since

2.0.0

Arguments

parameter

string|intParameter identifier. For a prepared statement using named placeholders, this will be a parameter name of the form :name. For a prepared statement using question mark placeholders, this will be the 1-indexed position of the parameter.

variable

mixedName of the PHP variable to bind to the SQL statement parameter.

dataType

stringConstant corresponding to a SQL datatype, this should be the processed type from the QueryInterface.

Response

void

closeCursor

Closes the cursor, enabling the statement to be executed again.

closeCursor() : 
since

2.0.0

Response

void

errorCode

Fetches the SQLSTATE associated with the last operation on the statement handle.

errorCode() : 
since

2.0.0

Response

string

errorInfo

Fetches extended error information associated with the last operation on the statement handle.

errorInfo() : mixed||string|int
since

2.0.0

Response

array<string|int, mixed>

execute

Executes a prepared statement

execute(array|null parameters = null) : 
since

2.0.0

Arguments

parameters

array<string|int, mixed>|nullAn array of values with as many elements as there are bound parameters in the SQL statement being executed.

Response

bool

fetch

Fetches the next row from a result set

fetch(int|null fetchStyle = null,  cursorOrientation = FetchOrientation::NEXT,  cursorOffset) : 
since

2.0.0

Arguments

fetchStyle

int|nullControls how the next row will be returned to the caller. This value must be one of the FetchMode constants, defaulting to value of FetchMode::MIXED.

cursorOrientation

intFor a StatementInterface object representing a scrollable cursor, this value determines which row will be returned to the caller. This value must be one of the FetchOrientation constants, defaulting to FetchOrientation::NEXT.

cursorOffset

intFor a StatementInterface object representing a scrollable cursor for which the cursorOrientation parameter is set to FetchOrientation::ABS, this value specifies the absolute number of the row in the result set that shall be fetched. For a StatementInterface object representing a scrollable cursor for which the cursorOrientation parameter is set to FetchOrientation::REL, this value specifies the row to fetch relative to the cursor position before fetch() was called.

Response

mixedThe return value of this function on success depends on the fetch type. In all cases, boolean false is returned on failure.

fetchColumn

Returns a single column from the next row of a result set

fetchColumn( columnIndex) : 
since

2.0.0

Arguments

columnIndex

int0-indexed number of the column you wish to retrieve from the row. If no value is supplied, the first column is retrieved.

Response

mixedReturns a single column from the next row of a result set or boolean false if there are no more rows.

prepare

Prepares the SQL Server statement resource for execution

prepare() : 
since

2.0.0

Response

resource

prepareParameterKeyMapping

Replace named parameters with numbered parameters

prepareParameterKeyMapping( sql) : 
since

2.0.0

Arguments

sql

stringThe SQL statement to prepare.

Response

stringThe processed SQL statement.

rowCount

Returns the number of rows affected by the last SQL statement.

rowCount() : 
since

2.0.0

Response

int

setFetchMode

Sets the fetch mode to use while iterating this statement.

setFetchMode( fetchMode,  args) : 
since

2.0.0

Arguments

fetchMode

intThe fetch mode, must be one of the FetchMode constants.

args

mixedOptional mode-specific arguments.

Response

void

Properties

connection

The database connection resource.

since

2.0.0

Type(s)

resource

defaultFetchStyle

The default fetch mode for the statement.

since

2.0.0

Type(s)

int

defaultObjectClass

The default class to use for building object result sets.

since

2.0.0

Type(s)

string

fetchMap

Mapping array converting fetch modes to the native engine type.

since

2.0.0

Type(s)

array<string|int, mixed>

query

The query string being prepared.

since

2.0.0

Type(s)

string

result

Internal tracking flag to set whether there is a result set available for processing

since

2.0.0

Type(s)

bool

statement

The prepared statement.

since

2.0.0

Type(s)

resource|null

typesKeyMapping

Bound parameter types.

since

2.0.0

Type(s)

array<string|int, mixed>

bindedValues

References to the variables bound as statement parameters.

since

2.0.0

Type(s)

array<string|int, mixed>

parameterKeyMapping

Mapping between named parameters and position in query.

since

2.0.0

Type(s)

array<string|int, mixed>

parameterTypeMapping

Mapping array for parameter types.

since

2.0.0

Type(s)

array<string|int, mixed>