php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18057 I can't receive value from Stroed Procedure
Submitted: 2002-06-28 21:59 UTC Modified: 2002-07-23 11:37 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: smg at hktl dot com Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.2.1 OS: Windows 98/ME/200,Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: smg at hktl dot com
New email:
PHP Version: OS:

 

 [2002-06-28 21:59 UTC] smg at hktl dot com
Hi.
first, my english is not good but I believe you are understand about  my
english.

I can't receive return value from DB2/400 Stroed Procedure.  next source
<?
$db_conn=odbc_connect("DSNBSN400","WEBUSER","WEBUSER")  or die ( odbc_error
() );
$result=odbc_prepare($db_conn,"Call  WEBLIB.TEST_SP01(?,?)");
$par[0]=11;$par[1]='';
if(!odbc_execute($result,&$par))
{
print("The odbc statement failed to execute! ");
}
print_r($par);
?>

I want to receive Return  Value.


good job

bye


ps : I using to IBM AS/400 DB2 UDB

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-15 08:11 UTC] erik at ableson dot homeip dot net
I have something similar which I've distilled to a simpler problem with the DB2/ODBC drivers although my DB2 instance is running on an AS400 as well, so it may be part of the problem.

Basically, I cannot retrieve any data from DB2.  It properly connects, issues the query but consistently returns 0 rows.  Forcing a bad password correctly returns an authentication error and creating an invalid SQL query correctly returns an error as well.  From the amount of time required to return the page, it appears to be issuing the query and waiting on the response.  Complex ugly queries take a long time to process but always result in zero rows returned.

Code sample used to force at least a one row return which returns 1 field, 0 rows:
<?php

$dbconn = odbc_connect ( "DSN", "USER", "PASSWORD");

echo "Connected to: $dbconn<br>";
$sqlresult = odbc_exec( $dbconn, "SELECT COUNT(*) AS TOTAL FROM RU99.RC545 WHERE SIGNONID='L6XJ'");
echo $sqlresult . "<BR>";

echo "Fields: " . odbc_num_fields ($sqlresult);
echo " Rows: " . odbc_num_rows ($sqlresult);

odbc_close($dbconn);

?>
 [2002-07-23 11:37 UTC] kalowsky@php.net
ODBCv2 does not work with procedures, sorry.  Please read the MS ODBC specification for more information regarding this at 
http://www.microsoft.com/data/odbc


 [2003-04-07 19:01 UTC] greg at tssolutions dot com dot au
Ok, I'll bit.

Sorry kalowsky@php.net ODBCv2 does!!! with with procedures.

If you look through this database for odbc_execute there are a number of issue mentioned, all to do with accessing stored procedures.

It may be that stored procedures in DB2/400 dont work, dont know.

But they should for SQLserver, and they should work for both input and OUTPUT parameters.  Clearly the ODBC imlementation for PHP does not work when calling a strored procedure when using parameters, thus it is bug.

The call syntax (for SQLserver0 can be 
"{ call x ( ? )}"
or 
"exec x ?"

And the paramter should be able to be input/output or both, not just input.

My question then is, what is the correct process to get this functionality fixed, it is already in the bugs database and well....

With the mssql functions, may be that code could be used within the ODBC code base to solve the problems.  It may also be the reason why the number of complaints re this have dropped.

So next time someone has a ODBC issue with stored procedures, just tell the the truth, PHP implementation is buggy, but they can use mssql or something else... 8-)))

gt
ex Digit with 20 years of Rdb
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 01 13:01:29 2024 UTC