diff options
author | Dries Buytaert <dries@buytaert.net> | 2008-08-21 19:36:39 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2008-08-21 19:36:39 +0000 |
commit | 69e6f411a9ed5dcf3f71d4320218620d3444d295 (patch) | |
tree | f4d393bbda7d814c825878785221b65c73b225f8 /sites/default | |
parent | 0e79597812ad0b6b72cf65bfc928c4a591d80ff1 (diff) | |
download | brdo-69e6f411a9ed5dcf3f71d4320218620d3444d295.tar.gz brdo-69e6f411a9ed5dcf3f71d4320218620d3444d295.tar.bz2 |
- Patch #225450 by Crell, chx, bjaspan, catch, swentel, recidive et al: next generation database layer for Drupal 7.
Diffstat (limited to 'sites/default')
-rw-r--r-- | sites/default/default.settings.php | 109 |
1 files changed, 90 insertions, 19 deletions
diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php index 33543fbb7..7659fd3b2 100644 --- a/sites/default/default.settings.php +++ b/sites/default/default.settings.php @@ -46,20 +46,76 @@ /** * Database settings: * - * Note that the $db_url variable gets parsed using PHP's built-in - * URL parser (i.e. using the "parse_url()" function) so make sure - * not to confuse the parser. If your username, password - * or database name contain characters used to delineate - * $db_url parts, you can escape them via URI hex encodings: - * - * : = %3a / = %2f @ = %40 - * + = %2b ( = %28 ) = %29 - * ? = %3f = = %3d & = %26 - * - * To specify multiple connections to be used in your site (i.e. for - * complex custom modules) you can also specify an associative array - * of $db_url variables with the 'default' element used until otherwise - * requested. + * The $databases array specifies the database connection or + * connections that Drupal may use. Drupal is able to connect + * to multiple databases, including multiple types of databases, + * during the same request. + * + * Each database connection is specified as an array of settings, + * similar to the following: + * + * array( + * 'driver' => 'mysql', + * 'database' => 'databasename', + * 'username' => 'username', + * 'password' => 'password', + * 'host' => 'localhost', + * ); + * + * The "driver" property indicates what Drupal database driver the + * connection should use. This is usually the same as the name of the + * database type, such as mysql or sqlite, but not always. The other + * properties will vary depending on the driver. For SQLite, you must + * specify a database. For most other drivers, you must specify a username, + * password, host, and database name. + * + * Some database engines support transactions. In order to enable + * transaction support for a given database, set the 'transaction' key + * to TRUE. To disable it, set it to FALSE. Note that the default value + * varies by driver. For MySQL, the default is FALSE since MyISAM tables + * do not support transactions. + * + * For each database, you may optionally specify multiple "target" databases. + * A target database allows Drupal to try to send certain queries to a + * different database if it can but fall back to the default connection if not. + * That is useful for master/slave replication, as Drupal may try to connect + * to a slave server when appropriate and if one is not available will simply + * fall back to the single master server. + * + * The general format for the $databases array is as follows: + * + * $databases['default']['default'] = $info_array; + * $databases['default']['slave'][] = $info_array; + * $databases['default']['slave'][] = $info_array; + * $databases['extra'] = $info_array; + * + * In the above example, $info_array is an array of settings described above. + * The first line sets a "default" database that has one master database + * (the second level default). The second and third lines create an array + * of potential slave databases. Drupal will select one at random for a given + * request as needed. The fourth line creates a new database with a name of + * "extra". Since no target is specified, it is assumed to be "default", that + * is, only one server. + * + * For a single database configuration, the following is sufficient: + * + * $databases = array( + * 'driver' => 'mysql', + * 'database' => 'databasename', + * 'username' => 'username', + * 'password' => 'password', + * 'host' => 'localhost', + * ); + * + * That is equivalent to: + * + * $databases['default']['default'] = array( + * 'driver' => 'mysql', + * 'database' => 'databasename', + * 'username' => 'username', + * 'password' => 'password', + * 'host' => 'localhost', + * ); * * You can optionally set prefixes for some or all database table names * by using the $db_prefix setting. If a prefix is specified, the table @@ -84,12 +140,27 @@ * 'authmap' => 'shared_', * ); * - * Database URL format: - * $db_url = 'mysql://username:password@localhost/databasename'; - * $db_url = 'mysqli://username:password@localhost/databasename'; - * $db_url = 'pgsql://username:password@localhost/databasename'; + * Database configuration format: + * $databases = array( + * 'driver' => 'mysql', + * 'database' => 'databasename', + * 'username' => 'username', + * 'password' => 'password', + * 'host' => 'localhost', + * ); + * $databases = array( + * 'driver' => 'pgsql', + * 'database' => 'databasename', + * 'username' => 'username', + * 'password' => 'password', + * 'host' => 'localhost', + * ); + * $databases = array( + * 'driver' => 'sqlite', + * 'database' => 'databasefilename', + * ); */ -$db_url = ''; +$databases = array(); $db_prefix = ''; /** |