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
8144e267
Commit
8144e267
authored
Sep 07, 2016
by
Marco Pivetta
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/#2494-sqlsrv-reuse-statement'
Close #2494
parents
c446c311
817b5149
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
1 deletion
+44
-1
SQLSrvStatement.php
lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php
+10
-1
StatementTest.php
...ine/Tests/DBAL/Functional/Driver/SQLSrv/StatementTest.php
+34
-0
No files found.
lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php
View file @
8144e267
...
...
@@ -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 @
8144e267
<?php
namespace
Doctrine\Tests\DBAL\Functional\Driver\SQLSrv
;
use
Doctrine\DBAL\Driver\SQLSrv\Driver
;
use
Doctrine\DBAL\Driver\SQLSrv\SQLSrvException
;
use
Doctrine\Tests\DbalFunctionalTestCase
;
class
StatementTest
extends
DbalFunctionalTestCase
{
protected
function
setUp
()
{
if
(
!
extension_loaded
(
'sqlsrv'
))
{
self
::
markTestSkipped
(
'sqlsrv is not installed.'
);
}
parent
::
setUp
();
if
(
!
$this
->
_conn
->
getDriver
()
instanceof
Driver
)
{
self
::
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
->
expectException
(
SQLSrvException
::
class
);
$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