MySQL, odbc_prepare & parameters

wxdqz

New Member
Hi all,

Are prepared queries with parameters supported on MySQL under ODBC(MyODBC)? When I attempt to use them, I get:

FATAL: emalloc(): Unable to allocate 268667055 bytes

whenever a odbc_prepare() call is made where the query string contains a parameter placeholder (i.e. the ? character) This problem occurrs under both Apache and when running PHP stand-alone. Non-parameterized queries work fine, using both odbc_prepare()/odbc_execute() and odbc_exec()

From what I can see, the emalloc() problem appears to be caused through the flow-on effects of a failed SQLNumResultCols() call. In the SQL log, I can see an SQLPrepare() and SQLNumParams() succeeding, however a SQLNumResultCols() is failing, due to SQLBindParameter() not being called for the parameters yet.

Looking at the code for odbc_prepare(), there are two ODBC API calls which do not have their status codes checked (php_odbc.c:812-813) although the return value of the second is used in odbc_bindcols() (php_odbc.c:548-549)

Now, as to whether MySQL supports this at all... :-)

I am using:
Windows NT 4.0 SP4
PHP 4.0.4pl1
MyODBC 2.50.33
MySQL 3.23.33

Tony Gedge.
 
Back
Top