The constants below are defined by this extension, and
will only be available when the extension has either
been compiled into PHP or dynamically loaded at runtime.
Other Constants
PDO::PARAM_BOOL
(int)
Represents a boolean data type.
PDO::PARAM_NULL
(int)
Represents the SQL NULL data type.
PDO::PARAM_INT
(int)
Represents the SQL INTEGER data type.
PDO::PARAM_STR
(int)
Represents the SQL CHAR, VARCHAR, or other string data type.
PDO::PARAM_STR_NATL
(int)
Flag to denote a string uses the national character set.
Available as of PHP 7.2.0
PDO::PARAM_STR_CHAR
(int)
Flag to denote a string uses the regular character set.
Available as of PHP 7.2.0
PDO::PARAM_LOB
(int)
Represents the SQL large object data type.
PDO::PARAM_STMT
(int)
Represents a recordset type. Not currently supported by any drivers.
PDO::PARAM_INPUT_OUTPUT
(int)
Specifies that the parameter is an INOUT parameter for a stored
procedure. This constant must be bitwise-ORed with one of the
PDO::PARAM_* constants.
PDO::ATTR_AUTOCOMMIT
(int)
If this value is false, PDO attempts to disable autocommit so that the
connection begins a transaction.
PDO::ATTR_PREFETCH
(int)
Setting the prefetch size allows balancing speed against memory
usage for an application. Not all database/driver combinations support
setting of the prefetch size. A larger prefetch size results in
increased performance at the cost of higher memory usage.
PDO::ATTR_TIMEOUT
(int)
Sets the timeout value in seconds for communications with the database.
This is a read only attribute; it will return information about the
version of the database server to which PDO is connected.
PDO::ATTR_CLIENT_VERSION
(int)
This is a read only attribute; it will return information about the
version of the client libraries that the PDO driver is using.
PDO::ATTR_SERVER_INFO
(int)
This is a read only attribute; it will return some meta information about the
database server to which PDO is connected.
PDO::ATTR_CONNECTION_STATUS
(int)
PDO::ATTR_CASE
(int)
Force column names to a specific case specified by the
PDO::CASE_*
constants.
PDO::ATTR_CURSOR_NAME
(int)
Get or set the name to use for a cursor. Most useful when using
scrollable cursors and positioned updates.
PDO::ATTR_CURSOR
(int)
Selects the cursor type. PDO currently supports either
PDO::CURSOR_FWDONLY or
PDO::CURSOR_SCROLL.
Unless one has a need for scrollable cursors, one should use the
PDO::CURSOR_FWDONLY cursor mode.
PDO::ATTR_DRIVER_NAME
(int)
Returns the name of the driver.
Example #1 using PDO::ATTR_DRIVER_NAME
<?php
if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') {
echo "Running on mysql; doing something mysql specific here\n";
}
?>
PDO::ATTR_ORACLE_NULLS
(int)
Convert empty strings to SQL NULL values on data fetches.
PDO::ATTR_PERSISTENT
(int)
Request a persistent connection, rather than creating a new connection.
See Connections and Connection
management for more information on this attribute.
PDO::ATTR_STATEMENT_CLASS
(int)
Sets the class name of which statements are returned as.
PDO::ATTR_FETCH_CATALOG_NAMES
(int)
Prepend the containing catalog name to each column name returned in the
result set. The catalog name and column name are separated by a decimal
(.) character. Support of this attribute is at the driver level; it may
not be supported by the driver in use.
PDO::ATTR_FETCH_TABLE_NAMES
(int)
Prepend the containing table name to each column name returned in the
result set. The table name and column name are separated by a decimal (.)
character. Support of this attribute is at the driver level; it may
not be supported by the driver in use.
PDO::ATTR_STRINGIFY_FETCHES
(int)
Forces all fetched values (except null) to be treated as strings.
null values remain unchanged unless PDO::ATTR_ORACLE_NULLS
is set to PDO::NULL_TO_STRING.
PDO::ATTR_MAX_COLUMN_LEN
(int)
Sets the maximum column name length.
PDO::ATTR_DEFAULT_FETCH_MODE
(int)
PDO::ATTR_EMULATE_PREPARES
(int)
PDO::ATTR_DEFAULT_STR_PARAM
(int)
Sets the default string parameter type, this can be one of PDO::PARAM_STR_NATL
and PDO::PARAM_STR_CHAR.
Available as of PHP 7.2.0.
PDO::ERRMODE_SILENT
(int)
Do not raise an error or exception if an error occurs.
The developer is expected to explicitly check for errors.
Prior to PHP 8.0.0, this was the default mode.
See Errors and error handling
for more information about this attribute.
PDO::ERRMODE_WARNING
(int)
Issue a PHP E_WARNING message if an error occurs.
See Errors and error handling
for more information about this attribute.
PDO::ERRMODE_EXCEPTION
(int)
Throw a PDOException if an error occurs.
This is the default mode as of PHP 8.0.0.
See Errors and error handling
for more information about this attribute.
PDO::CASE_NATURAL
(int)
Leave column names as returned by the database driver.
PDO::CASE_LOWER
(int)
Force column names to lower case.
PDO::CASE_UPPER
(int)
Force column names to upper case.
PDO::NULL_NATURAL
(int)
PDO::NULL_EMPTY_STRING
(int)
PDO::NULL_TO_STRING
(int)
PDO::ERR_NONE
(string)
Corresponds to SQLSTATE '00000', meaning that the SQL
statement was successfully issued with no errors or warnings.
This constant is a convenience constant to help when checking
PDO::errorCode or
PDOStatement::errorCode to determine if an error
occurred.
This is usually known by examining the return code from the method
that raised the error condition anyway.
PDO::PARAM_EVT_ALLOC
(int)
Allocation event
PDO::PARAM_EVT_FREE
(int)
Deallocation event
PDO::PARAM_EVT_EXEC_PRE
(int)
Event triggered prior to execution of a prepared statement.
PDO::PARAM_EVT_EXEC_POST
(int)
Event triggered subsequent to execution of a prepared statement.
PDO::PARAM_EVT_FETCH_PRE
(int)
Event triggered prior to fetching a result from a resultset.
PDO::PARAM_EVT_FETCH_POST
(int)
Event triggered subsequent to fetching a result from a resultset.
PDO::PARAM_EVT_NORMALIZE
(int)
Event triggered during bound parameter registration
allowing the driver to normalize the parameter name.
PDO::SQLITE_DETERMINISTIC
(int)
Specifies that a function created with PDO::sqliteCreateFunction
is deterministic, i.e. it always returns the same result given the same inputs within
a single SQL statement. (Available as of PHP 7.1.4.)