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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
70b57766
Commit
70b57766
authored
May 14, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed test break.
parent
a46efe79
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
26 deletions
+26
-26
QueryBuilder.php
framework/db/QueryBuilder.php
+1
-1
QueryBuilderTest.php
tests/unit/framework/db/QueryBuilderTest.php
+5
-5
CubridQueryBuilderTest.php
tests/unit/framework/db/cubrid/CubridQueryBuilderTest.php
+10
-10
PostgreSQLQueryBuilderTest.php
tests/unit/framework/db/pgsql/PostgreSQLQueryBuilderTest.php
+10
-10
No files found.
framework/db/QueryBuilder.php
View file @
70b57766
...
...
@@ -589,7 +589,7 @@ class QueryBuilder extends \yii\base\Object
{
if
(
isset
(
$this
->
typeMap
[
$type
]))
{
return
$this
->
typeMap
[
$type
];
}
elseif
(
preg_match
(
'/^(\w+)\((
.
+?)\)(.*)$/'
,
$type
,
$matches
))
{
}
elseif
(
preg_match
(
'/^(\w+)\((
[\d,]
+?)\)(.*)$/'
,
$type
,
$matches
))
{
if
(
isset
(
$this
->
typeMap
[
$matches
[
1
]]))
{
$ptype
=
$this
->
typeMap
[
$matches
[
1
]];
if
(
strpos
(
$ptype
,
'('
)
!==
false
)
{
...
...
tests/unit/framework/db/QueryBuilderTest.php
View file @
70b57766
...
...
@@ -55,11 +55,11 @@ class QueryBuilderTest extends DatabaseTestCase
[
Schema
::
TYPE_STRING
.
'(32) CHECK (value LIKE "test%")'
,
'varchar(32) CHECK (value LIKE "test%")'
],
[
Schema
::
TYPE_STRING
.
' NOT NULL'
,
'varchar(255) NOT NULL'
],
[
Schema
::
TYPE_TEXT
,
'text'
],
[
Schema
::
TYPE_TEXT
.
'(255)'
,
'text'
],
[
Schema
::
TYPE_TEXT
.
'(255)'
,
'text
(255)
'
],
[
Schema
::
TYPE_TEXT
.
' CHECK (value LIKE "test%")'
,
'text CHECK (value LIKE "test%")'
],
[
Schema
::
TYPE_TEXT
.
'(255) CHECK (value LIKE "test%")'
,
'text CHECK (value LIKE "test%")'
],
[
Schema
::
TYPE_TEXT
.
'(255) CHECK (value LIKE "test%")'
,
'text
(255)
CHECK (value LIKE "test%")'
],
[
Schema
::
TYPE_TEXT
.
' NOT NULL'
,
'text NOT NULL'
],
[
Schema
::
TYPE_TEXT
.
'(255) NOT NULL'
,
'text NOT NULL'
],
[
Schema
::
TYPE_TEXT
.
'(255) NOT NULL'
,
'text
(255)
NOT NULL'
],
[
Schema
::
TYPE_SMALLINT
,
'smallint(6)'
],
[
Schema
::
TYPE_SMALLINT
.
'(8)'
,
'smallint(8)'
],
[
Schema
::
TYPE_INTEGER
,
'int(11)'
],
...
...
@@ -73,9 +73,9 @@ class QueryBuilderTest extends DatabaseTestCase
[
Schema
::
TYPE_BIGINT
.
'(8) CHECK (value > 5)'
,
'bigint(8) CHECK (value > 5)'
],
[
Schema
::
TYPE_BIGINT
.
' NOT NULL'
,
'bigint(20) NOT NULL'
],
[
Schema
::
TYPE_FLOAT
,
'float'
],
[
Schema
::
TYPE_FLOAT
.
'(16,5)'
,
'float'
],
[
Schema
::
TYPE_FLOAT
.
'(16,5)'
,
'float
(16,5)
'
],
[
Schema
::
TYPE_FLOAT
.
' CHECK (value > 5.6)'
,
'float CHECK (value > 5.6)'
],
[
Schema
::
TYPE_FLOAT
.
'(16,5) CHECK (value > 5.6)'
,
'float CHECK (value > 5.6)'
],
[
Schema
::
TYPE_FLOAT
.
'(16,5) CHECK (value > 5.6)'
,
'float
(16,5)
CHECK (value > 5.6)'
],
[
Schema
::
TYPE_FLOAT
.
' NOT NULL'
,
'float NOT NULL'
],
[
Schema
::
TYPE_DECIMAL
,
'decimal(10,0)'
],
[
Schema
::
TYPE_DECIMAL
.
'(12,4)'
,
'decimal(12,4)'
],
...
...
tests/unit/framework/db/cubrid/CubridQueryBuilderTest.php
View file @
70b57766
...
...
@@ -21,31 +21,31 @@ class CubridQueryBuilderTest extends QueryBuilderTest
{
return
[
[
Schema
::
TYPE_PK
,
'int NOT NULL AUTO_INCREMENT PRIMARY KEY'
],
[
Schema
::
TYPE_PK
.
'(8)'
,
'int NOT NULL AUTO_INCREMENT PRIMARY KEY'
],
//
[Schema::TYPE_PK . '(8)', 'int NOT NULL AUTO_INCREMENT PRIMARY KEY'],
[
Schema
::
TYPE_PK
.
' CHECK (value > 5)'
,
'int NOT NULL AUTO_INCREMENT PRIMARY KEY CHECK (value > 5)'
],
[
Schema
::
TYPE_PK
.
'(8) CHECK (value > 5)'
,
'int NOT NULL AUTO_INCREMENT PRIMARY KEY CHECK (value > 5)'
],
//
[Schema::TYPE_PK . '(8) CHECK (value > 5)', 'int NOT NULL AUTO_INCREMENT PRIMARY KEY CHECK (value > 5)'],
[
Schema
::
TYPE_STRING
,
'varchar(255)'
],
[
Schema
::
TYPE_STRING
.
'(32)'
,
'varchar(32)'
],
[
Schema
::
TYPE_STRING
.
' CHECK (value LIKE "test%")'
,
'varchar(255) CHECK (value LIKE "test%")'
],
[
Schema
::
TYPE_STRING
.
'(32) CHECK (value LIKE "test%")'
,
'varchar(32) CHECK (value LIKE "test%")'
],
[
Schema
::
TYPE_STRING
.
' NOT NULL'
,
'varchar(255) NOT NULL'
],
[
Schema
::
TYPE_TEXT
,
'varchar'
],
[
Schema
::
TYPE_TEXT
.
'(255)'
,
'varchar'
],
[
Schema
::
TYPE_TEXT
.
'(255)'
,
'varchar
(255)
'
],
[
Schema
::
TYPE_TEXT
.
' CHECK (value LIKE "test%")'
,
'varchar CHECK (value LIKE "test%")'
],
[
Schema
::
TYPE_TEXT
.
'(255) CHECK (value LIKE "test%")'
,
'varchar CHECK (value LIKE "test%")'
],
[
Schema
::
TYPE_TEXT
.
'(255) CHECK (value LIKE "test%")'
,
'varchar
(255)
CHECK (value LIKE "test%")'
],
[
Schema
::
TYPE_TEXT
.
' NOT NULL'
,
'varchar NOT NULL'
],
[
Schema
::
TYPE_TEXT
.
'(255) NOT NULL'
,
'varchar NOT NULL'
],
[
Schema
::
TYPE_TEXT
.
'(255) NOT NULL'
,
'varchar
(255)
NOT NULL'
],
[
Schema
::
TYPE_SMALLINT
,
'smallint'
],
[
Schema
::
TYPE_SMALLINT
.
'(8)'
,
'smallint'
],
[
Schema
::
TYPE_SMALLINT
.
'(8)'
,
'smallint
(8)
'
],
[
Schema
::
TYPE_INTEGER
,
'int'
],
[
Schema
::
TYPE_INTEGER
.
'(8)'
,
'int'
],
[
Schema
::
TYPE_INTEGER
.
'(8)'
,
'int
(8)
'
],
[
Schema
::
TYPE_INTEGER
.
' CHECK (value > 5)'
,
'int CHECK (value > 5)'
],
[
Schema
::
TYPE_INTEGER
.
'(8) CHECK (value > 5)'
,
'int CHECK (value > 5)'
],
[
Schema
::
TYPE_INTEGER
.
'(8) CHECK (value > 5)'
,
'int
(8)
CHECK (value > 5)'
],
[
Schema
::
TYPE_INTEGER
.
' NOT NULL'
,
'int NOT NULL'
],
[
Schema
::
TYPE_BIGINT
,
'bigint'
],
[
Schema
::
TYPE_BIGINT
.
'(8)'
,
'bigint'
],
[
Schema
::
TYPE_BIGINT
.
'(8)'
,
'bigint
(8)
'
],
[
Schema
::
TYPE_BIGINT
.
' CHECK (value > 5)'
,
'bigint CHECK (value > 5)'
],
[
Schema
::
TYPE_BIGINT
.
'(8) CHECK (value > 5)'
,
'bigint CHECK (value > 5)'
],
[
Schema
::
TYPE_BIGINT
.
'(8) CHECK (value > 5)'
,
'bigint
(8)
CHECK (value > 5)'
],
[
Schema
::
TYPE_BIGINT
.
' NOT NULL'
,
'bigint NOT NULL'
],
[
Schema
::
TYPE_FLOAT
,
'float(7)'
],
[
Schema
::
TYPE_FLOAT
.
'(16)'
,
'float(16)'
],
...
...
tests/unit/framework/db/pgsql/PostgreSQLQueryBuilderTest.php
View file @
70b57766
...
...
@@ -17,35 +17,35 @@ class PostgreSQLQueryBuilderTest extends QueryBuilderTest
{
return
[
[
Schema
::
TYPE_PK
,
'serial NOT NULL PRIMARY KEY'
],
[
Schema
::
TYPE_PK
.
'(8)'
,
'serial NOT NULL PRIMARY KEY'
],
//
[Schema::TYPE_PK . '(8)', 'serial NOT NULL PRIMARY KEY'],
[
Schema
::
TYPE_PK
.
' CHECK (value > 5)'
,
'serial NOT NULL PRIMARY KEY CHECK (value > 5)'
],
[
Schema
::
TYPE_PK
.
'(8) CHECK (value > 5)'
,
'serial NOT NULL PRIMARY KEY CHECK (value > 5)'
],
//
[Schema::TYPE_PK . '(8) CHECK (value > 5)', 'serial NOT NULL PRIMARY KEY CHECK (value > 5)'],
[
Schema
::
TYPE_STRING
,
'varchar(255)'
],
[
Schema
::
TYPE_STRING
.
'(32)'
,
'varchar(32)'
],
[
Schema
::
TYPE_STRING
.
' CHECK (value LIKE "test%")'
,
'varchar(255) CHECK (value LIKE "test%")'
],
[
Schema
::
TYPE_STRING
.
'(32) CHECK (value LIKE "test%")'
,
'varchar(32) CHECK (value LIKE "test%")'
],
[
Schema
::
TYPE_STRING
.
' NOT NULL'
,
'varchar(255) NOT NULL'
],
[
Schema
::
TYPE_TEXT
,
'text'
],
[
Schema
::
TYPE_TEXT
.
'(255)'
,
'text'
],
[
Schema
::
TYPE_TEXT
.
'(255)'
,
'text
(255)
'
],
[
Schema
::
TYPE_TEXT
.
' CHECK (value LIKE "test%")'
,
'text CHECK (value LIKE "test%")'
],
[
Schema
::
TYPE_TEXT
.
'(255) CHECK (value LIKE "test%")'
,
'text CHECK (value LIKE "test%")'
],
[
Schema
::
TYPE_TEXT
.
'(255) CHECK (value LIKE "test%")'
,
'text
(255)
CHECK (value LIKE "test%")'
],
[
Schema
::
TYPE_TEXT
.
' NOT NULL'
,
'text NOT NULL'
],
[
Schema
::
TYPE_TEXT
.
'(255) NOT NULL'
,
'text NOT NULL'
],
[
Schema
::
TYPE_TEXT
.
'(255) NOT NULL'
,
'text
(255)
NOT NULL'
],
[
Schema
::
TYPE_SMALLINT
,
'smallint'
],
[
Schema
::
TYPE_SMALLINT
.
'(8)'
,
'smallint'
],
[
Schema
::
TYPE_INTEGER
,
'integer'
],
[
Schema
::
TYPE_INTEGER
.
'(8)'
,
'integer'
],
[
Schema
::
TYPE_INTEGER
.
'(8)'
,
'integer
(8)
'
],
[
Schema
::
TYPE_INTEGER
.
' CHECK (value > 5)'
,
'integer CHECK (value > 5)'
],
[
Schema
::
TYPE_INTEGER
.
'(8) CHECK (value > 5)'
,
'integer CHECK (value > 5)'
],
[
Schema
::
TYPE_INTEGER
.
'(8) CHECK (value > 5)'
,
'integer
(8)
CHECK (value > 5)'
],
[
Schema
::
TYPE_INTEGER
.
' NOT NULL'
,
'integer NOT NULL'
],
[
Schema
::
TYPE_BIGINT
,
'bigint'
],
[
Schema
::
TYPE_BIGINT
.
'(8)'
,
'bigint'
],
[
Schema
::
TYPE_BIGINT
.
'(8)'
,
'bigint
(8)
'
],
[
Schema
::
TYPE_BIGINT
.
' CHECK (value > 5)'
,
'bigint CHECK (value > 5)'
],
[
Schema
::
TYPE_BIGINT
.
'(8) CHECK (value > 5)'
,
'bigint CHECK (value > 5)'
],
[
Schema
::
TYPE_BIGINT
.
'(8) CHECK (value > 5)'
,
'bigint
(8)
CHECK (value > 5)'
],
[
Schema
::
TYPE_BIGINT
.
' NOT NULL'
,
'bigint NOT NULL'
],
[
Schema
::
TYPE_FLOAT
,
'double precision'
],
[
Schema
::
TYPE_FLOAT
.
' CHECK (value > 5.6)'
,
'double precision CHECK (value > 5.6)'
],
[
Schema
::
TYPE_FLOAT
.
'(16,5) CHECK (value > 5.6)'
,
'double precision CHECK (value > 5.6)'
],
[
Schema
::
TYPE_FLOAT
.
'(16,5) CHECK (value > 5.6)'
,
'double
(16,5)
precision CHECK (value > 5.6)'
],
[
Schema
::
TYPE_FLOAT
.
' NOT NULL'
,
'double precision NOT NULL'
],
[
Schema
::
TYPE_DECIMAL
,
'numeric(10,0)'
],
[
Schema
::
TYPE_DECIMAL
.
'(12,4)'
,
'numeric(12,4)'
],
...
...
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