Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated PDO_SQLSRV connection to use driverOptions in prepare-function #6577

Open
DAdq26 opened this issue Oct 29, 2024 · 1 comment
Open

Comments

@DAdq26
Copy link

DAdq26 commented Oct 29, 2024

Hi team,

Bug Report

Previously closed issue #2185 on the same subject does not exist anymore in version 3.x
Actually the simple script above

$database = "mybase";
$server = "mssql";
$conn = new PDO( "sqlsrv:server=$server ; MultipleActiveResultSets=false; Database = $database", "", "");

$query = "select * from mytable";
$stmt = $conn->prepare($query);
$stmt->execute();

print "Row count : ";
print $stmt->rowCount();

returns everytime -1 because we cannot use PDO::ATTR_CURSOR attribute when we used native prepare

After debugging inside DBAL with PDO_SqlSrv wrapper we discover that prepare cannot be override like in the first issue with driverOptions
It's essential to use native Pdo::prepare($stmt, $options) to precise scrollable cursor to make it works..

$stmt = $conn->prepare($query, array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL));

Perhaps we have not seen any option or configuration, but runtime code does not seems to modify native prepare method in
doctrine/dbal/src/Driver/PDO/Connection.php line 55 on version 3.6.6

image

If you have any advice or fix to get back $driverOptions config as in #2185, it would be perfect

Best

@derrabus
Copy link
Member

Sorry, but I don't understand this bug report. Please explain to me:

  • What are you trying to do?
  • How are you attempting to do that using DBAL APIs only?
  • What did you expect to happen?
  • What happens instead?

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

No branches or pull requests

2 participants