PdoStatement
Implements StatementInterfacePDO Database Statement.
| since |
2.0.0 |
|---|---|
| package |
Joomla Framework |
Methods
__construct
Statement constructor
__construct(\PDOStatement pdoStatement) :
| since |
2.0.0 |
|---|
Arguments
- pdoStatement
PDOStatementThe decorated PDOStatement object.
Response
mixed
bindParam
Binds a parameter to the specified variable name.
bindParam(string|int parameter, &variable, dataType = ParameterType::STRING, length = null, mixed||string|int 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
intThe length of the variable. Usually required for OUTPUT parameters.- driverOptions
array<string|int, mixed>Optional driver options to be used.
Response
bool
closeCursor
Closes the cursor, enabling the statement to be executed again.
closeCursor() :
| since |
2.0.0 |
|---|
Response
void
convertFetchMode
Converts the database API's fetch mode to a PDO fetch mode
convertFetchMode( mode) :
| since |
2.0.0 |
|---|---|
| throws |
|
Arguments
- mode
intFetch mode to convert
Response
int
convertParameterType
Converts the database API's parameter type to a PDO parameter type
convertParameterType( type) :
| since |
2.0.0 |
|---|---|
| throws |
|
Arguments
- type
stringParameter type to convert
Response
int
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 beforefetch()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.
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
Constants
FETCH_MODE_MAP
Mapping array for fetch modes.
| Value | [\Joomla\Database\FetchMode::ASSOCIATIVE => \PDO::FETCH_ASSOC, \Joomla\Database\FetchMode::NUMERIC => \PDO::FETCH_NUM, \Joomla\Database\FetchMode::MIXED => \PDO::FETCH_BOTH, \Joomla\Database\FetchMode::STANDARD_OBJECT => \PDO::FETCH_OBJ, \Joomla\Database\FetchMode::COLUMN => \PDO::FETCH_COLUMN, \Joomla\Database\FetchMode::CUSTOM_OBJECT => \PDO::FETCH_CLASS] |
|---|---|
| since |
2.0.0 |
Type(s)
array<string|int, mixed>
PARAMETER_TYPE_MAP
Mapping array for parameter types.
| Value | [\Joomla\Database\ParameterType::BOOLEAN => \PDO::PARAM_BOOL, \Joomla\Database\ParameterType::INTEGER => \PDO::PARAM_INT, \Joomla\Database\ParameterType::LARGE_OBJECT => \PDO::PARAM_LOB, \Joomla\Database\ParameterType::NULL => \PDO::PARAM_NULL, \Joomla\Database\ParameterType::STRING => \PDO::PARAM_STR] |
|---|---|
| since |
2.0.0 |
Type(s)
array<string|int, mixed>
Properties
pdoStatement
The decorated PDOStatement object.
| since |
2.0.0 |
|---|
Type(s)
PDOStatement