Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
8517ee9e
Commit
8517ee9e
authored
Jan 05, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reorganized DB classes.
parent
0cd6b346
Show whitespace changes
Inline
Side-by-side
Showing
38 changed files
with
109 additions
and
109 deletions
+109
-109
model.md
docs/model.md
+3
-3
Application.php
framework/base/Application.php
+2
-2
Module.php
framework/base/Module.php
+1
-1
DbCache.php
framework/caching/DbCache.php
+2
-2
DbDependency.php
framework/caching/DbDependency.php
+2
-2
main.php
framework/console/create/default/protected/config/main.php
+1
-1
ActiveQuery.php
framework/db/ActiveQuery.php
+6
-6
ActiveRecord.php
framework/db/ActiveRecord.php
+5
-5
ActiveRecordBehavior.php
framework/db/ActiveRecordBehavior.php
+1
-1
ActiveRelation.php
framework/db/ActiveRelation.php
+4
-4
BaseQuery.php
framework/db/BaseQuery.php
+1
-1
ColumnSchema.php
framework/db/ColumnSchema.php
+1
-1
Command.php
framework/db/Command.php
+1
-1
Connection.php
framework/db/Connection.php
+12
-12
DataReader.php
framework/db/DataReader.php
+1
-1
Driver.php
framework/db/Driver.php
+1
-1
Expression.php
framework/db/Expression.php
+1
-1
Query.php
framework/db/Query.php
+4
-4
QueryBuilder.php
framework/db/QueryBuilder.php
+1
-1
TableSchema.php
framework/db/TableSchema.php
+1
-1
Transaction.php
framework/db/Transaction.php
+1
-1
Driver.php
framework/db/mysql/Driver.php
+10
-10
QueryBuilder.php
framework/db/mysql/QueryBuilder.php
+2
-2
Driver.php
framework/db/sqlite/Driver.php
+9
-9
QueryBuilder.php
framework/db/sqlite/QueryBuilder.php
+2
-2
DbTarget.php
framework/logging/DbTarget.php
+4
-4
Logger.php
framework/logging/Logger.php
+1
-1
Target.php
framework/logging/Target.php
+2
-2
ExistValidator.php
framework/validators/ExistValidator.php
+6
-6
UniqueValidator.php
framework/validators/UniqueValidator.php
+3
-3
MysqlTestCase.php
tests/unit/MysqlTestCase.php
+2
-2
ActiveRecord.php
tests/unit/data/ar/ActiveRecord.php
+2
-2
Customer.php
tests/unit/data/ar/Customer.php
+1
-1
ActiveRecordTest.php
tests/unit/framework/db/ar/ActiveRecordTest.php
+2
-2
CommandTest.php
tests/unit/framework/db/dao/CommandTest.php
+4
-4
ConnectionTest.php
tests/unit/framework/db/dao/ConnectionTest.php
+1
-1
QueryTest.php
tests/unit/framework/db/dao/QueryTest.php
+4
-4
upgrade.md
upgrade.md
+2
-2
No files found.
docs/model.md
View file @
8517ee9e
...
...
@@ -20,7 +20,7 @@ A model should list all its available attributes in the `attributes()` method.
Attributes may be implemented in various ways. The
[
[\yii\base\Model
]
] class
implements attributes as public member variables of the class, while the
[
[\yii\db\
ar\
ActiveRecord
]
] class implements them as DB table columns. For example,
[
[\yii\db\ActiveRecord
]
] class implements them as DB table columns. For example,
~~~
php
// LoginForm has two attributes: username and password
...
...
@@ -32,7 +32,7 @@ class LoginForm extends \yii\base\Model
// Post is associated with the tbl_post DB table.
// Its attributes correspond to the columns in tbl_post
class
Post
extends
\yii\db\
ar\
ActiveRecord
class
Post
extends
\yii\db\ActiveRecord
{
public
function
table
()
{
...
...
@@ -65,7 +65,7 @@ whose keys are the scenario names and whose values are the corresponding
active attribute lists. Below is an example:
~~~
php
class
User
extends
\yii\db\
ar\
ActiveRecord
class
User
extends
\yii\db\ActiveRecord
{
public
function
table
()
{
...
...
framework/base/Application.php
View file @
8517ee9e
...
...
@@ -52,7 +52,7 @@ use yii\base\Exception;
* @property CCache $cache Returns the cache component.
* @property CPhpMessageSource $coreMessages Returns the core message translations.
* @property CDateFormatter $dateFormatter Returns the locale-dependent date formatter.
* @property \yii\db\
dao\
Connection $db Returns the database connection component.
* @property \yii\db\Connection $db Returns the database connection component.
* @property CErrorHandler $errorHandler Returns the error handler component.
* @property string $extensionPath Returns the root directory that holds all third-party extensions.
* @property string $id Returns the unique identifier for the application.
...
...
@@ -324,7 +324,7 @@ class Application extends Module
/**
* Returns the database connection component.
* @return \yii\db\
dao\
Connection the database connection
* @return \yii\db\Connection the database connection
*/
public
function
getDb
()
{
...
...
framework/base/Module.php
View file @
8517ee9e
...
...
@@ -501,7 +501,7 @@ abstract class Module extends Component
* ~~~
* array(
* 'db' => array(
* 'class' => 'yii\db\
dao\
Connection',
* 'class' => 'yii\db\Connection',
* 'dsn' => 'sqlite:path/to/file.db',
* ),
* 'cache' => array(
...
...
framework/caching/DbCache.php
View file @
8517ee9e
...
...
@@ -10,8 +10,8 @@
namespace
yii\caching
;
use
yii\base\Exception
;
use
yii\db\
dao\
Connection
;
use
yii\db\
dao\
Query
;
use
yii\db\Connection
;
use
yii\db\Query
;
/**
* DbCache implements a cache application component by storing cached data in a database.
...
...
framework/caching/DbDependency.php
View file @
8517ee9e
...
...
@@ -10,8 +10,8 @@
namespace
yii\caching
;
use
yii\base\Exception
;
use
yii\db\
dao\
Connection
;
use
yii\db\
dao\
Query
;
use
yii\db\Connection
;
use
yii\db\Query
;
/**
* DbDependency represents a dependency based on the query result of a SQL statement.
...
...
framework/console/create/default/protected/config/main.php
View file @
8517ee9e
...
...
@@ -6,7 +6,7 @@ return array(
// uncomment the following to use a MySQL database
/*
'db' => array(
'class' => 'yii\db\
dao\
Connection',
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=testdrive',
'username' => 'root',
'password' => '',
...
...
framework/db/
ar/
ActiveQuery.php
→
framework/db/ActiveQuery.php
View file @
8517ee9e
...
...
@@ -8,14 +8,14 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\db
\ar
;
namespace
yii\db
;
use
yii\db\
dao\
Connection
;
use
yii\db\
dao\
Command
;
use
yii\db\
dao\
QueryBuilder
;
use
yii\db\
dao\
BaseQuery
;
use
yii\db\Connection
;
use
yii\db\Command
;
use
yii\db\QueryBuilder
;
use
yii\db\BaseQuery
;
use
yii\base\VectorIterator
;
use
yii\db\
dao\
Expression
;
use
yii\db\Expression
;
use
yii\db\Exception
;
class
ActiveQuery
extends
BaseQuery
...
...
framework/db/
ar/
ActiveRecord.php
→
framework/db/ActiveRecord.php
View file @
8517ee9e
...
...
@@ -8,16 +8,16 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\db
\ar
;
namespace
yii\db
;
use
yii\base\Model
;
use
yii\base\Event
;
use
yii\base\ModelEvent
;
use
yii\db\Exception
;
use
yii\db\
dao\
Connection
;
use
yii\db\
dao\
TableSchema
;
use
yii\db\
dao\
Query
;
use
yii\db\
dao\
Expression
;
use
yii\db\Connection
;
use
yii\db\TableSchema
;
use
yii\db\Query
;
use
yii\db\Expression
;
use
yii\util\StringHelper
;
/**
...
...
framework/db/
ar/
ActiveRecordBehavior.php
→
framework/db/ActiveRecordBehavior.php
View file @
8517ee9e
...
...
@@ -7,7 +7,7 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\db
\ar
;
namespace
yii\db
;
use
yii\base\ModelBehavior
;
...
...
framework/db/
ar/
ActiveRelation.php
→
framework/db/ActiveRelation.php
View file @
8517ee9e
...
...
@@ -8,11 +8,11 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\db
\ar
;
namespace
yii\db
;
use
yii\db\
dao\
Connection
;
use
yii\db\
dao\
Command
;
use
yii\db\
dao\
QueryBuilder
;
use
yii\db\Connection
;
use
yii\db\Command
;
use
yii\db\QueryBuilder
;
/**
* It is used in three scenarios:
...
...
framework/db/
dao/
BaseQuery.php
→
framework/db/BaseQuery.php
View file @
8517ee9e
...
...
@@ -7,7 +7,7 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\db
\dao
;
namespace
yii\db
;
/**
* BaseQuery is the base class that represents a SQL SELECT statement in a DBMS-independent way.
...
...
framework/db/
dao/
ColumnSchema.php
→
framework/db/ColumnSchema.php
View file @
8517ee9e
...
...
@@ -7,7 +7,7 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\db
\dao
;
namespace
yii\db
;
/**
* ColumnSchema class describes the metadata of a column in a database table.
...
...
framework/db/
dao/
Command.php
→
framework/db/Command.php
View file @
8517ee9e
...
...
@@ -7,7 +7,7 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\db
\dao
;
namespace
yii\db
;
use
yii\db\Exception
;
...
...
framework/db/
dao/
Connection.php
→
framework/db/Connection.php
View file @
8517ee9e
...
...
@@ -7,7 +7,7 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\db
\dao
;
namespace
yii\db
;
use
yii\db\Exception
;
...
...
@@ -25,7 +25,7 @@ use yii\db\Exception;
* the DB connection:
*
* ~~~
* $connection = new \yii\db\
dao\
Connection(array(
* $connection = new \yii\db\Connection(array(
* 'dsn' => $dsn,
* 'username' => $username,
* 'password' => $password,
...
...
@@ -76,7 +76,7 @@ use yii\db\Exception;
* array(
* 'components' => array(
* 'db' => array(
* 'class' => '\yii\db\
dao\
Connection',
* 'class' => '\yii\db\Connection',
* 'dsn' => 'mysql:host=127.0.0.1;dbname=demo',
* 'username' => 'root',
* 'password' => '',
...
...
@@ -238,15 +238,15 @@ class Connection extends \yii\base\ApplicationComponent
* [[Driver]] class to support DBMS that is not supported by Yii.
*/
public
$driverMap
=
array
(
'pgsql'
=>
'yii\db\
dao\
pgsql\Driver'
,
// PostgreSQL
'mysqli'
=>
'yii\db\
dao\
mysql\Driver'
,
// MySQL
'mysql'
=>
'yii\db\
dao\
mysql\Driver'
,
// MySQL
'sqlite'
=>
'yii\db\
dao\
sqlite\Driver'
,
// sqlite 3
'sqlite2'
=>
'yii\db\
dao\
sqlite\Driver'
,
// sqlite 2
'pgsql'
=>
'yii\db\pgsql\Driver'
,
// PostgreSQL
'mysqli'
=>
'yii\db\mysql\Driver'
,
// MySQL
'mysql'
=>
'yii\db\mysql\Driver'
,
// MySQL
'sqlite'
=>
'yii\db\sqlite\Driver'
,
// sqlite 3
'sqlite2'
=>
'yii\db\sqlite\Driver'
,
// sqlite 2
'mssql'
=>
'yi\db\dao\mssql\Driver'
,
// Mssql driver on windows hosts
'dblib'
=>
'yii\db\
dao\
mssql\Driver'
,
// dblib drivers on linux (and maybe others os) hosts
'sqlsrv'
=>
'yii\db\
dao\
mssql\Driver'
,
// Mssql
'oci'
=>
'yii\db\
dao\
oci\Driver'
,
// Oracle driver
'dblib'
=>
'yii\db\mssql\Driver'
,
// dblib drivers on linux (and maybe others os) hosts
'sqlsrv'
=>
'yii\db\mssql\Driver'
,
// Mssql
'oci'
=>
'yii\db\oci\Driver'
,
// Oracle driver
);
/**
* @var Transaction the currently active transaction
...
...
@@ -612,7 +612,7 @@ class Connection extends \yii\base\ApplicationComponent
public
function
getStats
()
{
$logger
=
\Yii
::
getLogger
();
$timings
=
$logger
->
getProfiling
(
array
(
'yii\db\
dao\Command::query'
,
'yii\db\dao
\Command::execute'
));
$timings
=
$logger
->
getProfiling
(
array
(
'yii\db\
Command::query'
,
'yii\db
\Command::execute'
));
$count
=
count
(
$timings
);
$time
=
0
;
foreach
(
$timings
as
$timing
)
{
...
...
framework/db/
dao/
DataReader.php
→
framework/db/DataReader.php
View file @
8517ee9e
...
...
@@ -7,7 +7,7 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\db
\dao
;
namespace
yii\db
;
use
yii\db\Exception
;
...
...
framework/db/
dao/
Driver.php
→
framework/db/Driver.php
View file @
8517ee9e
...
...
@@ -7,7 +7,7 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\db
\dao
;
namespace
yii\db
;
use
yii\db\Exception
;
...
...
framework/db/
dao/
Expression.php
→
framework/db/Expression.php
View file @
8517ee9e
...
...
@@ -7,7 +7,7 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\db
\dao
;
namespace
yii\db
;
/**
* Expression represents a DB expression that does not need escaping or quoting.
...
...
framework/db/
dao/
Query.php
→
framework/db/Query.php
View file @
8517ee9e
...
...
@@ -7,7 +7,7 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\db
\dao
;
namespace
yii\db
;
/**
* Query represents a SQL statement in a way that is independent of DBMS.
...
...
@@ -144,7 +144,7 @@ class Query extends BaseQuery
* The columns in the new table should be specified as name-definition pairs (e.g. 'name'=>'string'),
* where name stands for a column name which will be properly quoted by the method, and definition
* stands for the column type which can contain an abstract DB type.
* The method [[\yii\db\
dao\
QueryBuilder::getColumnType()]] will be called
* The method [[\yii\db\QueryBuilder::getColumnType()]] will be called
* to convert the abstract column types to physical ones. For example, `string` will be converted
* as `varchar(255)`, and `string not null` becomes `varchar(255) not null`.
*
...
...
@@ -200,7 +200,7 @@ class Query extends BaseQuery
* Builds and executes a SQL statement for adding a new DB column.
* @param string $table the table that the new column will be added to. The table name will be properly quoted by the method.
* @param string $column the name of the new column. The name will be properly quoted by the method.
* @param string $type the column type. [[\yii\db\
dao\
QueryBuilder::getColumnType()]] will be called
* @param string $type the column type. [[\yii\db\QueryBuilder::getColumnType()]] will be called
* to convert the give column type to the physical one. For example, `string` will be converted
* as `varchar(255)`, and `string not null` becomes `varchar(255) not null`.
* @return Query the query object itself
...
...
@@ -240,7 +240,7 @@ class Query extends BaseQuery
* Builds and executes a SQL statement for changing the definition of a column.
* @param string $table the table whose column is to be changed. The table name will be properly quoted by the method.
* @param string $column the name of the column to be changed. The name will be properly quoted by the method.
* @param string $type the column type. [[\yii\db\
dao\
QueryBuilder::getColumnType()]] will be called
* @param string $type the column type. [[\yii\db\QueryBuilder::getColumnType()]] will be called
* to convert the give column type to the physical one. For example, `string` will be converted
* as `varchar(255)`, and `string not null` becomes `varchar(255) not null`.
* @return Query the query object itself
...
...
framework/db/
dao/
QueryBuilder.php
→
framework/db/QueryBuilder.php
View file @
8517ee9e
...
...
@@ -7,7 +7,7 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\db
\dao
;
namespace
yii\db
;
use
yii\db\Exception
;
...
...
framework/db/
dao/
TableSchema.php
→
framework/db/TableSchema.php
View file @
8517ee9e
...
...
@@ -7,7 +7,7 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\db
\dao
;
namespace
yii\db
;
use
yii\db\Exception
;
...
...
framework/db/
dao/
Transaction.php
→
framework/db/Transaction.php
View file @
8517ee9e
...
...
@@ -7,7 +7,7 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\db
\dao
;
namespace
yii\db
;
use
yii\db\Exception
;
...
...
framework/db/
dao/
mysql/Driver.php
→
framework/db/mysql/Driver.php
View file @
8517ee9e
...
...
@@ -7,10 +7,10 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\db\
dao\
mysql
;
namespace
yii\db\mysql
;
use
yii\db\
dao\
TableSchema
;
use
yii\db\
dao\
ColumnSchema
;
use
yii\db\TableSchema
;
use
yii\db\ColumnSchema
;
/**
* Driver is the class for retrieving metadata from a MySQL database (version 4.1.x and 5.x).
...
...
@@ -18,7 +18,7 @@ use yii\db\dao\ColumnSchema;
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class
Driver
extends
\yii\db\
dao\
Driver
class
Driver
extends
\yii\db\Driver
{
/**
* @var array mapping from physical column types (keys) to abstract column types (values)
...
...
@@ -85,7 +85,7 @@ class Driver extends \yii\db\dao\Driver
/**
* Loads the metadata for the specified table.
* @param string $name table name
* @return \yii\db\
dao\
TableSchema driver dependent table metadata. Null if the table does not exist.
* @return \yii\db\TableSchema driver dependent table metadata. Null if the table does not exist.
*/
protected
function
loadTableSchema
(
$name
)
{
...
...
@@ -100,7 +100,7 @@ class Driver extends \yii\db\dao\Driver
/**
* Resolves the table name and schema name (if any).
* @param \yii\db\
dao\
TableSchema $table the table metadata object
* @param \yii\db\TableSchema $table the table metadata object
* @param string $name the table name
*/
protected
function
resolveTableNames
(
$table
,
$name
)
...
...
@@ -142,7 +142,7 @@ class Driver extends \yii\db\dao\Driver
/**
* Resolves the default value for the column.
* @param \yii\db\
dao\
ColumnSchema $column the column metadata object
* @param \yii\db\ColumnSchema $column the column metadata object
* @param string $value the default value fetched from database
*/
protected
function
resolveColumnDefault
(
$column
,
$value
)
...
...
@@ -154,7 +154,7 @@ class Driver extends \yii\db\dao\Driver
/**
* Resolves the abstract data type for the column.
* @param \yii\db\
dao\
ColumnSchema $column the column metadata object
* @param \yii\db\ColumnSchema $column the column metadata object
*/
public
function
resolveColumnType
(
$column
)
{
...
...
@@ -196,7 +196,7 @@ class Driver extends \yii\db\dao\Driver
/**
* Collects the metadata of table columns.
* @param \yii\db\
dao\
TableSchema $table the table metadata
* @param \yii\db\TableSchema $table the table metadata
* @return boolean whether the table exists in the database
*/
protected
function
findColumns
(
$table
)
...
...
@@ -222,7 +222,7 @@ class Driver extends \yii\db\dao\Driver
/**
* Collects the foreign key column details for the given table.
* @param \yii\db\
dao\
TableSchema $table the table metadata
* @param \yii\db\TableSchema $table the table metadata
*/
protected
function
findConstraints
(
$table
)
{
...
...
framework/db/
dao/
mysql/QueryBuilder.php
→
framework/db/mysql/QueryBuilder.php
View file @
8517ee9e
...
...
@@ -7,7 +7,7 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\db\
dao\
mysql
;
namespace
yii\db\mysql
;
use
yii\db\Exception
;
...
...
@@ -17,7 +17,7 @@ use yii\db\Exception;
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class
QueryBuilder
extends
\yii\db\
dao\
QueryBuilder
class
QueryBuilder
extends
\yii\db\QueryBuilder
{
/**
* @var array mapping from abstract column types (keys) to physical column types (values).
...
...
framework/db/
dao/
sqlite/Driver.php
→
framework/db/sqlite/Driver.php
View file @
8517ee9e
...
...
@@ -7,10 +7,10 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\db\
dao\
sqlite
;
namespace
yii\db\sqlite
;
use
yii\db\
dao\
TableSchema
;
use
yii\db\
dao\
ColumnSchema
;
use
yii\db\TableSchema
;
use
yii\db\ColumnSchema
;
/**
* Driver is the class for retrieving metadata from a SQLite (2/3) database.
...
...
@@ -18,7 +18,7 @@ use yii\db\dao\ColumnSchema;
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class
Driver
extends
\yii\db\
dao\
Driver
class
Driver
extends
\yii\db\Driver
{
/**
* @var array mapping from physical column types (keys) to abstract column types (values)
...
...
@@ -76,7 +76,7 @@ class Driver extends \yii\db\dao\Driver
/**
* Loads the metadata for the specified table.
* @param string $name table name
* @return \yii\db\
dao\
TableSchema driver dependent table metadata. Null if the table does not exist.
* @return \yii\db\TableSchema driver dependent table metadata. Null if the table does not exist.
*/
protected
function
loadTableSchema
(
$name
)
{
...
...
@@ -92,7 +92,7 @@ class Driver extends \yii\db\dao\Driver
/**
* Collects the table column metadata.
* @param \yii\db\
dao\
TableSchema $table the table metadata
* @param \yii\db\TableSchema $table the table metadata
* @return boolean whether the table exists in the database
*/
protected
function
findColumns
(
$table
)
...
...
@@ -120,7 +120,7 @@ class Driver extends \yii\db\dao\Driver
/**
* Collects the foreign key column details for the given table.
* @param \yii\db\
dao\
TableSchema $table the table metadata
* @param \yii\db\TableSchema $table the table metadata
*/
protected
function
findConstraints
(
$table
)
{
...
...
@@ -155,7 +155,7 @@ class Driver extends \yii\db\dao\Driver
/**
* Resolves the abstract data type for the column.
* @param \yii\db\
dao\
ColumnSchema $column the column metadata object
* @param \yii\db\ColumnSchema $column the column metadata object
*/
public
function
resolveColumnType
(
$column
)
{
...
...
@@ -189,7 +189,7 @@ class Driver extends \yii\db\dao\Driver
/**
* Resolves the default value for the column.
* @param \yii\db\
dao\
ColumnSchema $column the column metadata object
* @param \yii\db\ColumnSchema $column the column metadata object
* @param string $value the default value fetched from database
*/
protected
function
resolveColumnDefault
(
$column
,
$value
)
...
...
framework/db/
dao/
sqlite/QueryBuilder.php
→
framework/db/sqlite/QueryBuilder.php
View file @
8517ee9e
...
...
@@ -7,7 +7,7 @@
* @license http://www.yiiframework.com/license/
*/
namespace
yii\db\
dao\
sqlite
;
namespace
yii\db\sqlite
;
use
yii\db\Exception
;
...
...
@@ -17,7 +17,7 @@ use yii\db\Exception;
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class
QueryBuilder
extends
\yii\db\
dao\
QueryBuilder
class
QueryBuilder
extends
\yii\db\QueryBuilder
{
/**
* @var array mapping from abstract column types (keys) to physical column types (values).
...
...
framework/logging/DbTarget.php
View file @
8517ee9e
...
...
@@ -23,7 +23,7 @@ namespace yii\logging;
class
DbTarget
extends
Target
{
/**
* @var string the ID of [[\yii\db\
dao\
Connection]] application component.
* @var string the ID of [[\yii\db\Connection]] application component.
* Defaults to 'db'. Please make sure that your database contains a table
* whose name is as specified in [[tableName]] and has the required table structure.
* @see tableName
...
...
@@ -31,7 +31,7 @@ class DbTarget extends Target
public
$connectionID
=
'db'
;
/**
* @var string the name of the DB table that stores log messages. Defaults to '{{log}}'.
* If you are using table prefix 'tbl_' (configured via [[\yii\db\
dao\
Connection::tablePrefix]]),
* If you are using table prefix 'tbl_' (configured via [[\yii\db\Connection::tablePrefix]]),
* it means the DB table would be named as 'tbl_log'.
*
* The DB table must have the following structure:
...
...
@@ -62,14 +62,14 @@ class DbTarget extends Target
/**
* Returns the DB connection used for saving log messages.
* @return \yii\db\
dao\
Connection the DB connection instance
* @return \yii\db\Connection the DB connection instance
* @throws \yii\base\Exception if [[connectionID]] does not refer to a valid application component ID.
*/
public
function
getDbConnection
()
{
if
(
$this
->
_db
===
null
)
{
$this
->
_db
=
\Yii
::
$application
->
getComponent
(
$this
->
connectionID
);
if
(
!
$this
->
_db
instanceof
\yii\db\
dao\
Connection
)
{
if
(
!
$this
->
_db
instanceof
\yii\db\Connection
)
{
throw
new
\yii\base\Exception
(
'DbTarget.connectionID must refer to a valid application component ID'
);
}
}
...
...
framework/logging/Logger.php
View file @
8517ee9e
...
...
@@ -190,7 +190,7 @@ class Logger extends \yii\base\Component
* @param array $categories list of categories that you are interested in.
* You can use an asterisk at the end of a category to do a prefix match.
* For example, 'yii\db\*' will match categories starting with 'yii\db\',
* such as 'yii\db\
dao\
Connection'.
* such as 'yii\db\Connection'.
* @param array $excludeCategories list of categories that you are interested in.
* @return array the profiling results. Each array element has the following structure:
* `array($token, $category, $time)`.
...
...
framework/logging/Target.php
View file @
8517ee9e
...
...
@@ -37,7 +37,7 @@ abstract class Target extends \yii\base\Component
* @var array list of message categories that this target is interested in. Defaults to empty, meaning all categories.
* You can use an asterisk at the end of a category so that the category may be used to
* match those categories sharing the same common prefix. For example, 'yii\db\*' will match
* categories starting with 'yii\db\', such as 'yii\db\
dao\
Connection'.
* categories starting with 'yii\db\', such as 'yii\db\Connection'.
*/
public
$categories
=
array
();
/**
...
...
@@ -45,7 +45,7 @@ abstract class Target extends \yii\base\Component
* If this property is not empty, then any category listed here will be excluded from [[categories]].
* You can use an asterisk at the end of a category so that the category can be used to
* match those categories sharing the same common prefix. For example, 'yii\db\*' will match
* categories starting with 'yii\db\', such as 'yii\db\
dao\
Connection'.
* categories starting with 'yii\db\', such as 'yii\db\Connection'.
* @see categories
*/
public
$except
=
array
();
...
...
framework/validators/ExistValidator.php
View file @
8517ee9e
...
...
@@ -21,22 +21,22 @@ namespace yii\validators;
class
ExistValidator
extends
Validator
{
/**
* @var string the yii\db\
ar\
ActiveRecord class name or alias of the class
* @var string the yii\db\ActiveRecord class name or alias of the class
* that should be used to look for the attribute value being validated.
* Defaults to null, meaning using the yii\db\
ar\
ActiveRecord class of
* Defaults to null, meaning using the yii\db\ActiveRecord class of
* the attribute being validated.
* @see attributeName
*/
public
$className
;
/**
* @var string the yii\db\
ar\
ActiveRecord class attribute name that should be
* @var string the yii\db\ActiveRecord class attribute name that should be
* used to look for the attribute value being validated. Defaults to null,
* meaning using the name of the attribute being validated.
* @see className
*/
public
$attributeName
;
/**
* @var \yii\db\
dao\
BaseQuery additional query criteria. This will be combined
* @var \yii\db\BaseQuery additional query criteria. This will be combined
* with the condition that checks if the attribute value exists in the
* corresponding table column.
*/
...
...
@@ -51,7 +51,7 @@ class ExistValidator extends Validator
* Validates the attribute of the object.
* If there is any error, the error message is added to the object.
*
* @param \yii\db\
ar\
ActiveRecord $object the object being validated
* @param \yii\db\ActiveRecord $object the object being validated
* @param string $attribute the attribute being validated
*
* @throws \yii\base\Exception if table doesn't have column specified
...
...
@@ -72,7 +72,7 @@ class ExistValidator extends Validator
$finder
=
$object
->
find
()
->
where
(
array
(
$column
->
name
=>
$value
));
if
(
$this
->
query
instanceof
\yii\db\
dao\
BaseQuery
)
{
if
(
$this
->
query
instanceof
\yii\db\BaseQuery
)
{
$finder
->
mergeWith
(
$this
->
query
);
}
...
...
framework/validators/UniqueValidator.php
View file @
8517ee9e
...
...
@@ -28,7 +28,7 @@ class UniqueValidator extends Validator
*/
public
$allowEmpty
=
true
;
/**
* @var string the yii\db\
ar\
ActiveRecord class name or alias of the class
* @var string the yii\db\ActiveRecord class name or alias of the class
* that should be used to look for the attribute value being validated.
* Defaults to null, meaning using the class of the object currently
* being validated.
...
...
@@ -43,7 +43,7 @@ class UniqueValidator extends Validator
*/
public
$attributeName
;
/**
* @var \yii\db\
ar\
ActiveQuery additional query criteria. This will be
* @var \yii\db\ActiveQuery additional query criteria. This will be
* combined with the condition that checks if the attribute value exists
* in the corresponding table column.
*/
...
...
@@ -87,7 +87,7 @@ class UniqueValidator extends Validator
$finder
->
where
(
$this
->
caseSensitive
?
"
{
$column
->
quotedName
}
=:value"
:
"LOWER(
{
$column
->
quotedName
}
)=LOWER(:value)"
);
$finder
->
params
(
array
(
':value'
=>
$value
));
if
(
$this
->
query
instanceof
\yii\db\
dao\
BaseQuery
)
{
if
(
$this
->
query
instanceof
\yii\db\BaseQuery
)
{
$finder
->
mergeWith
(
$this
->
query
);
}
...
...
tests/unit/MysqlTestCase.php
View file @
8517ee9e
...
...
@@ -13,12 +13,12 @@ class MysqlTestCase extends TestCase
/**
* @param bool $reset whether to clean up the test database
* @return \yii\db\
dao\
Connection
* @return \yii\db\Connection
*/
function
getConnection
(
$reset
=
true
)
{
$params
=
$this
->
getParam
(
'mysql'
);
$db
=
new
\yii\db\
dao\
Connection
;
$db
=
new
\yii\db\Connection
;
$db
->
dsn
=
$params
[
'dsn'
];
$db
->
username
=
$params
[
'username'
];
$db
->
password
=
$params
[
'password'
];
...
...
tests/unit/data/ar/ActiveRecord.php
View file @
8517ee9e
...
...
@@ -9,7 +9,7 @@
namespace
yiiunit\data\ar
;
use
yii\db\
dao\
Connection
;
use
yii\db\Connection
;
/**
* ActiveRecord is ...
...
...
@@ -17,7 +17,7 @@ use yii\db\dao\Connection;
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class
ActiveRecord
extends
\yii\db\
ar\
ActiveRecord
class
ActiveRecord
extends
\yii\db\ActiveRecord
{
public
static
$db
;
...
...
tests/unit/data/ar/Customer.php
View file @
8517ee9e
<?php
namespace
yiiunit\data\ar
;
use
yii\db\
ar\
ActiveQuery
;
use
yii\db\ActiveQuery
;
class
Customer
extends
ActiveRecord
{
...
...
tests/unit/framework/db/ar/ActiveRecordTest.php
View file @
8517ee9e
...
...
@@ -2,8 +2,8 @@
namespace
yiiunit\framework\db\ar
;
use
yii\db\
dao\
Query
;
use
yii\db\
ar\
ActiveQuery
;
use
yii\db\Query
;
use
yii\db\ActiveQuery
;
use
yiiunit\data\ar\ActiveRecord
;
use
yiiunit\data\ar\Customer
;
use
yiiunit\data\ar\OrderItem
;
...
...
tests/unit/framework/db/dao/CommandTest.php
View file @
8517ee9e
...
...
@@ -2,10 +2,10 @@
namespace
yiiunit\framework\db\dao
;
use
yii\db\
dao\
Connection
;
use
yii\db\
dao\
Command
;
use
yii\db\
dao\
Query
;
use
yii\db\
dao\
DataReader
;
use
yii\db\Connection
;
use
yii\db\Command
;
use
yii\db\Query
;
use
yii\db\DataReader
;
class
CommandTest
extends
\yiiunit\MysqlTestCase
{
...
...
tests/unit/framework/db/dao/ConnectionTest.php
View file @
8517ee9e
...
...
@@ -2,7 +2,7 @@
namespace
yiiunit\framework\db\dao
;
use
yii\db\
dao\
Connection
;
use
yii\db\Connection
;
class
ConnectionTest
extends
\yiiunit\MysqlTestCase
{
...
...
tests/unit/framework/db/dao/QueryTest.php
View file @
8517ee9e
...
...
@@ -2,10 +2,10 @@
namespace
yiiunit\framework\db\dao
;
use
yii\db\
dao\
Connection
;
use
yii\db\
dao\
Command
;
use
yii\db\
dao\
Query
;
use
yii\db\
dao\
DataReader
;
use
yii\db\Connection
;
use
yii\db\Command
;
use
yii\db\Query
;
use
yii\db\DataReader
;
class
QueryTest
extends
\yiiunit\MysqlTestCase
{
...
...
upgrade.md
View file @
8517ee9e
...
...
@@ -40,7 +40,7 @@ Upgrading from v1.1.x
-
`CFormModel`
is removed. Please use
`yii\base\Model`
instead.
-
`CDbCriteria`
is replaced by
`yii\db\
dao\
Query`
which includes methods for
building a query.
`CDbCommandBuilder`
is replaced by
`yii\db\
dao\
QueryBuilder`
-
`CDbCriteria`
is replaced by
`yii\db\Query`
which includes methods for
building a query.
`CDbCommandBuilder`
is replaced by
`yii\db\QueryBuilder`
which has cleaner and more complete support of query building capabilities.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment