Array ( [0] => Array ( [type] => 367 (T_OPEN_TAG) [value] => Array ( [type] => 365 (T_COMMENT) [value] => // $Id: database.inc,v 1.53 2009/05/03 08:55:06 dries Exp $ [append] => 0 ) [2] => Array ( [type] => 370 (T_WHITESPACE) [value] => 1 ) [3] => Array ( [type] => 366 (T_DOC_COMMENT) [value] => /** * @file * Base classes for the database layer. */ ) [4] => Array ( [type] => 370 (T_WHITESPACE) [value] => 1 ) [5] => Array ( [comment] => Array ( [type] => 366 (T_DOC_COMMENT) [value] => /** * Base Database API class. * * This class provides a Drupal-specific extension of the PDO database abstraction class in PHP. * Every database driver implementation must provide a concrete implementation of it to support * special handling required by that database. * * @link http://php.net/manual/en/book.pdo.php */ ) [modifiers] => Array ( [0] => abstract ) [type] => 352 (T_CLASS) [name] => DatabaseConnection [extends_1] => PDO [body] => Array ( [0] => Array ( [type] => 370 (T_WHITESPACE) [value] => 1 ) [1] => Array ( [type] => assignment [comment] => Array ( [type] => 366 (T_DOC_COMMENT) [value] => /** * Reference to the last statement that was executed. * * We only need this for the legacy db_affected_rows() call, which will be removed. * * @var DatabaseStatementInterface * @todo Remove this variable. */ ) [modifiers] => Array ( [0] => public ) [values] => Array ( [0] => Array ( [operand_1] => Array ( [reference] => 0 [type] => 309 (T_VARIABLE) [value] => $lastStatement ) ) ) ) [2] => Array ( [type] => 370 (T_WHITESPACE) [value] => 1 ) [3] => Array ( [type] => assignment [comment] => Array ( [type] => 366 (T_DOC_COMMENT) [value] => /** * The database target this connection is for. * * We need this information for later auditing and logging. * * @var string */ ) [modifiers] => Array ( [0] => protected ) [values] => Array ( [0] => Array ( [operand_1] => Array ( [reference] => 0 [type] => 309 (T_VARIABLE) [value] => $target ) [assign_1] => = [operand_2] => Array ( [type] => 307 (T_STRING) [value] => NULL ) ) ) ) [4] => Array ( [type] => 370 (T_WHITESPACE) [value] => 1 ) [5] => Array ( [type] => assignment [comment] => Array ( [type] => 366 (T_DOC_COMMENT) [value] => /** * The schema object for this connection. * * @var object */ ) [modifiers] => Array ( [0] => protected ) [values] => Array ( [0] => Array ( [operand_1] => Array ( [reference] => 0 [type] => 309 (T_VARIABLE) [value] => $schema ) [assign_1] => = [operand_2] => Array ( [type] => 307 (T_STRING) [value] => NULL ) ) ) ) [6] => Array ( [type] => 370 (T_WHITESPACE) [value] => 1 ) [7] => Array ( [comment] => Array ( ) [modifiers] => Array ( ) [type] => 333 (T_FUNCTION) [name] => __construct [parameters] => Array ( [0] => Array ( [operand_1] => Array ( [reference] => 0 [type] => 309 (T_VARIABLE) [value] => $dsn ) ) [1] => Array ( [operand_1] => Array ( [reference] => 0 [type] => 309 (T_VARIABLE) [value] => $username ) ) [2] => Array ( [operand_1] => Array ( [reference] => 0 [type] => 309 (T_VARIABLE) [value] => $password ) ) [3] => Array ( [operand_1] => Array ( [reference] => 0 [type] => 309 (T_VARIABLE) [value] => $driver_options ) [assign_1] => = [operand_2] => Array ( [type] => 359 (T_ARRAY) [multiline] => [value] => Array ( [lparens_1] => ( ) ) ) ) [text] => function __construct($dsn, $username, $password, $driver_options = array()) { // Because the other methods don't seem to work right. $driver_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION; // Call PDO::__construct and PDO::setAttribute. parent::__construct($dsn, $username, $password, $driver_options); // Set a specific PDOStatement class if the driver requires that. if (!empty($this->statementClass)) { $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array($this->statementClass, array($this))); } } [body] => Array ( ) ) [8] => Array ( [type] => 370 (T_WHITESPACE) [value] => 1 ) [9] => Array ( [comment] => Array ( [type] => 366 (T_DOC_COMMENT) [value] => /** * Return the default query options for any given query. * * A given query can be customized with a number of option flags in an * associative array. * * target - The database "target" against which to execute a query. Valid * values are "default" or "slave". The system will first try to open a * connection to a database specified with the user-supplied key. If one * is not available, it will silently fall back to the "default" target. * If multiple databases connections are specified with the same target, * one will be selected at random for the duration of the request. * * fetch - This element controls how rows from a result set will be returned. * legal values include PDO::FETCH_ASSOC, PDO::FETCH_BOTH, PDO::FETCH_OBJ, * PDO::FETCH_NUM, or a string representing the name of a class. If a string * is specified, each record will be fetched into a new object of that class. * The behavior of all other values is defined by PDO. See * http://www.php.net/PDOStatement-fetch * * return - Depending on the type of query, different return values may be * meaningful. This directive instructs the system which type of return * value is desired. The system will generally set the correct value * automatically, so it is extremely rare that a module developer will ever * need to specify this value. Setting it incorrectly will likely lead to * unpredictable results or fatal errors. Legal values include: * * Database::RETURN_STATEMENT - Return the prepared statement object for the * query. This is usually only meaningful for SELECT queries, where the * statement object is how one accesses the result set returned by the query. * * Database::RETURN_AFFECTED - Return the number of rows affected by an * UPDATE or DELETE query. Be aware that means the number of rows * actually changed, not the number of rows matched by the WHERE clause. * * Database::RETURN_INSERT_ID - Return the sequence ID (primary key) * created by an INSERT statement on a table that contains a serial column. * * Database::RETURN_NULL - Do not return anything, as there is no * meaningful value to return. That is the case for INSERT queries on * tables that do not contain a serial column. * * throw_exception - By default, the database system will catch any errors * on a query as an Exception, log it, and then rethrow it so that code * further up the call chain can take an appropriate action. To suppress * that behavior and simply return NULL on failure, set this option to FALSE. * * @return * An array of default query options. */ ) [modifiers] => Array ( [0] => protected ) [type] => 333 (T_FUNCTION) [name] => defaultOptions [parameters] => Array ( [0] => Array ( ) ) [text] => protected function defaultOptions() { return array( 'target' => 'default', 'fetch' => PDO::FETCH_OBJ, 'return' => Database::RETURN_STATEMENT, 'throw_exception' => TRUE, ); } [body] => Array ( ) ) [10] => Array ( [type] => 370 (T_WHITESPACE) [value] => 1 ) [11] => Array ( [comment] => Array ( [type] => 366 (T_DOC_COMMENT) [value] => /** * Append a database prefix to all tables in a query. * * Queries sent to Drupal should wrap all table names in curly brackets. This * function searches for this syntax and adds Drupal's table prefix to all * tables, allowing Drupal to coexist with other systems in the same database * and/or schema if necessary. * * @param $sql * A string containing a partial or entire SQL query. * @return * The properly-prefixed string. */ ) [modifiers] => Array ( [0] => public ) [type] => 333 (T_FUNCTION) [name] => prefixTables [parameters] => Array ( [0] => Array ( [operand_1] => Array ( [reference] => 0 [type] => 309 (T_VARIABLE) [value] => $sql ) ) ) [text] => public function prefixTables($sql) { global $db_prefix; if (is_array($db_prefix)) { if (array_key_exists('default', $db_prefix)) { $tmp = $db_prefix; unset($tmp['default']); foreach ($tmp as $key => $val) { $sql = strtr($sql, array('{' . $key . '}' => $val . $key)); } return strtr($sql, array('{' => $db_prefix['default'], '}' => '')); } else { foreach ($db_prefix as $key => $val) { $sql = strtr($sql, array('{' . $key . '}' => $val . $key)); } return strtr($sql, array('{' => '', '}' => '')); } } else { return strtr($sql, array('{' => $db_prefix, '}' => '')); } } [body] => Array ( ) ) ) ) )