Re: SET autocommit begins transaction?
| От | Sean Chittenden |
|---|---|
| Тема | Re: SET autocommit begins transaction? |
| Дата | |
| Msg-id | 20020918220222.GC15390@perrin.int.nxad.com обсуждение исходный текст |
| Ответ на | Re: SET autocommit begins transaction? (Bruce Momjian <pgman@candle.pha.pa.us>) |
| Ответы |
Re: SET autocommit begins transaction?
|
| Список | 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
В списке pgsql-bugs по дате отправления: