Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • CDbCommand
  • CDbConnection
  • CDbDataReader
  • CDbMigration
  • CDbTransaction

Exceptions

  • CDbException
  • Overview
  • Package
  • Class
  • Tree

Class CDbConnection

CDbConnection represents a connection to a database.

CDbConnection works together with CDbCommand, CDbDataReader and CDbTransaction to provide data access to various DBMS in a common set of APIs. They are a thin wrapper of the PDO PHP extension.

To establish a connection, set setActive active to true after specifying CDbConnection::$connectionString, CDbConnection::$username and CDbConnection::$password.

The following example shows how to create a CDbConnection instance and establish the actual connection:

$connection=new CDbConnection($dsn,$username,$password);
$connection->active=true;

After the DB connection is established, one can execute an SQL statement like the following:

$command=$connection->createCommand($sqlStatement);
$command->execute();   // a non-query SQL statement execution
// or execute an SQL query and fetch the result set
$reader=$command->query();

// each $row is an array representing a row of data
foreach($reader as $row) ...

One can do prepared SQL execution and bind parameters to the prepared SQL:

$command=$connection->createCommand($sqlStatement);
$command->bindParam($name1,$value1);
$command->bindParam($name2,$value2);
$command->execute();

To use transaction, do like the following:

$transaction=$connection->beginTransaction();
try
{
   $connection->createCommand($sql1)->execute();
   $connection->createCommand($sql2)->execute();
   //.... other SQL executions
   $transaction->commit();
}
catch(Exception $e)
{
   $transaction->rollback();
}

CDbConnection also provides a set of methods to support setting and querying of certain DBMS attributes, such as getNullConversion nullConversion.

Since CDbConnection implements the interface IApplicationComponent, it can be used as an application component and be configured in application configuration, like the following,

array(
    'components'=>array(
        'db'=>array(
            'class'=>'CDbConnection',
            'connectionString'=>'sqlite:path/to/dbfile',
        ),
    ),
)

Use the driverName property if you want to force the DB connection to use a particular driver by the given name, disregarding of what was set in the CDbConnection::$connectionString property. This might be useful when working with ODBC connections. Sample code:

'db'=>array(
    'class'=>'CDbConnection',
    'driverName'=>'mysql',
    'connectionString'=>'odbc:Driver={MySQL};Server=127.0.0.1;Database=test',
    'username'=>'',
    'password'=>'',
),
CComponent
Extended by CApplicationComponent implements IApplicationComponent
Extended by CDbConnection
Package: system\db
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/db/CDbConnection.php
Methods summary
public
# __construct( string $dsn = '', string $username = '', string $password = '' )

Constructor. Note, the DB connection is not established when this connection instance is created. Set setActive active property to true to establish the connection.

Constructor. Note, the DB connection is not established when this connection instance is created. Set setActive active property to true to establish the connection.

Parameters

$dsn
string
$dsn The Data Source Name, or DSN, contains the information required to connect to the database.
$username
string
$username The user name for the DSN string.
$password
string
$password The password for the DSN string.

See

http://www.php.net/manual/en/function.PDO-construct.php
public array
# __sleep( )

Close the connection when serializing.

Close the connection when serializing.

Returns

array
public static array
# getAvailableDrivers( )

Returns a list of available PDO drivers.

Returns a list of available PDO drivers.

Returns

array
list of available PDO drivers

See

http://www.php.net/manual/en/function.PDO-getAvailableDrivers.php
public
# init( )

Initializes the component. This method is required by IApplicationComponent and is invoked by application when the CDbConnection is used as an application component. If you override this method, make sure to call the parent implementation so that the component can be marked as initialized.

Initializes the component. This method is required by IApplicationComponent and is invoked by application when the CDbConnection is used as an application component. If you override this method, make sure to call the parent implementation so that the component can be marked as initialized.

Overrides

CApplicationComponent::init()
public boolean
# getActive( )

Returns whether the DB connection is established.

Returns whether the DB connection is established.

Returns

boolean
whether the DB connection is established
public
# setActive( boolean $value )

Open or close the DB connection.

Open or close the DB connection.

Parameters

$value
boolean
$value whether to open or close DB connection

Throws

CException
if connection fails
public static
# cache( integer $duration, CCacheDependency|ICacheDependency $dependency = null, integer $queryCount = 1 )

Sets the parameters about query caching. This method can be used to enable or disable query caching. By setting the $duration parameter to be 0, the query caching will be disabled. Otherwise, query results of the new SQL statements executed next will be saved in cache and remain valid for the specified duration. If the same query is executed again, the result may be fetched from cache directly without actually executing the SQL statement.

Sets the parameters about query caching. This method can be used to enable or disable query caching. By setting the $duration parameter to be 0, the query caching will be disabled. Otherwise, query results of the new SQL statements executed next will be saved in cache and remain valid for the specified duration. If the same query is executed again, the result may be fetched from cache directly without actually executing the SQL statement.

Parameters

$duration
integer
$duration the number of seconds that query results may remain valid in cache. If this is 0, the caching will be disabled.
$dependency
CCacheDependency|ICacheDependency
$dependency the dependency that will be used when saving the query results into cache.
$queryCount
integer
$queryCount number of SQL queries that need to be cached after calling this method. Defaults to 1, meaning that the next SQL query will be cached.

Returns

static
the connection instance itself.

Since

1.1.7
protected
# open( )

Opens DB connection if it is currently not

Opens DB connection if it is currently not

Throws

CException
if connection fails
protected
# close( )

Closes the currently active DB connection. It does nothing if the connection is already closed.

Closes the currently active DB connection. It does nothing if the connection is already closed.

protected PDO
# createPdoInstance( )

Creates the PDO instance. When some functionalities are missing in the pdo driver, we may use an adapter class to provide them.

Creates the PDO instance. When some functionalities are missing in the pdo driver, we may use an adapter class to provide them.

Returns

PDO
the pdo instance

Throws

CDbException
when failed to open DB connection
protected
# initConnection( PDO $pdo )

Initializes the open db connection. This method is invoked right after the db connection is established. The default implementation is to set the charset for MySQL, MariaDB and PostgreSQL database connections.

Initializes the open db connection. This method is invoked right after the db connection is established. The default implementation is to set the charset for MySQL, MariaDB and PostgreSQL database connections.

Parameters

$pdo
PDO
$pdo the PDO instance
public PDO
# getPdoInstance( )

Returns the PDO instance.

Returns the PDO instance.

Returns

PDO
the PDO instance, null if the connection is not established yet
public CDbCommand
# createCommand( mixed $query = null )

Creates a command for execution.

Creates a command for execution.

Parameters

$query
mixed
$query the DB query to be executed. This can be either a string representing a SQL statement, or an array representing different fragments of a SQL statement. Please refer to CDbCommand::__construct() for more details about how to pass an array as the query. If this parameter is not given, you will have to call query builder methods of CDbCommand to build the DB query.

Returns

CDbCommand
the DB command
public CDbTransaction
# getCurrentTransaction( )

Returns the currently active transaction.

Returns the currently active transaction.

Returns

CDbTransaction
the currently active transaction. Null if no active transaction.
public CDbTransaction
# beginTransaction( )

Starts a transaction.

Starts a transaction.

Returns

CDbTransaction
the transaction initiated
public CDbSchema
# getSchema( )

Returns the database schema for the current connection

Returns the database schema for the current connection

Returns

CDbSchema
the database schema for the current connection

Throws

CDbException
if CDbConnection does not support reading schema for specified database driver
public CDbCommandBuilder
# getCommandBuilder( )

Returns the SQL command builder for the current DB connection.

Returns the SQL command builder for the current DB connection.

Returns

CDbCommandBuilder
the command builder
public string
# getLastInsertID( string $sequenceName = '' )

Returns the ID of the last inserted row or sequence value.

Returns the ID of the last inserted row or sequence value.

Parameters

$sequenceName
string
$sequenceName name of the sequence object (required by some DBMS)

Returns

string
the row ID of the last row inserted, or the last value retrieved from the sequence object

See

http://www.php.net/manual/en/function.PDO-lastInsertId.php
public string
# quoteValue( string $str )

Quotes a string value for use in a query.

Quotes a string value for use in a query.

Parameters

$str
string
$str string to be quoted

Returns

string
the properly quoted string

See

