From: | Adriaan Joubert <a(dot)joubert(at)albourne(dot)com> |
---|---|
To: | |
Cc: | Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>, pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Re: [HACKERS] Re: [SQL] inserts/updates problem under stressing ! |
Date: | 1999-07-26 06:57:18 |
Message-ID: | 379C06CE.70797269@albourne.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-sql |
> >
> > 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
From | Date | Subject | |
---|---|---|---|
Next Message | Ansley, Michael | 1999-07-26 07:47:55 | RE: [HACKERS] RE: [INTERFACES] Re: SSL patch |
Previous Message | Oleg Bartunov | 1999-07-26 06:49:11 | Re: [SQL] inserts/updates problem under stressing ! |
From | Date | Subject | |
---|---|---|---|
Next Message | Christian Rudow | 1999-07-26 09:09:07 | NOT IN clause performing badly |
Previous Message | Oleg Bartunov | 1999-07-26 06:49:11 | Re: [SQL] inserts/updates problem under stressing ! |