Commit info for scoop/lib/Scoop:
Modified Files:
Tag: CURRENT
DB.pm
Log Message:
This should repair the rest of the damage from syncing CURRENT with the main Scoop branch. -j
Index: DB.pm
===================================================================
RCS file: /cvs/scoop/scoop/lib/Scoop/DB.pm,v
retrieving revision 1.21.2.3
retrieving revision 1.21.2.4
diff -r1.21.2.3 -r1.21.2.4
287c287
< if ($args->{DEBUG} || $DEBUG) {warn "in db_unlock_tables: Query is $query\n"};
---
> if ($args->{DEBUG} || $DEBUG) {warn "in db_unlock_tables: Query is $query\n";}
301a302,388
> }
>
> # Add functions for transactions. Can only be used with versions of mysql
> # that use transactions, of course.
>
> sub db_start_transaction {
> my $S = shift;
> my $args = shift;
>
> unless ($S->{CONFIG}->{mysql_version} =~ /^4/) {
> return "Transactions not supported in this version of MySQL.\n";
> }
> $Scoop::DB_QUERY_COUNT++ if ($Scoop::COUNT_DEBUG);
>
> my $query = "START TRANSACTION";
>
> if ($args->{DEBUG} || $DEBUG) {warn "in db_start_transaction: Query is $query\n";}
>
> my $dbh;
> if ($args->{ARCHIVE}) {
> $dbh = $S->{DBHARCHIVE};
> } else {
> $dbh = $S->{DBH};
> }
> return('0E0',undef) unless ($dbh);
>
> my $sth = $dbh->prepare($query);
> my $rv = $sth->execute();
>
> warn "<<ERROR>> in db_start_transaction: $DBI::errstr (Query is $query)\n" unless $rv;
> return ($rv, $sth);
> }
>
> sub db_commit {
> my $S = shift;
> my $args = shift;
>
> unless ($S->{CONFIG}->{mysql_version} =~ /^4/) {
> return "Transactions not supported in this version of MySQL.\n";
> }
> $Scoop::DB_QUERY_COUNT++ if ($Scoop::COUNT_DEBUG);
>
> my $query = "COMMIT";
>
> if ($args->{DEBUG} || $DEBUG) {warn "in db_commit: Query is $query\n";}
>
> my $dbh;
> if ($args->{ARCHIVE}) {
> $dbh = $S->{DBHARCHIVE};
> } else {
> $dbh = $S->{DBH};
> }
> return('0E0',undef) unless ($dbh);
>
> my $sth = $dbh->prepare($query);
> my $rv = $sth->execute();
>
> warn "<<ERROR>> in db_commit: $DBI::errstr (Query is $query)\n" unless $rv;
> return ($rv, $sth);
> }
>
> sub db_rollback {
> my $S = shift;
> my $args = shift;
>
> unless ($S->{CONFIG}->{mysql_version} =~ /^4/) {
> return "Transactions not supported in this version of MySQL.\n";
> }
> $Scoop::DB_QUERY_COUNT++ if ($Scoop::COUNT_DEBUG);
>
> my $query = "ROLLBACK";
>
> if ($args->{DEBUG} || $DEBUG) {warn "in db_rollback: Query is $query\n";}
>
> my $dbh;
> if ($args->{ARCHIVE}) {
> $dbh = $S->{DBHARCHIVE};
> } else {
> $dbh = $S->{DBH};
> }
> return('0E0',undef) unless ($dbh);
>
> my $sth = $dbh->prepare($query);
> my $rv = $sth->execute();
>
> warn "<<ERROR>> in db_rollback: $DBI::errstr (Query is $query)\n" unless $rv;
> return ($rv, $sth);