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 'RELEASE SAVEPOINT active_record_1' at line 1: RELEASE SAVEPOINT active_record_1 a rails ticket concerning this error which was marked invalid: https://rails.lighthouseapp.com/projects/8994/tick... another rails doc concerning issue: http://github.com/lifo/docrails/commit/0e6b9695aff... Good grief! Apparently any nested transaction (ex. a create statement inside a test) will fail if you're using MySQL. still fighting it. If you create an ActiveRecord object in one 'it' block, it's still there in the next block ?!? The only workaround I've found for the MySQL's unsupported nested transactions is the following: User.transaction do user1 = User.create(:name => "Alice") User.transaction(:requires_new => true) do user2 = User.create(:name => "Bob") end end This is actually emulated using save points because most databases do not support nested transactions. Some databases (SQLite) donâ€™t support either save points or nested transactions, so in that case this works just like Rails 2.2 where the inner transaction(s) have no effect and if there are any exceptions the entire transaction is rolled back. PLUGIN SOLUTIONS that DON'T fix spec issues: http://svn.viney.net.nz/things/rails/plugins/savepoints/ http://github.com/spint/savepoints/tree/master (github version with added support for oracle) HELP, RSPEC COMMUNITY!!!
on 2009-04-18 00:37
on 2009-04-19 01:16
On Fri, Apr 17, 2009 at 6:36 PM, john <firstname.lastname@example.org> wrote: > Good grief! The issue seems to not be ActiveRecord, but limitations of MySQL. Elia Schito gave a good explanation IMO on the rails ticket. > > Apparently any nested transaction (ex. a create statement inside a test) > will fail if you're using MySQL. > still fighting it. If you create an ActiveRecord object in one 'it' block, > it's still there in the next block ?!? Do you have transactional fixtures turned off? The following works fine with Rails 2.3.2: http://gist.github.com/97819 Can you provide more information about your problem? You didn't really show us what you were doing, and what you thought was failing, and what you actually expected. > support nested transactions. Some databases (SQLite) don’t support either > > HELP, RSPEC COMMUNITY!!! > _______________________________________________ > rspec-users mailing list > email@example.com > http://rubyforge.org/mailman/listinfo/rspec-users > -- Zach Dennis http://www.continuousthinking.com http://www.mutuallyhuman.com