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
1f9a4685
Commit
1f9a4685
authored
May 22, 2013
by
resurtm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MSSQL initial query builder.
parent
90395b5d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
6 deletions
+52
-6
QueryBuilder.php
framework/yii/db/QueryBuilder.php
+2
-1
QueryBuilder.php
framework/yii/db/mssql/QueryBuilder.php
+43
-0
QueryBuilder.php
framework/yii/db/mysql/QueryBuilder.php
+4
-3
QueryBuilder.php
framework/yii/db/sqlite/QueryBuilder.php
+3
-2
No files found.
framework/yii/db/QueryBuilder.php
View file @
1f9a4685
...
...
@@ -429,10 +429,11 @@ class QueryBuilder extends \yii\base\Object
* Builds a SQL statement for enabling or disabling integrity check.
* @param boolean $check whether to turn on or off the integrity check.
* @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
* @param string $table the table name. Defaults to empty string, meaning that no table will be changed.
* @return string the SQL statement for checking integrity
* @throws NotSupportedException if this is not supported by the underlying DBMS
*/
public
function
checkIntegrity
(
$check
=
true
,
$schema
=
''
)
public
function
checkIntegrity
(
$check
=
true
,
$schema
=
''
,
$table
=
''
)
{
throw
new
NotSupportedException
(
$this
->
db
->
getDriverName
()
.
' does not support enabling/disabling integrity check.'
);
}
...
...
framework/yii/db/mssql/QueryBuilder.php
View file @
1f9a4685
...
...
@@ -7,6 +7,8 @@
namespace
yii\db\mssql
;
use
yii\base\InvalidParamException
;
/**
* QueryBuilder is the query builder for MS SQL Server databases (version 2008 and above).
*
...
...
@@ -35,4 +37,45 @@ class QueryBuilder extends \yii\db\QueryBuilder
Schema
::
TYPE_BOOLEAN
=>
'tinyint(1)'
,
Schema
::
TYPE_MONEY
=>
'decimal(19,4)'
,
);
// public function update($table, $columns, $condition, &$params)
// {
// return '';
// }
// public function delete($table, $condition, &$params)
// {
// return '';
// }
// public function buildLimit($limit, $offset)
// {
// return '';
// }
// public function resetSequence($table, $value = null)
// {
// return '';
// }
/**
* Builds a SQL statement for enabling or disabling integrity check.
* @param boolean $check whether to turn on or off the integrity check.
* @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
* @param string $table the table name. Defaults to empty string, meaning that no table will be changed.
* @return string the SQL statement for checking integrity
* @throws InvalidParamException if the table does not exist or there is no sequence associated with the table.
*/
public
function
checkIntegrity
(
$check
=
true
,
$schema
=
''
,
$table
=
''
)
{
if
(
$schema
!==
''
)
{
$table
=
"
{
$schema
}
.
{
$table
}
"
;
}
$table
=
$this
->
db
->
quoteTableName
(
$table
);
if
(
$this
->
db
->
getTableSchema
(
$table
)
===
null
)
{
throw
new
InvalidParamException
(
"Table not found:
$table
"
);
}
$enable
=
$check
?
'CHECK'
:
'NOCHECK'
;
return
"ALTER TABLE
{
$table
}
{
$enable
}
CONSTRAINT ALL"
;
}
}
framework/yii/db/mysql/QueryBuilder.php
View file @
1f9a4685
...
...
@@ -120,12 +120,13 @@ class QueryBuilder extends \yii\db\QueryBuilder
/**
* Builds a SQL statement for enabling or disabling integrity check.
* @param boolean $check whether to turn on or off the integrity check.
* @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
* @param string $table the table name. Meaningless for MySQL.
* @param string $schema the schema of the tables. Meaningless for MySQL.
* @return string the SQL statement for checking integrity
*/
public
function
checkIntegrity
(
$check
=
true
,
$schema
=
''
)
public
function
checkIntegrity
(
$check
=
true
,
$schema
=
''
,
$table
=
''
)
{
return
'SET FOREIGN_KEY_CHECKS
=
'
.
(
$check
?
1
:
0
);
return
'SET FOREIGN_KEY_CHECKS
=
'
.
(
$check
?
1
:
0
);
}
/**
...
...
framework/yii/db/sqlite/QueryBuilder.php
View file @
1f9a4685
...
...
@@ -77,10 +77,11 @@ class QueryBuilder extends \yii\db\QueryBuilder
/**
* Enables or disables integrity check.
* @param boolean $check whether to turn on or off the integrity check.
* @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
* @param string $schema the schema of the tables. Meaningless for SQLite.
* @param string $table the table name. Meaningless for SQLite.
* @throws NotSupportedException this is not supported by SQLite
*/
public
function
checkIntegrity
(
$check
=
true
,
$schema
=
''
)
public
function
checkIntegrity
(
$check
=
true
,
$schema
=
''
,
$table
=
''
)
{
throw
new
NotSupportedException
(
__METHOD__
.
' is not supported by SQLite.'
);
}
...
...
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