|
PDO::getAttributeRetrieve a database connection attribute Description
public mixed PDO::getAttribute(int
$attribute)This function returns the value of a database connection attribute. To retrieve PDOStatement attributes, refer to PDOStatement::getAttribute. Only the generic attributes listed below can be retrieved with every driver. Whether any other attribute can be retrieved depends on the driver. Parameters
Return Values
Returns the value of the requested attribute, or
The value of some attributes, such as
Errors/Exceptions
PDO::getAttribute may throw a PDOException
when the underlying driver does not support the requested Changelog
Examples
Example #1 Retrieving database connection attributes The above example will output something similar to: PDO::ATTR_DRIVER_NAME: 'sqlite' PDO::ATTR_ERRMODE: 2 PDO::ATTR_CASE: 0 PDO::ATTR_ORACLE_NULLS: 0 PDO::ATTR_PERSISTENT: false PDO::ATTR_CLIENT_VERSION: '3.46.1' PDO::ATTR_SERVER_VERSION: '3.46.1' PDO::ATTR_AUTOCOMMIT: SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute PDO::ATTR_TIMEOUT: SQLSTATE[IM001]: Driver does not support this function: driver does not support that attribute See Also
|