Re: [Sqlrelay-discussion] can not 'use $db' ??
Brought to you by:
mused
|
From: Devananda <kar...@ya...> - 2006-07-22 17:12:30
|
David Muse wrote:
> I recently (since the last prerelease) updated the mysql code to only
> use mysql_stmt_prepare for certain queries and use the older style code
> for others. So far, it only uses the older style code for create/drop
> procedures statements, but I'll update the list.
>
> Dave
I pulled the latest source from CVS and this hasn't been added yet, so
here is a patch that corrects it.
Index: src/connections/mysql/mysqlconnection.C
===================================================================
RCS file:
/cvsroot/sqlrelay/sqlrelay/src/connections/mysql/mysqlconnection.C,v
retrieving revision 1.48
diff -r1.48 mysqlconnection.C
150c150
< return false;
---
> return true;
205,206c205,206
< storedproc.compile("^\\s*(create|CREATE|drop|DROP)\\s+"
< "(procedure|PROCEDURE|function|FUNCTION)\\s+");
---
> storedproc.compile(
>
"^\\s*(delete|DELETE|do|DO|insert|INSERT|replace|REPLACE|select|SELECT|set|SET|update|UPDATE)\\s+");
239c239
< if (storedproc.match(query)) {
---
> if (!storedproc.match(query)) {
Regards,
Devananda
>
> On Wed, 2006-06-21 at 13:17 -0700, Devananda wrote:
>> The problem seems to be line 260 in
>> connections/mysql/mysqlconnection.C:
>>
>> return !mysql_stmt_prepare(stmt,query,length);
>>
>> and the assumption that all queries can be run as prepared statements.
>> I looked briefly in the other connectors, and I see the same treatment
>> of queries (prepare them all). However, according to the MySQL
>> documentation, this can't be done for 5.0 :(
>>
>> See
>> http://dev.mysql.com/doc/refman/5.0/en/c-api-prepared-statements.html :
>> The following statements can be used as prepared statements:
>> CREATE TABLE, DELETE, DO, INSERT, REPLACE, SELECT, SET,
>> UPDATE, and most SHOW statements. Other statements are not
>> supported in MySQL 5.0.
>>
>> Regards,
>> Devananda
>>
>>
>>
>> Devananda wrote:
>>> This is particularly odd, I think....
>>>
>>> I've compiled the latest 0.38pre2 (along with the new rudiments), and my
>>> test scripts failed immediately with a strange error... I ran sqlrsh to
>>> verify, and sure enough, sqlrsh returns an error when I simply "use $db"
>>>
>>>
>>>> 0> show tables from test;
>>>> Tables_in_test
>>>> ==============
>>>> bin_test
>>>> fs
>>>> Rows Returned : 2
>>>> Fields Returned : 2
>>>> System time : 30000
>>>>
>>>> 0> use test;
>>>> This command is not supported in the prepared statement protocol yet
>>>>
>>>> Rows Returned : 0
>>>> Fields Returned : 0
>>>> System time : 30000
>>>>
>>>
>>> The same error message is returned for other commands, such as 'show
>>> slave status' and 'show create table'.
>>>
>>> This is all on a Fedora 3 server, talking to MySQL 5.0.18.
>>>
>>> Please let me know if there is anything I can do to help fix this, I
>>> would like to be able to put 0.38 into use on my development server (we
>>> need the inputBindBlob support that is lacking in 0.37).
>>>
>>> Regards,
>>> Devananda
>>>
>>>
|