PDOStatement
class PDOStatement implements IteratorAggregate (View source)
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 1.0.0)
Represents a prepared statement and, after the statement is executed, an
associated result set.
Properties
| string | $queryString |
Methods
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.1.0)
Executes a prepared statement
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.1.0)
Fetches the next row from a result set
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.1.0)
Binds a parameter to the specified variable name
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.1.0)
Bind a column to a PHP variable
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 1.0.0)
Binds a value to a parameter
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.1.0)
Returns the number of rows affected by the last SQL statement
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.9.0)
Returns a single column from the next row of a result set
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.1.0)
Returns an array containing all of the remaining rows in the result set.
No description
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.1.0)
Fetch the SQLSTATE associated with the last operation on the statement handle
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.1.0)
Fetch extended error information associated with the last operation on the statement handle
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.2.0)
Set a statement attribute
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.2.0)
Retrieve a statement attribute
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.2.0)
Returns the number of columns in the result set
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.2.0)
Returns metadata for a column in a result set
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.2.0)
Set the default fetch mode for this statement
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.2.0)
Advances to the next rowset in a multi-rowset statement handle
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.9.0)
Closes the cursor, enabling the statement to be executed again.
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.9.0)
Dump an SQL prepared command
No description
No description
No description
No description
Details
bool
execute(array $params = null)
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.1.0)
Executes a prepared statement
mixed
fetch(int $mode = PDO::FETCH_DEFAULT, int $cursorOrientation = PDO::FETCH_ORI_NEXT, int $cursorOffset = 0)
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.1.0)
Fetches the next row from a result set
bool
bindParam(mixed $param, mixed $var, int $type = PDO::PARAM_STR, int $maxLength = 0, mixed $driverOptions = null)
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.1.0)
Binds a parameter to the specified variable name
bool
bindColumn(mixed $column, mixed $var, int $type = PDO::PARAM_STR, int $maxLength = 0, mixed $driverOptions = null)
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.1.0)
Bind a column to a PHP variable
bool
bindValue(mixed $param, mixed $value, int $type = PDO::PARAM_STR)
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 1.0.0)
Binds a value to a parameter
int
rowCount()
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.1.0)
Returns the number of rows affected by the last SQL statement
mixed
fetchColumn(int $column = 0)
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.9.0)
Returns a single column from the next row of a result set
array
fetchAll(int $mode = PDO::FETCH_DEFAULT, $fetch_argument = null, mixed ...$args)
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.1.0)
Returns an array containing all of the remaining rows in the result set.
The array represents each row as either an array of column values or an object with properties corresponding to each column name. An empty array is returned if there are zero results to fetch.
Using this method to fetch large result sets will result in a heavy demand on system and possibly network resources. Rather than retrieving all of the data and manipulating it in PHP, consider using the database server to manipulate the result sets. For example, use the WHERE and ORDER BY clauses in SQL to restrict results before retrieving and processing them with PHP.
object|false
fetchObject(T> $class = "stdClass", array $constructorArgs = [])
No description
string|null
errorCode()
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.1.0)
Fetch the SQLSTATE associated with the last operation on the statement handle
array
errorInfo()
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.1.0)
Fetch extended error information associated with the last operation on the statement handle
bool
setAttribute(int $attribute, mixed $value)
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.2.0)
Set a statement attribute
mixed
getAttribute(int $name)
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.2.0)
Retrieve a statement attribute
int
columnCount()
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.2.0)
Returns the number of columns in the result set
array|false
getColumnMeta(int $column)
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.2.0)
Returns metadata for a column in a result set
bool
setFetchMode(int $mode, mixed ...$args)
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.2.0)
Set the default fetch mode for this statement
bool
nextRowset()
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.2.0)
Advances to the next rowset in a multi-rowset statement handle
bool
closeCursor()
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.9.0)
Closes the cursor, enabling the statement to be executed again.
bool|null
debugDumpParams()
(PHP 5 >= 5.1.0, PHP 7, PECL pdo >= 0.9.0)
Dump an SQL prepared command
final
__wakeup()
No description
final
__sleep()
No description
Traversable
getIterator()
No description
connect()
No description