Latest web development tutorials

PHP PDO Predefined Constants

PHP PDO Reference Manual PHP PDO Reference Manual

The following constants are defined by this extension, so only when the extension module is compiled into PHP or dynamically loaded at runtime only after effective.

Note: PDO using class constants since PHP 5.1. PDO_PARAM_BOOL global constants in the form of the previous version.

PDO :: PARAM_BOOL (integer) It represents Boolean data type.
PDO :: PARAM_NULL (integer) Expressed in SQL NULL data type.
PDO :: PARAM_INT (integer) SQL representation of integers.
PDO :: PARAM_STR (integer) Expressed in SQL CHAR, VARCHAR, or other string type.
PDO :: PARAM_LOB (integer) It indicates SQL large object data types.
PDO :: PARAM_STMT (integer) It represents a record set type. Not currently supported by any drivers.
PDO :: PARAM_INPUT_OUTPUT (integer) Specify parameters for INOUT parameter of a stored procedure. You must be an explicit PDO :: PARAM_ * data type with this bit or value.
PDO :: FETCH_LAZY (integer) Obtaining specified, each row in the result set is returned as an object, the object variable name corresponds to the column name. PDO :: FETCH_LAZY create an object variable names used to visit. Invalid PDOStatement :: fetchAll () in.
PDO :: FETCH_ASSOC (integer) Get specified manner, for each row in the result set returned by the array as a column name index. If the result set contains multiple columns with the same name, the PDO :: FETCH_ASSOC each column name to return only one value.
PDO :: FETCH_NAMED (integer) Get specified manner, for each row in the result set returned by the array as a column name index. If the result set contains multiple columns with the same name, the PDO :: FETCH_ASSOC each column name returns an array containing the value.
PDO :: FETCH_NUM (integer) Specifies the acquisition mode, corresponding to each row in the result set returned by the array as a column number of the index, start from 0.
PDO :: FETCH_BOTH (integer) Specifies the acquisition mode, corresponding to each row in the result set returned by the array as a column number and column names of the index, start from 0.
PDO :: FETCH_OBJ (integer) Obtaining specified, each row in the result set as an attribute of the corresponding object name column name returned.
PDO :: FETCH_BOUND (integer) Obtaining specified, returns TRUE and the value assigned to the columns in the result set by PDOStatement :: bindParam () or PDOStatement :: bindColumn () PHP variable method bindings.
PDO :: FETCH_COLUMN (integer) Specifies the acquisition mode, the next row from the result set returns the row need.
PDO :: FETCH_CLASS (integer) Obtaining specified, returns a new instance of the requested class, mapping the columns to the corresponding class attribute name.

Note: This property if the requested class does not exist, then call __set () magic method

PDO :: FETCH_INTO (integer) Obtaining specified, a request to update an existing instance of the class, the class is mapped to a column in the corresponding attribute name.
PDO :: FETCH_FUNC (integer) It allows full operation with a custom processing data. (() Is valid only in PDOStatement :: fetchAll).
PDO :: FETCH_GROUP (integer) Grouped according to the value returned. Usually PDO :: FETCH_COLUMN or PDO :: FETCH_KEY_PAIR used together.
PDO :: FETCH_UNIQUE (integer) Just take a unique value.
PDO :: FETCH_KEY_PAIR (integer) Get a set of two results into an array, where the first column is the key name, the second column is the value. Available since PHP 5.2.3 onwards.
PDO :: FETCH_CLASSTYPE (integer) Determine the class name based on the values ​​of the first column.
PDO :: FETCH_SERIALIZE (integer) Similar PDO :: FETCH_INTO, but with a serialized string representation of the object. Available since PHP 5.1.0. Starting from PHP 5.3.0, if this flag is set, then the constructor will not be called from class.
PDO :: FETCH_PROPS_LATE (integer) Call the constructor before setting attributes. Available since PHP 5.2.0 onwards.
PDO :: ATTR_AUTOCOMMIT (integer) If this value is FALSE, PDO attempts to disable autocommit so that the database connection starts a transaction.
PDO :: ATTR_PREFETCH (integer) Prefetch size to set for your application balance speed and memory usage. Not all database / driver combinations support setting prefetch size. Larger prefetch size leads to improved performance but also takes up more memory.
PDO :: ATTR_TIMEOUT (integer) Setting database connection timeout in seconds.
PDO :: ATTR_ERRMODE (integer) For more information on this property, refer to the error and error handling.
PDO :: ATTR_SERVER_VERSION (integer) This is a read-only property; returns the version information of the PDO database connection services.
PDO :: ATTR_CLIENT_VERSION (integer) This is a read-only property; returns the PDO driver version used by the client library.
PDO :: ATTR_SERVER_INFO (integer) This is a read-only property. PDO return some meta information about the connected database services.
PDO :: ATTR_CONNECTION_STATUS (integer)
PDO :: ATTR_CASE (integer) In a similar PDO :: CASE_ * constants called mandatory columns specified case.
PDO :: ATTR_CURSOR_NAME (integer) Gets or sets the name of the cursor. Update time is useful when using scrollable cursors and positioning.
PDO :: ATTR_CURSOR (integer) Choosing cursor types. PDO currently supports PDO :: CURSOR_FWDONLY and PDO :: CURSOR_SCROLL. Generally PDO :: CURSOR_FWDONLY, unless really need a scrollable cursor.
PDO :: ATTR_DRIVER_NAME (string) Returns the name of the drive.

