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
b0e5314f
Commit
b0e5314f
authored
Sep 01, 2016
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the same statement resource for repeated execution of the statement
parent
c446c311
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
1 deletion
+43
-1
SQLSrvStatement.php
lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php
+10
-1
StatementTest.php
...ine/Tests/DBAL/Functional/Driver/SQLSrv/StatementTest.php
+33
-0
No files found.
lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php
View file @
b0e5314f
...
...
@@ -197,8 +197,17 @@ class SQLSrvStatement implements IteratorAggregate, Statement
}
}
$this
->
stmt
=
sqlsrv_query
(
$this
->
conn
,
$this
->
sql
,
$this
->
params
);
if
(
!
$this
->
stmt
)
{
$stmt
=
sqlsrv_prepare
(
$this
->
conn
,
$this
->
sql
,
$this
->
params
);
if
(
!
$stmt
)
{
throw
SQLSrvException
::
fromSqlSrvErrors
();
}
$this
->
stmt
=
$stmt
;
}
if
(
!
sqlsrv_execute
(
$this
->
stmt
))
{
throw
SQLSrvException
::
fromSqlSrvErrors
();
}
...
...
tests/Doctrine/Tests/DBAL/Functional/Driver/SQLSrv/StatementTest.php
0 → 100644
View file @
b0e5314f
<?php
namespace
Doctrine\Tests\DBAL\Functional\Driver\SQLSrv
;
use
Doctrine\DBAL\Driver\SQLSrv\Driver
;
use
Doctrine\Tests\DbalFunctionalTestCase
;
class
StatementTest
extends
DbalFunctionalTestCase
{
protected
function
setUp
()
{
if
(
!
extension_loaded
(
'sqlsrv'
))
{
$this
->
markTestSkipped
(
'sqlsrv is not installed.'
);
}
parent
::
setUp
();
if
(
!
$this
->
_conn
->
getDriver
()
instanceof
Driver
)
{
$this
->
markTestSkipped
(
'sqlsrv only test'
);
}
}
public
function
testFailureToPrepareResultsInException
()
{
// use the driver connection directly to avoid having exception wrapped
$stmt
=
$this
->
_conn
->
getWrappedConnection
()
->
prepare
(
null
);
// it's impossible to prepare the statement without bound variables for SQL Server,
// so the preparation happens before the first execution when variables are already in place
$this
->
setExpectedException
(
'Doctrine\\DBAL\\Driver\\SQLSrv\\SQLSrvException'
);
$stmt
->
execute
();
}
}
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