> > > > Problem is that through various DB APIs such as DBI, you can't
> > > > garuntee to the user doing development that that it's the 1st command
> > > > that they're performing.
> > > 
> > > OK, but why does my suggestion not work:
> > > 
> > >   SET autocommit = ON;
> > >   COMMIT;
> > 
> > Hrm... if I changed the DBI layer for Ruby to have:
> > 
> > db['AutoCommit'] = true
> > 
> > use 'SET autocommit = ON; COMMIT;' I think I'd be breaking tons of
> > applications where they wouldn't be expecting the commit.
> 
> Actually, the current approved way is:
> 
>       BEGIN; SET autocommit = ON; COMMIT;

db.transaction do |dbh|
  db.do('DELETE FROM tbl WHERE id = 5')
  db['AutoCommit'] = true
end

Because there wasn't a commit given, that shouldn't actually delete
the rows found, but by tossing that AutoCommit in there, it should and
will generate a nifty warning if AutoCommit sends the above
BEGIN/SET/COMMIT.  -sc

-- 
Sean Chittenden

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to