From:             alantak at uchicago dot edu
Operating system: Linux
PHP version:      5.2.2
PHP Bug Type:     Feature/Change Request
Bug description:  Lack of ability to bind output parameters in PHP Unified ODBC 
functions

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

-- 
Edit bug report at http://bugs.php.net/?id=41329&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=41329&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=41329&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=41329&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=41329&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=41329&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=41329&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=41329&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=41329&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=41329&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=41329&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=41329&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=41329&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=41329&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=41329&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=41329&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=41329&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=41329&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=41329&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=41329&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=41329&r=mysqlcfg

Reply via email to