|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #41329 Lack of ability to bind output parameters in PHP Unified ODBC functions
Submitted: 2007-05-08 17:58 UTC Modified: 2016-12-31 00:12 UTC
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: alantak at uchicago dot edu Assigned:
Status: Open Package: ODBC related
PHP Version: 5.2.2 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2007-05-08 17:58 UTC] alantak at uchicago dot edu
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');



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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-31 00:12 UTC]
-Package: Feature/Change Request +Package: ODBC related
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 23 07:01:28 2024 UTC