Open aprescott opened 11 years ago
Please include the version of mysql2 gem, mysql server, ruby, etc. that you are using.
mysql --version
gives "mysql Ver 14.14 Distrib 5.5.25a, for osx10.7 (i386) using readline 5.1" (installed with Homebrew if that's relevant).Thanks! All very up-to-date, could you try mysql2 0.3.12b6? There are some changes to multistatement support that may help.
No such luck. Same problem.
sql
contains a bunch ofCREATE TABLE
statements and a fewINSERT
s.The
:async => false
is explicitly set to remove any doubt about it being in effect.With the above code,
client.query
returnsnil
immediately (no errors or any other indication of failure) and the Rake task finishes normally, but the tables insql
haven't finished being created. If you look atshow tables
from a command-line MySQL client every few seconds, the tables are being created in the background.The behaviour I was expecting is
query
to block until all statements have finished, which is what I thoughtMULTI_STATEMENT
with:async => false
does.Other people seem to be having this same issue: http://stackoverflow.com/questions/14914314/ruby-mysql2-error-when-executing-statements-in-rapid-succession