Open
Description
openedon Mar 13, 2018
Driver version or file name
5.2.0.0
SQL Server version
Microsoft SQL Server 2016 Standard (64-bit)
Version 13.0.4001.0
Client operating system
Windows 10
PHP version
PHP 7.1
Microsoft ODBC Driver version
ODBC Driver 17 for SQL Server
Table schema
Users (UserID, Username)
BannedUsers(UserID, BannedType, Date)
Problem description
With ColumnEncryption set to Enabled, I get the error
[Microsoft][ODBC Driver 17 for SQL Server]Syntax error, permission violation, or other nonspecific error
When I run queries with named parameters in sub query. The same code runs perfectly when ColumnEncryption is exempted or set to Disabled.
Expected behavior and actual behavior
This works
select * from Users where Username =:username
but this doesn't
select * from Users where Username=:username and UserID not in (select UserID from BannedUsers where BannedType = :type )
Repro code
$conn = new PDO('sqlsrv:server=srv;database=db;ColumnEncryption=Enabled', 'user', 'password', []);
$tSql = "select * from Users where Username=:username and UserID not in (select UserID from BannedUsers where BannedType = :type )";
$stmt = $conn->prepare($tSql);
$stmt->bindValue(':username', 'u', PDO::PARAM_STR);
$stmt->bindValue(':type', 2, PDO::PARAM_INT);
$stmt->execute();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment