136 reputation
6
bio website trevorburnham.com
location Cambridge, MA
age 29
visits member for 3 years, 7 months
seen Mar 7 '11 at 16:54

Jul
7
awarded  Autobiographer
Mar
7
revised MySQL client believes they're in a transaction, gets KILLed, wreaks havoc
Fewer caveats; I have more confidence in this approach now
Mar
7
revised MySQL client believes they're in a transaction, gets KILLed, wreaks havoc
Replacing ActiveRecord example with one-paragraph summary of answers so far
Mar
7
accepted MySQL client believes they're in a transaction, gets KILLed, wreaks havoc
Mar
7
awarded  Teacher
Mar
7
answered MySQL client believes they're in a transaction, gets KILLed, wreaks havoc
Mar
7
comment MySQL client believes they're in a transaction, gets KILLed, wreaks havoc
Yes, I realize that you mentioned putting the transaction in a program. However, you also suggested that to safely run a transaction interactively, I'd have to "dupe it out to a testing database." I wanted to point out that interactive transactions can be done safely from irb, Ruby's command-line utility.
Mar
5
answered MySQL client believes they're in a transaction, gets KILLed, wreaks havoc
Mar
4
awarded  Editor
Mar
4
revised MySQL client believes they're in a transaction, gets KILLed, wreaks havoc
Updated to add Ruby ActiveRecord example
Mar
4
comment MySQL client believes they're in a transaction, gets KILLed, wreaks havoc
That's a good suggestion. Thanks.
Mar
4
comment MySQL client believes they're in a transaction, gets KILLed, wreaks havoc
It's just that it feels nice to start a transaction, make some changes, then explore a bit to see what the ramifications of those changes were before deciding to commit the transaction. I've accepted your answer, but it would be cool if there were a way to safely do this.
Mar
4
awarded  Scholar
Mar
4
awarded  Supporter
Mar
4
comment MySQL client believes they're in a transaction, gets KILLed, wreaks havoc
Thanks, this is a good answer. Even on the command line, starting your operation with CREATE PROCEDURE, and putting a transaction within that procedure block, ensures safety. It does have the unfortunate side effect of hampering interactivity, though. Is there any way to say "Run this query if I'm within a transaction" in MySQL?
Mar
4
awarded  Student
Mar
4
asked MySQL client believes they're in a transaction, gets KILLed, wreaks havoc