http://www.php.net/manual/en/function.PDO-quote.php
public string
# quoteTableName( string $name )

Quotes a table name for use in a query. If the table name contains schema prefix, the prefix will also be properly quoted.

Quotes a table name for use in a query. If the table name contains schema prefix, the prefix will also be properly quoted.

Parameters

$name
string
$name table name

Returns

string
the properly quoted table name
public string
# quoteColumnName( string $name )

Quotes a column name for use in a query. If the column name contains prefix, the prefix will also be properly quoted.

Quotes a column name for use in a query. If the column name contains prefix, the prefix will also be properly quoted.

Parameters

$name
string
$name column name

Returns

string
the properly quoted column name
public integer
# getPdoType( string $type )

Determines the PDO type for the specified PHP type.

Determines the PDO type for the specified PHP type.

Parameters

$type
string
$type The PHP type (obtained by gettype() call).

Returns

integer
the corresponding PDO type
public mixed
# getColumnCase( )

Returns the case of the column names

Returns the case of the column names

Returns

mixed
the case of the column names

See

http://www.php.net/manual/en/pdo.setattribute.php
public
# setColumnCase( mixed $value )

Sets the case of the column names.

Sets the case of the column names.

Parameters

$value
mixed
$value the case of the column names

See

http://www.php.net/manual/en/pdo.setattribute.php
public mixed
# getNullConversion( )

Returns how the null and empty strings are converted.

Returns how the null and empty strings are converted.

Returns

mixed
how the null and empty strings are converted

See

http://www.php.net/manual/en/pdo.setattribute.php
public
# setNullConversion( mixed $value )

Sets how the null and empty strings are converted.

Sets how the null and empty strings are converted.

Parameters

$value
mixed
$value how the null and empty strings are converted

See

http://www.php.net/manual/en/pdo.setattribute.php
public boolean
# getAutoCommit( )

Returns whether creating or updating a DB record will be automatically committed. Some DBMS (such as sqlite) may not support this feature.

Returns whether creating or updating a DB record will be automatically committed. Some DBMS (such as sqlite) may not support this feature.

Returns

boolean
whether creating or updating a DB record will be automatically committed.
public
# setAutoCommit( boolean $value )

Sets whether creating or updating a DB record will be automatically committed. Some DBMS (such as sqlite) may not support this feature.

Sets whether creating or updating a DB record will be automatically committed. Some DBMS (such as sqlite) may not support this feature.

Parameters

$value
boolean
$value whether creating or updating a DB record will be automatically committed.
public boolean
# getPersistent( )

Returns whether the connection is persistent or not. Some DBMS (such as sqlite) may not support this feature.

Returns whether the connection is persistent or not. Some DBMS (such as sqlite) may not support this feature.

Returns

boolean
whether the connection is persistent or not
public
# setPersistent( boolean $value )

Sets whether the connection is persistent or not. Some DBMS (such as sqlite) may not support this feature.

Sets whether the connection is persistent or not. Some DBMS (such as sqlite) may not support this feature.

Parameters

$value
boolean
$value whether the connection is persistent or not
public string
# getDriverName( )

Returns the name of the DB driver.

Returns the name of the DB driver.

Returns

string
name of the DB driver.
public
# setDriverName( string $driverName )

Changes the name of the DB driver. Overrides value extracted from the CDbConnection::$connectionString, which is behavior by default.

Changes the name of the DB driver. Overrides value extracted from the CDbConnection::$connectionString, which is behavior by default.

Parameters

$driverName
string
$driverName to be set. Valid values are the keys from the CDbConnection::$driverMap property.

Since

1.1.16

See

CDbConnection::getDriverName()
driverName
public string
# getClientVersion( )

Returns the version information of the DB driver.

Returns the version information of the DB driver.

Returns

string
the version information of the DB driver
public string
# getConnectionStatus( )

Returns the status of the connection. Some DBMS (such as sqlite) may not support this feature.

Returns the status of the connection. Some DBMS (such as sqlite) may not support this feature.

Returns

string
the status of the connection
public boolean
# getPrefetch( )

Returns whether the connection performs data prefetching.

Returns whether the connection performs data prefetching.

Returns

boolean
whether the connection performs data prefetching
public string
# getServerInfo( )

Returns the information of DBMS server.

