php.net |  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
Votes:1
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: alantak at uchicago dot edu
New email:
PHP Version: OS:

 

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-31 00:12 UTC] cmb@php.net
-Package: Feature/Change Request +Package: ODBC related
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 17:01:29 2024 UTC