Latest web development tutorials

PDO :: setAttribute

PHP PDO Reference Manual PHP PDO Reference Manual

PDO :: setAttribute - set attributes (PHP 5> = 5.1.0, PECL pdo> = 0.1.0)


Explanation

grammar

bool PDO::setAttribute ( int $attribute , mixed $value )

Setting database handle attribute. Listed below are some of the available common attributes; Some drivers may use other specific attributes.

  • PDO :: ATTR_CASE: Forced column called designated sensitive.

    • PDO :: CASE_LOWER: Forced lowercase column names.

    • PDO :: CASE_NATURAL: Leave database-driven return column names.

    • PDO :: CASE_UPPER: mandatory column names in uppercase.

  • PDO :: ATTR_ERRMODE: Error Reporting.

    • PDO :: ERRMODE_SILENT: setting only error codes.

    • PDO :: ERRMODE_WARNING: raised E_WARNING error

    • PDO :: ERRMODE_EXCEPTION: throw exceptions exception.

  • PDO :: ATTR_ORACLE_NULLS (available in all drivers, not only limited to Oracle): Conversion NULL and the empty string.

    • PDO :: NULL_NATURAL: Does not convert.

    • PDO :: NULL_EMPTY_STRING: to convert the empty string to NULL .

    • PDO :: NULL_TO_STRING: convert the empty string to NULL.

  • PDO :: ATTR_STRINGIFY_FETCHES: extract the value when converted to a string. Need bool.

  • PDO :: ATTR_STATEMENT_CLASS: set the statement class derived from PDOStatement users. Not be used for long-lasting PDO instance. Required array (string classname, array (mixed parameter constructor)).

  • PDO :: ATTR_TIMEOUT: Specifies the timeout in seconds. Not all drivers support this option, which means that there may be differences between the driving and driven. For example, SQLite waiting time to reach this value after the write abstain from acquiring locks, but other drivers may interpret this value as a connection or read timeout interval. You need to type int.

  • PDO :: ATTR_AUTOCOMMIT (OCI, Firebird and MySQL are available): whether to automatically submit each individual statement.

  • PDO :: ATTR_EMULATE_PREPARES enable or disable the emulated prepared statement. Some drivers do not support or limited support for local pretreatment. Use this setting to force the PDO is always emulated prepared statement (if TRUE ), or try to use locally prepared statement (if FALSE ). If the driver can not be successful pretreatment current query, it will always return to the analog prepared statement. Need bool type.

  • PDO :: MYSQL_ATTR_USE_BUFFERED_QUERY (MySQL are available): Use buffered queries.

  • PDO :: ATTR_DEFAULT_FETCH_MODE: Set the default extraction mode. About pattern specification can () document found in PDOStatement :: fetch.


return value

Successful return TRUE, or on failure returns FALSE.