Re: [HACKERS] Re: [SQL] inserts/updates problem under stressing !

Поиск
Список
Период
Сортировка
От Adriaan Joubert
Тема Re: [HACKERS] Re: [SQL] inserts/updates problem under stressing !
Дата
Msg-id 379C06CE.70797269@albourne.com
обсуждение исходный текст
Ответ на Re: [SQL] inserts/updates problem under stressing !  (Oleg Bartunov <oleg@sai.msu.su>)
Список pgsql-hackers
> >
> > my $sth = $dbh->do("LOCK TABLE hits IN SHARE ROW EXCLUSIVE MODE");
> > my $sth = $dbh->do("SELECT acc_hits($1)") || die $dbh->errstr;
> >
> > am I right ?
> 
> You should run LOCK and SELECT inside BEGIN/END (i.e. in
> the same transaction), do you?

Yes, in DBI that translates to switching AutoCommit off, and doing an
explicit commit, (roughly)
$dbh->{AutoCommit} = 0;eval {  $dbh->do (...)  ...};if ($@) {   // There was an error   $dbh->rollback();    } else {
$dbh->commit();      }
 

I think you need to set RaiseError=>1 as well when connecting to the
database, to get die's inside the eval.

Adriaan


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Oleg Bartunov
Дата:
Сообщение: Re: [SQL] inserts/updates problem under stressing !
Следующее
От: "Ansley, Michael"
Дата:
Сообщение: RE: [HACKERS] RE: [INTERFACES] Re: SSL patch