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
a612b492
Commit
a612b492
authored
Jul 22, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4401 from tof06/4342_mssql_driver_updates
4342 mssql driver updates
parents
e17e99d3
bbe8bdde
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
3 deletions
+27
-3
CHANGELOG.md
framework/CHANGELOG.md
+1
-0
PDO.php
framework/db/mssql/PDO.php
+19
-0
QueryBuilder.php
framework/db/mssql/QueryBuilder.php
+7
-3
No files found.
framework/CHANGELOG.md
View file @
a612b492
...
...
@@ -68,6 +68,7 @@ Yii Framework 2 Change Log
-
Bug #4162: Fixed bug where schema name was not used in ’SHOW CREATE TABLE’ query in
`yii\db\mysql\Schema`
(stevekr)
-
Bug #4241:
`yii\widgets\Pjax`
was incorrectly setting container id (mitalcoi)
-
Bug #4276: Added check for UPLOAD_ERR_NO_FILE in
`yii\web\UploadedFile`
and return null if no file was uploaded (OmgDef)
-
Bug #4342: mssql (dblib) driver does not support getting attributes (tof06)
-
Bug: Fixed inconsistent return of
`\yii\console\Application::runAction()`
(samdark)
-
Bug: URL encoding for the route parameter added to
`\yii\web\UrlManager`
(klimov-paul)
-
Bug: Fixed the bug that requesting protected or private action methods would cause 500 error instead of 404 (qiangxue)
...
...
framework/db/mssql/PDO.php
View file @
a612b492
...
...
@@ -61,4 +61,23 @@ class PDO extends \PDO
return
true
;
}
/**
* Retrieve a database connection attribute.
* It is necessary to override PDO's method as some MSSQL PDO driver (e.g. dblib) does not
* support getting attributes
*/
public
function
getAttribute
(
$attribute
)
{
try
{
return
parent
::
getAttribute
(
$attribute
);
}
catch
(
\PDOException
$e
)
{
switch
(
$attribute
)
{
case
PDO
::
ATTR_SERVER_VERSION
:
return
$this
->
query
(
"SELECT SERVERPROPERTY('productversion')"
)
->
fetchColumn
();
default
:
throw
$e
;
}
}
}
}
framework/db/mssql/QueryBuilder.php
View file @
a612b492
...
...
@@ -17,6 +17,8 @@ use yii\base\InvalidParamException;
*/
class
QueryBuilder
extends
\yii\db\QueryBuilder
{
protected
$_oldMssql
;
/**
* @var array mapping from abstract column types (keys) to physical column types (values).
*/
...
...
@@ -189,8 +191,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
$originalOrdering
=
$this
->
buildOrderBy
(
$query
->
orderBy
);
if
(
$query
->
select
)
{
$select
=
implode
(
', '
,
$query
->
select
);
}
else
{
}
else
{
$select
=
$query
->
select
=
'*'
;
}
if
(
$select
===
'*'
)
{
...
...
@@ -238,8 +239,11 @@ class QueryBuilder extends \yii\db\QueryBuilder
*/
protected
function
isOldMssql
()
{
if
(
$this
->
_oldMssql
===
null
)
{
$pdo
=
$this
->
db
->
getSlavePdo
();
$version
=
preg_split
(
"/\./"
,
$pdo
->
getAttribute
(
\PDO
::
ATTR_SERVER_VERSION
));
return
$version
[
0
]
<
11
;
$this
->
_oldMssql
=
$version
[
0
]
<
11
;
}
return
$this
->
_oldMssql
;
}
}
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