DBAL-292: Multiple use of named parameter doesn't work #1473

Open
doctrinebot opened this Issue Jun 12, 2012 · 5 comments

4 participants

@doctrinebot

Jira issue originally created by user jue:

In the example in the documentation http://doctrine-dbal.readthedocs.org/en/2.0.x/reference/data-retrieval-and-manipulation.html#dynamic-parameters-and-prepared-statements there is the following example:
{quote}
$sql = "SELECT * FROM users WHERE name = :name OR username = :name";
$stmt = $conn->prepare($sql);
$stmt->bindValue("name", $name);
$stmt->execute();
{quote}
When I try this example using pdo_sqlsrv I get the following error:
PDOException: SQLSTATE[07002]: [Microsoft][SQL Server Native Client 11.0]COUNT field incorrect or syntax error

When I use instead the parameters name1 and name2 the query works as expected.

@doctrinebot

Comment created by @asm89:

Are you sure you were using the 2.2.2 version of the ORM? Can you try to reproduce this with the latest master?

@doctrinebot

Comment created by @deeky666:

[~jue] ping. I cannot reproduce this error, either. Can you please try to reproduce this with the latest master branch? Otherwise I will close this ticket.

@doctrinebot doctrinebot added the Bug label Dec 6, 2015
@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
@Russellmd

I have the same issue with Doctrine 2.5.4

@deeky666
Doctrine member

@Russellmd which driver are you using? pdo_sqlsrv or sqlsrv? Also please give a snippet of the failing code (with exception). I'll investigate then, thanks.

@Russellmd

@deeky666

Hi,

I have tried with both pdo_sqlsrv and sqlsrv for windows 7/8 x64 using:
Symfony + Doctrine
WAMPSERVER 2.5 32/64 bits
Microsoft ODBC Driver 11 for SQL Server
Microsoft Drivers for PHP for SQL Server Version (3.2): php_pdo_sqlsrv_55_ts.dll / php_sqlsrv_55_ts.dll

SQLSTATE[07002]: [Microsoft][ODBC Driver 11 for SQL Server]COUNT field incorrect or syntax error at C:\wamp\www\m\project\vendor\doctrine\dbal\lib\Doctrine\DBAL\DBALException.php:119, Doctrine\DBAL\Driver\PDOException(code: 07002): SQLSTATE[07002]: [Microsoft][ODBC Driver 11 for SQL Server]COUNT field incorrect or syntax error at C:\wamp\www\m\project\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOStatement.php:93, PDOException(code: 07002): SQLSTATE[07002]: [Microsoft][ODBC Driver 11 for SQL Server]COUNT field incorrect or syntax error at C:\wamp\www\m\project\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOStatement.php:91)"} []

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment