From: Chris W. <ch...@cw...> - 2003-10-29 12:49:38
|
Igor Vylusko wrote: > please advice, what is the native (OpenInteract/SPOPS) way > to use/create transactions and stored procedures > with DBs which support its? There's no built-in way to support this, so you'll have to do some manual work: * wherever you want transactions you need to set $dbh->{AutoCommit} = 0 * if something fails you'll need to tell the handle that you're committing/rolling back. You can get at the handle in two ways: # get handle through $R eval { $some_object->save }; if ( $@ ) { $R->db->rollback; } # get handle through SPOPS object eval { $some_object->save }; if ( $@ ) { $some_object->global_datasource_handle->rollback; } With stored procedures you can use your normal DBI calling routines, just grabbing the database handle in one of the ways listed above: my $dbh = $R->db; my ( $sth ); eval { $sth = $dbh->prepare( 'exec some_proc' ); $sth->execute; }; if ( $@ ) { die "Something horrible happened: $@\n"; } Apologies for the delay in replying. Chris -- Chris Winters (ch...@cw...) Building enterprise-capable snack solutions since 1988. |