Hi,
I have an error with mysql adapter when where is two statment in the
same sql execution.
I don’t have this error with postgres adapter.
If I perform, on the console, this “stupide” code :
db = ctiveRecord::Base.connection
db.execute(" db.execute(“CREATE TABLE toto (id int); DROP TABLE toto;”)
I have the error :
//////////////////
ActiveRecord::StatementInvalid: Mysql::Error: You have an error in your
SQL syntax; check the manual that corresponds to your MySQL server
version for the right syntax to use near ‘DROP TABLE toto’ at line 1:
CREATE TABLE toto (id int); DROP TABLE toto;
from
/Library/WebServer/Documents/RubyTimeNetV2/vendor/plugins/rows_logger/init.rb:36:in
log' from /Library/WebServer/Documents/RubyTimeNetV2/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:304:in
execute_without_query_stats’
from
/Library/WebServer/Documents/RubyTimeNetV2/vendor/plugins/query_stats/lib/query_stats/recorder.rb:16:in
execute' from /Library/WebServer/Documents/RubyTimeNetV2/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:8:in
realtime’
from
/Library/WebServer/Documents/RubyTimeNetV2/vendor/plugins/query_stats/lib/query_stats/recorder.rb:15:in
`execute’
from (irb):116
////////////////
If I separate the two (stupids) statment, no error :
db.execute(“CREATE TABLE toto (id int);”)
=> nildb.execute(“DROP table toto;”)
=> nil
Thanks
Laurent