|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-12-31 00:12 UTC] cmb@php.net
-Package: Feature/Change Request
+Package: ODBC related
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 08:00:01 2025 UTC |
Description: ------------ It would be fantastic if one could use the Unified ODBC functions to bind output parameters. We would like to be able to simply odbc_prepare any and all SQL Server queries we run in our PHP code as a best practice. The only info I've found is an old message saying to use mssql_* functions instead. Well, those are limiting in their own ways (FreeTDS), and having to switch between the two in order to handle all queries is not very practical/convenient/clean/elegant/managable/maintainable/etc. The old message also said that there are no plans to implement this since it is complicated and DBMS dependent. Is this still the stance PHP is taking? Having worked with the odbc driver vendor we feel certain that this is an issue with the Unified ODBC functions. Reproduce code: --------------- $dbh = odbc_connect($dsn,$DSN_USER,$DSN_PASS) or exit("cannot connect!"); $sql = " DECLARE @returncode INT; @returncode = {CALL [dbo].[alan_test_proc](?, ?, ?, ?, ?)}; SELECT @returncode as returncode; "; $data = array("testtext", "4", "2006-03-01", "1", "1.34"); $prepared = odbc_prepare($dbh, $sql) or exit ("Cannot prepare."); $result = odbc_execute($prepared, $data) or exit("Cannot exec."); print "errorcode: ".odbc_result($prepared, 'errorcode'); odbc_free_result($result); odbc_close($dbh); Expected result: ---------------- In this case the stored procedure will return a 0 or a 1. I can provide the SQL code in the stored procedure if necessary. Actual result: -------------- SQL error: [DataDirect][ODBC SQL Server Driver]COUNT field incorrect, SQL state 07001 in SQLExecute