From: | Sean Chittenden <sean(at)chittenden(dot)org> |
---|---|
To: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: SET autocommit begins transaction? |
Date: | 2002-09-18 22:02:22 |
Message-ID: | 20020918220222.GC15390@perrin.int.nxad.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
> > > > 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
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2002-09-18 22:05:58 | Re: SET autocommit begins transaction? |
Previous Message | Bruce Momjian | 2002-09-18 21:59:14 | Re: SET autocommit begins transaction? |