ODBC/Stored procedures fix
| From: | (Lars Thomas Denstad) | Date: | Thu, 11 Nov 1999 00:53:28 +0000 |
| Subject: | ODBC/Stored procedures fix | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-6127@lists.php.net to get a copy of this message | ||
I mentioned in an earlier post that I had problems with php crashing when I
tried to call a stored procedure that had output-parameters. I've fixed it
in php_odbc.c, it passes it back to the array instead of crashing. This is
my first exposure to PHP backend-stuff, and I'm not sure if all resource
management is taken care of correctly and things like that. Also, I took the
liberty of designing a "syntax" for parameters that should be able to take
returning data.
I'm not part of the development team and I don't have write access to CVS,
so I just attached the implementation of the function to this email.
If you could look over it and also include the functionality in the next
release (or even beta-release) that would be nice.
Description of problem (Some assumtions I make could be wrong):
The current odbc_execute binds wrong addresses to query, this makes stored
procedures that return a value overwrite protected data. This only
malfunctions using Oracles drivers. It is impossible to call stored
procedures using Microsofts ODBC-drivers if the stored procedure has out
parameters.
Fix:
Declare the arrays as follows:
$params = array(
"This is an in parameter",
"&", // This is an out-parameter only
"&This is an in/out-parameter" // The "&" is stripped before the data
is
passed.
);
I haven't done extensive testing, but it seems to be working ok. Tested
using Oracle ODBC drivers.
LT.
Attachment: [application/octet-stream] php_odbc_execute.c
Attachment: [application/octet-stream] php_odbc_execute.c