Returns the information of DBMS server.

Returns

string
the information of DBMS server
public string
# getServerVersion( )

Returns the version information of DBMS server.

Returns the version information of DBMS server.

Returns

string
the version information of DBMS server
public integer
# getTimeout( )

Returns the timeout settings for the connection.

Returns the timeout settings for the connection.

Returns

integer
timeout settings for the connection
public mixed
# getAttribute( integer $name )

Obtains a specific DB connection attribute information.

Obtains a specific DB connection attribute information.

Parameters

$name
integer
$name the attribute to be queried

Returns

mixed
the corresponding attribute information

See

http://www.php.net/manual/en/function.PDO-getAttribute.php
public
# setAttribute( integer $name, mixed $value )

Sets an attribute on the database connection.

Sets an attribute on the database connection.

Parameters

$name
integer
$name the attribute to be set
$value
mixed
$value the attribute value

See

http://www.php.net/manual/en/function.PDO-setAttribute.php
public array
# getAttributes( )

Returns the attributes that are previously explicitly set for the DB connection.

Returns the attributes that are previously explicitly set for the DB connection.

Returns

array
attributes (name=>value) that are previously explicitly set for the DB connection.

Since

1.1.7

See

CDbConnection::setAttributes()
public
# setAttributes( array $values )

Sets a set of attributes on the database connection.

Sets a set of attributes on the database connection.

Parameters

$values
array
$values attributes (name=>value) to be set.

Since

1.1.7

See

CDbConnection::setAttribute()
public array
# getStats( )

Returns the statistical results of SQL executions. The results returned include the number of SQL statements executed and the total time spent. In order to use this method, CDbConnection::$enableProfiling has to be set true.

Returns the statistical results of SQL executions. The results returned include the number of SQL statements executed and the total time spent. In order to use this method, CDbConnection::$enableProfiling has to be set true.

Returns

array
the first element indicates the number of SQL statements executed, and the second element the total time spent in SQL execution.
Methods inherited from CApplicationComponent
getIsInitialized()
Methods inherited from CComponent
__call(), __get(), __isset(), __set(), __unset(), asa(), attachBehavior(), attachBehaviors(), attachEventHandler(), canGetProperty(), canSetProperty(), detachBehavior(), detachBehaviors(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), getEventHandlers(), hasEvent(), hasEventHandler(), hasProperty(), raiseEvent()
Properties summary
public string $connectionString
#

The Data Source Name, or DSN, contains the information required to connect to the database.

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;'.
public string $username ''
#

the username for establishing DB connection. Defaults to empty string.

the username for establishing DB connection. Defaults to empty string.

public string $password ''
#

the password for establishing DB connection. Defaults to empty string.

the password for establishing DB connection. Defaults to empty string.

public integer $schemaCachingDuration 0
#

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.

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

CDbConnection::$schemaCachingExclude
public array $schemaCachingExclude array()
#

list of tables whose metadata should NOT be cached. Defaults to empty array.

list of tables whose metadata should NOT be cached. Defaults to empty array.

See

CDbConnection::$schemaCachingDuration
public string $schemaCacheID 'cache'
#

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.

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.

public integer $queryCachingDuration 0
#

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 CDbConnection::$queryCacheID must point to a valid cache component ID.

The method CDbConnection::cache() is provided as a convenient way of setting this property and CDbConnection::$queryCachingDependency on the fly.

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 CDbConnection::$queryCacheID must point to a valid cache component ID.

The method CDbConnection::cache() is provided as a convenient way of setting this property and CDbConnection::$queryCachingDependency on the fly.

Since

1.1.7

See

CDbConnection::cache()
CDbConnection::$queryCachingDependency
CDbConnection::$queryCacheID
public CCacheDependency|ICacheDependency $queryCachingDependency
#

the dependency that will be used when saving query results into cache.

the dependency that will be used when saving query results into cache.

Since

1.1.7

See

CDbConnection::$queryCachingDuration
public integer $queryCachingCount 0
#

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.

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
public string $queryCacheID 'cache'
#

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.

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
public boolean $autoConnect true
#

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.

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.

public string $charset
#

the charset used for database connection. The property is only used for MySQL, MariaDB 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;'.