Examples of using the 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 (integer) When obtaining data to convert the empty string to the SQL NULL.
PDO :: ATTR_PERSISTENT (integer) Request a persistent connection, rather than create a new connection. For more information on this property, refer to the connection with the Connection Manager.
PDO :: ATTR_STATEMENT_CLASS (integer)
PDO :: ATTR_FETCH_CATALOG_NAMES (integer) Will contain the name of the directory is added to the front of each column in the result set name. Directory name and column name separated by one decimal point (.). This property is in the driver level support, so some drivers may not support this property.
PDO :: ATTR_FETCH_TABLE_NAMES (integer) The table contains the name of each column is added to the front of the result set name. Table name and column name separated by one decimal point (.). This property is in the driver level support, so some drivers may not support this property.
PDO :: ATTR_STRINGIFY_FETCHES (integer)
PDO :: ATTR_MAX_COLUMN_LEN (integer)
PDO :: ATTR_DEFAULT_FETCH_MODE (integer) Available since PHP 5.2.0 onwards.
PDO :: ATTR_EMULATE_PREPARES (integer) Available since PHP 5.1.3 onwards.
PDO :: ERRMODE_SILENT (integer) If an error occurs, no errors or abnormal display. Developers want to explicitly check for errors. This is the default mode. For more information on this property, refer to the error and error handling.
PDO :: ERRMODE_WARNING (integer) If an error occurs, a PHP E_WARNING message is displayed. For more information on this property, refer to the error and error handling.
PDO :: ERRMODE_EXCEPTION (integer) If an error occurs, an exception is thrown a PDOException. For more information on this property, refer to the error and error handling.
PDO :: CASE_NATURAL (integer) Leave database-driven return column names.
PDO :: CASE_LOWER (integer) Forced lowercase column names.
PDO :: CASE_UPPER (integer) Forced column name in uppercase.
PDO :: NULL_NATURAL (integer)
PDO :: NULL_EMPTY_STRING (integer)
PDO :: NULL_TO_STRING (integer)
PDO :: FETCH_ORI_NEXT (integer) Focus Fetches the next row in the result. Only scrollable cursors valid.
PDO :: FETCH_ORI_PRIOR (integer) Get on the line in the result set. Only scrollable cursors valid.
PDO :: FETCH_ORI_FIRST (integer) Focus on obtaining a first row in the result. Only scrollable cursors valid.
PDO :: FETCH_ORI_LAST (integer) Get centralized last row in the result. Only scrollable cursors valid.
PDO :: FETCH_ORI_ABS (integer) Get line needs to focus on according to the row number from the result. Only scrollable cursors valid.
PDO :: FETCH_ORI_REL (integer) Depending on the relative position of the current cursor position from the result set to obtain the desired lines. Only scrollable cursors valid.
PDO :: CURSOR_FWDONLY (integer) Create a forward-only cursor PDOStatement object. This is the default cursor options, because the cursor is the fastest and most commonly used PHP data access patterns.
PDO :: CURSOR_SCROLL (integer) Create a scrollable cursors PDOStatement object. To control the row in the result set obtained via PDO :: FETCH_ORI_ * constants.
PDO :: ERR_NONE (string) Corresponds to SQLSTATE '00000', the SQL statement represents no error or warning be sent successfully. When using the PDO :: errorCode () or PDOStatement :: errorCode () to determine whether an error occurs, this constant is very convenient. Check the above method returns an error status code, it will be frequently used.
PDO :: PARAM_EVT_ALLOC (integer) Assigning events
PDO :: PARAM_EVT_FREE (integer) Deallocation event
PDO :: PARAM_EVT_EXEC_PRE (integer) A prepared statement before executing the trigger event.
PDO :: PARAM_EVT_EXEC_POST (integer) After executing a prepared statement trigger event.
PDO :: PARAM_EVT_FETCH_PRE (integer) Results from a centralized removed before the results of a trigger event.
PDO :: PARAM_EVT_FETCH_POST (integer) After removing a centralized results from a result of triggering events.
PDO :: PARAM_EVT_NORMALIZE (integer) Bound parameter registration allows the driver to trigger an event when the normalization of the variable name.

PHP PDO Reference Manual PHP PDO Reference Manual