php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #74592 prepared statement support
Submitted: 2017-05-15 07:58 UTC Modified: -
Votes:3
Avg. Score:4.7 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:1 (33.3%)
From: adambaratz@php.net Assigned:
Status: Open Package: PDO DBlib
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
39 + 31 = ?
Subscribe to this entry?

 
 [2017-05-15 07:58 UTC] adambaratz@php.net
Description:
------------
DBlib doesn't directly support prepared statements, but could get most of the way there using some generic stored procedures.

T-SQL offers sp_executesql:
https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-executesql-transact-sql

Sybase has options of its own:
http://stackoverflow.com/questions/5680960/equivalent-to-sp-executesql-in-sybase

These could likely be used in conjunction with dbbind(). If so, this would eliminate this extension's hard requirement for emulated prepares. Testing with SQL Server has shown that execution plans for queries executed with sp_executesql can be reused when the parameters change.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-02-27 08:23 UTC] mikey at kiernan dot tech
Hi there,

We experience the same behaviour using pdo_dblib.
We are unsure of exactly why, but we've had to migrate to pdo_sqlsrv.

There are a few SO threads about this:
- https://stackoverflow.com/questions/42982136/laravel-mssql-adhoc-queries-instead-of-prepared
- https://stackoverflow.com/questions/38338596/non-emulated-prepared-statement-support-from-ms-sql-server-through-php-on-linux
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Oct 25 06:03:33 2021 UTC