the charset used for database connection. The property is only used for MySQL, MariaDB 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;'.

public boolean $emulatePrepare
#

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.

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.

public boolean $enableParamLogging false
#

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.

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.

public boolean $enableProfiling 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.

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.

public string $tablePrefix
#

the default prefix for table names. Defaults to null, meaning no table prefix. By setting this property, any token like '{{tableName}}' in CDbCommand::text will be replaced by 'prefixTableName', where 'prefix' refers to this property value.

the default prefix for table names. Defaults to null, meaning no table prefix. By setting this property, any token like '{{tableName}}' in CDbCommand::text will be replaced by 'prefixTableName', where 'prefix' refers to this property value.

Since

1.1.0
public array $initSQLs
#

list of SQL statements that should be executed right after the DB connection is established.

list of SQL statements that should be executed right after the DB connection is established.

Since

1.1.1
public array $driverMap array( 'cubrid'=>'CCubridSchema', // CUBRID 'pgsql'=>'CPgsqlSchema', // PostgreSQL 'mysqli'=>'CMysqlSchema', // MySQL 'mysql'=>'CMysqlSchema', // MySQL,MariaDB 'sqlite'=>'CSqliteSchema', // sqlite 3 'sqlite2'=>'CSqliteSchema', // sqlite 2 'mssql'=>'CMssqlSchema', // Mssql driver on windows hosts 'dblib'=>'CMssqlSchema', // dblib drivers on linux (and maybe others os) hosts 'sqlsrv'=>'CMssqlSchema', // Mssql 'oci'=>'COciSchema', // Oracle driver )
#

mapping between PDO driver and schema class name. A schema class can be specified using path alias.

mapping between PDO driver and schema class name. A schema class can be specified using path alias.

Since

1.1.6
public string $pdoClass 'PDO'
#

Custom PDO wrapper class.

Custom PDO wrapper class.

Since

1.1.8
Properties inherited from CApplicationComponent
$behaviors
Magic properties summary
public boolean $active
#

Whether the DB connection is established.

Whether the DB connection is established.

public PDO $pdoInstance
#

The PDO instance, null if the connection is not established yet.

The PDO instance, null if the connection is not established yet.

public CDbTransaction $currentTransaction
#

The currently active transaction. Null if no active transaction.

The currently active transaction. Null if no active transaction.

public CDbSchema $schema
#

The database schema for the current connection.

The database schema for the current connection.

public CDbCommandBuilder $commandBuilder
#

The command builder.

The command builder.

public string $lastInsertID
#

The row ID of the last row inserted, or the last value retrieved from the sequence object.

The row ID of the last row inserted, or the last value retrieved from the sequence object.

public mixed $columnCase
#

The case of the column names.

The case of the column names.

public mixed $nullConversion
#

How the null and empty strings are converted.

How the null and empty strings are converted.

public boolean $autoCommit
#

Whether creating or updating a DB record will be automatically committed.

Whether creating or updating a DB record will be automatically committed.

public boolean $persistent
#

Whether the connection is persistent or not.

Whether the connection is persistent or not.

public string $driverName
#

Name of the DB driver. This property is read-write since 1.1.16. Before 1.1.15 it was read-only.

Name of the DB driver. This property is read-write since 1.1.16. Before 1.1.15 it was read-only.

public string $clientVersion
#

The version information of the DB driver.

The version information of the DB driver.

public string $connectionStatus
#

The status of the connection.

The status of the connection.

public boolean $prefetch
#

Whether the connection performs data prefetching.

Whether the connection performs data prefetching.

public string $serverInfo
#

The information of DBMS server.

The information of DBMS server.

public string $serverVersion
#

The version information of DBMS server.

The version information of DBMS server.

public integer $timeout
#

Timeout settings for the connection.

Timeout settings for the connection.

public array $attributes
#

Attributes (name=>value) that are previously explicitly set for the DB connection.

Attributes (name=>value) that are previously explicitly set for the DB connection.

public array $stats
#

The first element indicates the number of SQL statements executed, and the second element the total time spent in SQL execution.

The first element indicates the number of SQL statements executed, and the second element the total time spent in SQL execution.

Magic properties inherited from CApplicationComponent
$isInitialized
API documentation generated by ApiGen 2.8.0