PHP 4.0 Bug #5458: odbc_prepare crashes calling MSSQL stored procedures
| From: | santiago dot holgado at telesoft dot es | Date: | Sat, 08 Jul 2000 12:09:33 +0000 |
| Subject: | PHP 4.0 Bug #5458: odbc_prepare crashes calling MSSQL stored procedures | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-23800@lists.php.net to get a copy of this message | ||
From: santiago.holgado@telesoft.es
Operating system: Windows NT 4.0 SP6
PHP version: 4.0 Release Candidate 2
PHP Bug Type: ODBC related
Bug description: odbc_prepare crashes calling MSSQL stored procedures
PHP 4.0.1pl2 Win32 CGI (the one in php.net) under IIS4
I'm using ODBC support to access MS SQL Server databases by querying stored procedures. The way
to call those is the next one:
{CALL sp(param1, param2)}
written into {}. The following code (and similar calls) worked in PHP 3.0.16, but now the following
sentence
if (($Resultset = odbc_prepare($Conexion, "{CALL chkUserName(?)}")) == false) {
die("Error");
}
ends with a Fatal: emalloc()
Replacing ? with a parameter works fine.
I will also point that the automatic parameter binding done in odbc_execute, causes that I
can't return values using parameters
{? = CALL sp(?,?)}
This is a valid SQL Server sentence which allows returning a code, and it's done by binding a
parameter using OUTPUT or RETURN instead of INPUT. I remember also that the parameter binding done
only binded strings (that was PHP 3.0.16)
As pointed in another bug, I'll recomend adding a odbc_bindparameter function with 4 params:
prepared statement, argument, sql data type, input/output. Parameter order can be checked with
Microsoft documentation.