Traja,

Yes, that would work. That's the whole purpose of commit;

Mark


----- Original Message ----- 
From: "traja" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 04, 2001 11:46 PM
Subject: executing atomic transactions in DBI


> Hi,
> 
> I have 2 insert statements which insert data into two different tables.
> These 2 inserts need to be run atomically, How can I do this?
> If I commit at the end of the two inserts, would that work?
> 
> $sth = $dbh->prepare("
>                  insert into main(main_id, domain_id, font_size,
>                                 max_width_chars, max_width_pixels)
>                                values(main_id_seq.nextval, $domain_id,
> 12,0,0)"
>            ) || die $dbh->errstr;
> 
> $sth->execute || die $dbh->errstr;
> 
>  $sth = $dbh->prepare("
>            insert into language(language_id,main_id, language,
>                          string,translation_req)
>        values(language_id_seq.nextval, main_id_seq.currval,
>                                      'eng', $str, 1)"
>    ) || die $dbh->errstr;
>  $sth->execute || die $dbh->errstr;
> 
> 

Reply via email to