CDbConnection

The Data Source Name, or DSN, contains the information required to connect to the database. @see http://www.php.net/manual/en/function.PDO-construct.php Note that if you're using GBK or BIG5 then it's highly recommended to update to PHP 5.3.6+ and to specify charset via DSN like 'mysql:dbname=mydatabase;host=127.0.0.1;charset=GBK;'.
* default (string) :
null
The username for establishing DB connection. Defaults to empty string.
default (string) :
''
The password for establishing DB connection. Defaults to empty string.
default (string) :
''
Number of seconds that table metadata can remain valid in cache. Use 0 or negative value to indicate not caching schema. If greater than 0 and the primary cache is enabled, the table metadata will be cached. @see schemaCachingExclude
default (integer) :
0
List of tables whose metadata should NOT be cached. Defaults to empty array. @see schemaCachingDuration
default (array) :
array()
The ID of the cache application component that is used to cache the table metadata. Defaults to 'cache' which refers to the primary cache application component. Set this property to false if you want to disable caching table metadata.
default (string) :
'cache'
Number of seconds that query results can remain valid in cache. Use 0 or negative value to indicate not caching query results (the default behavior). In order to enable query caching, this property must be a positive integer and {@link queryCacheID} must point to a valid cache component ID. The method {@link cache()} is provided as a convenient way of setting this property and {@link queryCachingDependency} on the fly. @see cache @see queryCachingDependency @see queryCacheID @since 1.1.7
default (integer) :
0
The dependency that will be used when saving query results into cache. @see queryCachingDuration @since 1.1.7
default (CCacheDependency) :
null
The number of SQL statements that need to be cached next. If this is 0, then even if query caching is enabled, no query will be cached. Note that each time after executing a SQL statement (whether executed on DB server or fetched from query cache), this property will be reduced by 1 until 0. @since 1.1.7
default (integer) :
0
The ID of the cache application component that is used for query caching. Defaults to 'cache' which refers to the primary cache application component. Set this property to false if you want to disable query caching. @since 1.1.7
default (string) :
'cache'
Whether the database connection should be automatically established the component is being initialized. Defaults to true. Note, this property is only effective when the CDbConnection object is used as an application component.
default (boolean) :
true
The charset used for database connection. The property is only used for MySQL and PostgreSQL databases. Defaults to null, meaning using default charset as specified by the database. Note that if you're using GBK or BIG5 then it's highly recommended to update to PHP 5.3.6+ and to specify charset via DSN like 'mysql:dbname=mydatabase;host=127.0.0.1;charset=GBK;'.
default (string) :
null
Whether to turn on prepare emulation. Defaults to false, meaning PDO will use the native prepare support if available. For some databases (such as MySQL), this may need to be set true so that PDO can emulate the prepare support to bypass the buggy native prepare support. Note, this property is only effective for PHP 5.1.3 or above. The default value is null, which will not change the ATTR_EMULATE_PREPARES value of PDO.
default (boolean) :
null
Whether to log the values that are bound to a prepare SQL statement. Defaults to false. During development, you may consider setting this property to true so that parameter values bound to SQL statements are logged for debugging purpose. You should be aware that logging parameter values could be expensive and have significant impact on the performance of your application.
default (boolean) :
false
Whether to enable profiling the SQL statements being executed. Defaults to false. This should be mainly enabled and used during development to find out the bottleneck of SQL executions.
default (boolean) :
false
The default prefix for table names. Defaults to null, meaning no table prefix. By setting this property, any token like '{{tableName}}' in {@link CDbCommand::text} will be replaced by 'prefixTableName', where 'prefix' refers to this property value. @since 1.1.0
default (string) :
null
List of SQL statements that should be executed right after the DB connection is established. @since 1.1.1
default (array) :
null
Mapping between PDO driver and schema class name. A schema class can be specified using path alias. @since 1.1.6
default (array) :
array
(
    'pgsql' => 'CPgsqlSchema',
    'mysqli' => 'CMysqlSchema',
    'mysql' => 'CMysqlSchema',
    'sqlite' => 'CSqliteSchema',
    'sqlite2' => 'CSqliteSchema',
    'mssql' => 'CMssqlSchema',
    'dblib' => 'CMssqlSchema',
    'sqlsrv' => 'CMssqlSchema',
    'oci' => 'COciSchema',
)
Custom PDO wrapper class. @since 1.1.8
default (string) :
'PDO'
The behaviors that should be attached to this component. The behaviors will be attached to the component when {@link init} is called. Please refer to {@link CModel::behaviors} on how to specify the value of this property.
default (array) :
array()
Open or close the DB connection. whether to open or close DB connection @throws CException if connection fails
default (boolean) :
null
Sets the case of the column names. the case of the column names @see http://www.php.net/manual/en/pdo.setattribute.php
default (mixed) :
null
Sets how the null and empty strings are converted. how the null and empty strings are converted @see http://www.php.net/manual/en/pdo.setattribute.php
default (mixed) :
null
Sets whether creating or updating a DB record will be automatically committed. Some DBMS (such as sqlite) may not support this feature. whether creating or updating a DB record will be automatically committed.
default (boolean) :
null
Sets whether the connection is persistent or not. Some DBMS (such as sqlite) may not support this feature. whether the connection is persistent or not
default (boolean) :
null
Sets a set of attributes on the database connection. attributes (name=>value) to be set. @see setAttribute @since 1.1.7
default (array) :
null