Easy Tutorial
❮ Func Ftp Nlist Func Directory Opendir ❯

PHP PDO Predefined Constants

PHP PDO Reference Manual

The following constants are defined by this extension module, and will only be available when this module is either compiled into PHP or dynamically loaded at runtime.

Note: PDO uses class constants since PHP 5.1. Previous versions used the global constant form PDO_PARAM_BOOL.

| PDO::PARAM_BOOL (integer) | Represents the Boolean data type. | | PDO::PARAM_NULL (integer) | Represents the SQL NULL data type. | | PDO::PARAM_INT (integer) | Represents the integer data type in SQL. | | PDO::PARAM_STR (integer) | Represents the CHAR, VARCHAR, or other string data types in SQL. | | PDO::PARAM_LOB (integer) | Represents the large object data type in SQL. | | PDO::PARAM_STMT (integer) | Represents a recordset type. Currently not supported by any drivers. | | PDO::PARAM_INPUT_OUTPUT (integer) | Specifies that the parameter is an INOUT parameter of a stored procedure. Must be combined with a bitwise OR of the PDO::PARAM_* data type. | | PDO::FETCH_LAZY (integer) | Specifies the fetch mode, returning each row as an object with variable names that correspond to the column names. PDO::FETCH_LAZY creates the variable names while accessing them. Not valid in PDOStatement::fetchAll(). | | PDO::FETCH_ASSOC (integer) | Specifies the fetch mode, returning each row as an array indexed by column name. If the result set contains multiple columns with the same name, PDO::FETCH_ASSOC returns only one value per column name. | | PDO::FETCH_NAMED (integer) | Specifies the fetch mode, returning each row as an array indexed by column name. If the result set contains multiple columns with the same name, PDO::FETCH_ASSOC returns an array of values per column name. | | PDO::FETCH_NUM (integer) | Specifies the fetch mode, returning each row as an array indexed by column number, starting at column 0. | | PDO::FETCH_BOTH (integer) | Specifies the fetch mode, returning each row as an array indexed by both column number and column name, starting at column 0. | | PDO::FETCH_OBJ (integer) | Specifies the fetch mode, returning each row as an object with property names that correspond to the column names. | | PDO::FETCH_BOUND (integer) | Specifies the fetch mode, returning TRUE and assigning the column values to the PHP variables bound by PDOStatement::bindParam() or PDOStatement::bindColumn(). | | PDO::FETCH_COLUMN (integer) | Specifies the fetch mode, returning the requested column from the next row in the result set. | | PDO::FETCH_CLASS (integer) | Specifies the fetch mode, returning a new instance of the requested class, mapping columns to class properties. <br> **Note:** If the property does not exist in the requested class, the __set() magic method is called. | | PDO::FETCH_INTO (integer) | Specifies the fetch mode, updating an existing instance of the requested class, mapping columns to class properties. | | PDO::FETCH_FUNC (integer) | Allows complete custom handling of data at runtime. (Valid only in PDOStatement::fetchAll()). | | PDO::FETCH_GROUP (integer) | Returns grouped by value. Typically used with PDO::FETCH_COLUMN or PDO::FETCH_KEY_PAIR. | | PDO::FETCH_UNIQUE (integer) | Returns only unique values. | | PDO::FETCH_KEY_PAIR (integer) | Fetches a two-column result into an array where the first column is a key and the second column is the value. Available since PHP 5.2.3. | | PDO::FETCH_CLASSTYPE (integer) | Determines the class name from the value of the first column. | | PDO::FETCH_SERIALIZE (integer) | Similar to PDO::FETCH_INTO, but the object is represented as a serialized string. Available since PHP 5.1.0. Since PHP 5.3.0, if this flag is set, the class constructor is never called. | | PDO::FETCH_PROPS_LATE (integer) | Calls the constructor before setting properties. Available since PHP 5.2.0. | | PDO::ATTR_AUTOCOMMIT (integer) | If this value is FALSE, PDO will attempt to disable autocommit so that the database connection begins a transaction. | | PDO::ATTR_PREFETCH (integer) | Sets the prefetch size to balance speed and memory usage for your application. Not all database/driver combinations support setting the prefetch size. A larger prefetch size improves performance but also consumes more memory. | | PDO::ATTR_TIMEOUT (integer) | Sets the timeout in seconds for connecting to the database. | | PDO::ATTR_ERRMODE (integer) | For more information about this attribute, see the Error and Error Handling section. | | PDO::ATTR_SERVER_VERSION (integer) | This is a read-only attribute; returns the version information of the database service connected by PDO. | | PDO::ATTR_CLIENT_VERSION (integer) | This is a read-only attribute; returns the version information of the client library used by the PDO driver. | | PDO::ATTR_SERVER_INFO (integer) | This is a read-only attribute. Returns some meta-information about the database service connected by PDO. | | PDO::ATTR_CONNECTION_STATUS (integer) | | | PDO::ATTR_CASE (integer) | Forces column names to the specified case using constants like PDO::CASE_. | | PDO::ATTR_CURSOR_NAME (integer) | Gets or sets the name of the cursor. Useful when using scrollable cursors and positioned updates. | | PDO::ATTR_CURSOR (integer) | Selects the cursor type. PDO currently supports PDO::CURSOR_FWDONLY and PDO::CURSOR_SCROLL. Generally, PDO::CURSOR_FWDONLY is used unless a scrollable cursor is truly needed. | | PDO::ATTR_DRIVER_NAME (string) | Returns the driver name. Example of using PDO::ATTR_DRIVER_NAME: <?php<br>if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') {<br> echo "Running on mysql; doing something mysql specific here\n";<br>}<br>?> | | PDO::ATTR_ORACLE_NULLS (integer) | Converts empty strings to SQL NULL when fetching data. | | PDO::ATTR_PERSISTENT (integer) | Requests a persistent connection instead of creating a new one. For more information about this attribute, see the Connections and Connection Management section. | | PDO::ATTR_STATEMENT_CLASS (integer) | | | PDO::ATTR_FETCH_CATALOG_NAMES (integer) | Adds the catalog name to each column name in the result set. The catalog name and column name are separated by a dot (.). This attribute is supported at the driver level, so some drivers may not support it. | | PDO::ATTR_FETCH_TABLE_NAMES (integer) | Adds the table name to each column name in the result set. The table name and column name are separated by a dot (.). This attribute is supported at the driver level, so some drivers may not support it. | | PDO::ATTR_STRINGIFY_FETCHES (integer) | | | PDO::ATTR_MAX_COLUMN_LEN (integer) | | | PDO::ATTR_DEFAULT_FETCH_MODE (integer) | Available since PHP 5.2.0. | | PDO::ATTR_EMULATE_PREPARES (integer) | Available since PHP 5.1.3. | | PDO::ERRMODE_SILENT (integer) | If an error occurs, no error or exception is shown. Expects the developer to explicitly check for errors. This is the default mode. For more information about this attribute, see the Error and Error Handling section. | | PDO::ERRMODE_WARNING (integer) | If an error occurs, a PHP E_WARNING message is displayed. For more information about this attribute, see the Error and Error Handling section. | | PDO::ERRMODE_EXCEPTION (integer) | If an error occurs, a PDOException is thrown. For more information about this attribute, see the Error and Error Handling section. | | PDO::CASE_NATURAL (integer) | Retains the column names as returned by the database driver. | | PDO::CASE_LOWER (integer) | Forces column names to lowercase. | | PDO::CASE_UPPER (integer) | Forces column names to uppercase. | | PDO::NULL_NATURAL (integer) | | | PDO::NULL_EMPTY_STRING (integer) | | | PDO::NULL_TO_STRING (integer) | | | PDO::FETCH_ORI_NEXT (integer) | Fetches the next row in the result set. Valid only for scrollable cursors. | | PDO::FETCH_ORI_PRIOR (integer) | Fetches the previous row in the result set. Valid only for scrollable cursors. | | PDO::FETCH_ORI_FIRST (integer) | Fetches the first row in the result set. Valid only for scrollable cursors. | | PDO::FETCH_ORI_LAST (integer) | Fetches the last row in the result set. Valid only for scrollable cursors. | | PDO::FETCH_ORI_ABS (integer) | Fetches the requested row by row number from the result set. Valid only for scrollable cursors. | | PDO::FETCH_ORI_REL (integer) | Fetches the requested row by relative position from the current cursor position in the result set. Valid only for scrollable cursors. | | PDO::CURSOR_FWDONLY (integer) | Creates a forward-only cursor PDOStatement object. This is the default cursor option as it is the fastest and most commonly used data access pattern in PHP. | | PDO::CURSOR_SCROLL (integer) | Creates a scrollable cursor PDOStatement object. Controls which row is fetched from the result set with the PDO::FETCH_ORI_ constants. | | PDO::ERR_NONE (string) | Corresponds to SQLSTATE '00000', indicating that the SQL statement was issued successfully without errors or warnings. This constant is useful when using PDO::errorCode() or PDOStatement::errorCode() to determine if an error occurred. It is frequently used when checking the error status code returned by these methods. | | PDO::PARAM_EVT_ALLOC (integer) | Allocation event | | PDO::PARAM_EVT_FREE (integer) | Deallocation event | | PDO::PARAM_EVT_EXEC_PRE (integer) | Event triggered before executing a prepared statement. | | PDO::PARAM_EVT_EXEC_POST (integer) | Event triggered after executing a prepared statement. | | PDO::PARAM_EVT_FETCH_PRE (integer) | Event triggered before fetching a result from a result set. | | PDO::PARAM_EVT_FETCH_POST (integer) | Event triggered after fetching a result from a result set. | | PDO::PARAM_EVT_NORMALIZE (integer) | Event triggered when binding parameters allow the driver to normalize the variable name. |


PHP PDO Reference Manual

❮ Func Ftp Nlist Func Directory Opendir ❯