Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Tomáš Trávníček
doctrine-dbal
Commits
31c41ee0
Commit
31c41ee0
authored
Feb 06, 2017
by
Marco Pivetta
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix/#2634-last-insert-id-fetching-in-sql-server-syntax-fix' into 2.5
Backport #2634 into 2.5.*
parents
77b764ad
1ea99a2f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
Connection.php
lib/Doctrine/DBAL/Driver/PDOSqlsrv/Connection.php
+15
-0
SQLSrvConnection.php
lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvConnection.php
+2
-3
No files found.
lib/Doctrine/DBAL/Driver/PDOSqlsrv/Connection.php
View file @
31c41ee0
...
...
@@ -40,6 +40,21 @@ class Connection extends PDOConnection implements \Doctrine\DBAL\Driver\Connecti
/**
* @override
*/
public
function
lastInsertId
(
$name
=
null
)
{
if
(
null
===
$name
)
{
return
parent
::
lastInsertId
(
$name
);
}
$stmt
=
$this
->
prepare
(
'SELECT CONVERT(VARCHAR(MAX), current_value) FROM sys.sequences WHERE name = ?'
);
$stmt
->
execute
(
array
(
$name
));
return
$stmt
->
fetchColumn
();
}
/**
* {@inheritDoc}
*/
public
function
quote
(
$value
,
$type
=
\PDO
::
PARAM_STR
)
{
$val
=
parent
::
quote
(
$value
,
$type
);
...
...
lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvConnection.php
View file @
31c41ee0
...
...
@@ -130,9 +130,8 @@ class SQLSrvConnection implements Connection, ServerInfoAwareConnection
public
function
lastInsertId
(
$name
=
null
)
{
if
(
$name
!==
null
)
{
$sql
=
"SELECT IDENT_CURRENT("
.
$this
->
quote
(
$name
)
.
") AS LastInsertId"
;
$stmt
=
$this
->
prepare
(
$sql
);
$stmt
->
execute
();
$stmt
=
$this
->
prepare
(
'SELECT CONVERT(VARCHAR(MAX), current_value) FROM sys.sequences WHERE name = ?'
);
$stmt
->
execute
(
array
(
$name
));
return
$stmt
->
fetchColumn
();
}
...
...
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