diff options
author | Russ Allbery <rra@stanford.edu> | 2007-12-01 03:03:29 +0000 |
---|---|---|
committer | Russ Allbery <rra@stanford.edu> | 2007-12-01 03:03:29 +0000 |
commit | 0d517a8c575774387393513ca196aa27211a0b0b (patch) | |
tree | 4e81d852771632f21bfe65370d37bd403211d997 | |
parent | 6bd2cd0824130bd25918e2b709d0991003d5d392 (diff) |
Following the DBI documentation, turn on AutoCommit after RaiseError so
that we have some hope of getting error messages if it fails.
-rw-r--r-- | perl/Wallet/ACL.pm | 4 | ||||
-rw-r--r-- | perl/Wallet/Object/Base.pm | 4 | ||||
-rw-r--r-- | perl/Wallet/Server.pm | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/perl/Wallet/ACL.pm b/perl/Wallet/ACL.pm index bc318a1..12b3f7c 100644 --- a/perl/Wallet/ACL.pm +++ b/perl/Wallet/ACL.pm @@ -41,9 +41,9 @@ $VERSION = '0.02'; # doesn't exist, throws an exception. sub new { my ($class, $id, $dbh) = @_; - $dbh->{AutoCommit} = 0; $dbh->{RaiseError} = 1; $dbh->{PrintError} = 0; + $dbh->{AutoCommit} = 0; my ($sql, $data, $name); if ($id =~ /^\d+\z/) { $sql = 'select ac_id, ac_name from acls where ac_id = ?'; @@ -77,9 +77,9 @@ sub create { if ($name =~ /^\d+\z/) { die "ACL name may not be all numbers\n"; } - $dbh->{AutoCommit} = 0; $dbh->{RaiseError} = 1; $dbh->{PrintError} = 0; + $dbh->{AutoCommit} = 0; $time ||= time; my $id; eval { diff --git a/perl/Wallet/Object/Base.pm b/perl/Wallet/Object/Base.pm index 2fe6ed9..bc9fc1e 100644 --- a/perl/Wallet/Object/Base.pm +++ b/perl/Wallet/Object/Base.pm @@ -36,9 +36,9 @@ $VERSION = '0.02'; # probably be usable as-is by most object types. sub new { my ($class, $type, $name, $dbh) = @_; - $dbh->{AutoCommit} = 0; $dbh->{RaiseError} = 1; $dbh->{PrintError} = 0; + $dbh->{AutoCommit} = 0; my $sql = 'select ob_name from objects where ob_type = ? and ob_name = ?'; my $data = $dbh->selectrow_array ($sql, undef, $type, $name); $dbh->commit; @@ -58,9 +58,9 @@ sub new { # in the object. Subclasses may need to override this to do additional setup. sub create { my ($class, $type, $name, $dbh, $user, $host, $time) = @_; - $dbh->{AutoCommit} = 0; $dbh->{RaiseError} = 1; $dbh->{PrintError} = 0; + $dbh->{AutoCommit} = 0; $time ||= time; die "invalid object type\n" unless $type; die "invalid object name\n" unless $name; diff --git a/perl/Wallet/Server.pm b/perl/Wallet/Server.pm index 37a4e0f..e1655ff 100644 --- a/perl/Wallet/Server.pm +++ b/perl/Wallet/Server.pm @@ -61,9 +61,9 @@ sub _open_db { if (not defined $dbh) { die "cannot connect to database: $DBI::errstr\n"; } - $dbh->{AutoCommit} = 0; $dbh->{RaiseError} = 1; $dbh->{PrintError} = 0; + $dbh->{AutoCommit} = 0; return $dbh; } |