changed database config.

This commit is contained in:
Taylor Otwell 2011-09-17 22:18:06 -05:00
parent 32391b7f32
commit 5387312e0d
1 changed files with 39 additions and 48 deletions

View File

@ -10,9 +10,7 @@
| The name of your default database connection. | The name of your default database connection.
| |
| This connection will be the default for all database operations unless a | This connection will be the default for all database operations unless a
| different connection is specified when performing the operation. The name | different connection is specified when performing the operation.
| of the default connection should correspond to the name of a connector
| defined below.
| |
*/ */
@ -20,63 +18,56 @@
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Database Connectors | Database Connections
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| All of the database connectors used by your application. | All of the database connections used by your application.
| |
| Each connector should return a PDO connection. You may connect to any | Supported Drivers: 'mysql', 'pgsql', 'sqlite'.
| database system you wish. Of course, default configurations for the
| systems supported by Laravel are provided for you.
| |
| The entire database configuration array is passed to the connector | Note: When using the SQLite driver, the path and "sqlite" extention will
| closure, so you may convenient use it when connecting to your database. | be added automatically. You only need to specify the database name.
| |
| Note: When using an unsupported database, Eloquent and the fluent query | Using a driver that isn't supported? You can still establish a PDO
| builder may not work as expected. Currently, MySQL, Postgres, and | connection. Simply specify a driver and DSN option:
| SQLite are fully supported by Laravel. |
| 'odbc' => array(
| 'driver' => 'odbc',
| 'dsn' => 'your-dsn',
| 'username' => 'username',
| 'password' => 'password',
| )
|
| Note: When using an unsupported driver, Eloquent and the fluent query
| builder may not work as expected.
| |
*/ */
'connectors' => array( 'connections' => array(
'sqlite' => function($config)
{
return new PDO('sqlite:'.DATABASE_PATH.'application.sqlite', null, null, $config['options']);
},
'mysql' => function($config)
{
return new PDO('mysql:host=localhost;dbname=database', 'root', 'password', $config['options']);
},
'pgsql' => function($config)
{
return new PDO('pgsql:host=localhost;dbname=database', 'root', 'password', $config['options']);
},
'sqlite' => array(
'driver' => 'sqlite',
'database' => 'application',
), ),
/* 'mysql' => array(
|-------------------------------------------------------------------------- 'driver' => 'mysql',
| Database PDO Options 'host' => 'localhost',
|-------------------------------------------------------------------------- 'database' => 'database',
| 'username' => 'root',
| Here you may specify the PDO options that should be used when connecting 'password' => 'password',
| to a database. The entire database configuration array is passed to the 'charset' => 'utf8',
| database connector closures, so may convenient access these options from ),
| your connectors.
| 'pgsql' => array(
| For a list of options, visit: http://php.net/manual/en/pdo.setattribute.php 'driver' => 'pgsql',
| 'host' => 'localhost',
*/ 'database' => 'database',
'username' => 'root',
'password' => 'password',
'charset' => 'utf8',
),
'options' => array(
PDO::ATTR_CASE => PDO::CASE_LOWER,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL,
PDO::ATTR_STRINGIFY_FETCHES => false,
PDO::ATTR_EMULATE_PREPARES => false,
), ),
); );