aboutsummaryrefslogtreecommitdiff
path: root/perl/Wallet/Database.pm
diff options
context:
space:
mode:
authorJon Robertson <jonrober@stanford.edu>2012-12-02 22:07:16 -0800
committerRuss Allbery <rra@stanford.edu>2013-01-30 18:33:23 -0800
commit593e9b1e100ace54d1d9da7eb16e60f4e37c34ff (patch)
tree6d29f76135fff795f6a15f9b379fc6dee72d14f0 /perl/Wallet/Database.pm
parent6530fb472f1c64d3e80c723d3073ca3d256a58ce (diff)
Moved the Perl wallet modules and tests to DBIx::Class
Moved all the Perl code to use DBIx::Class for the database interface. This includes updating all database calls, how the schema is generated and maintained, and the tests in places where some output has changed. We also remove the schema.t test, as the tests for it are more covered in the admin.t tests now. Change-Id: Ie5083432d09a0d9fe364a61c31378b77aa7b3cb7 Reviewed-on: https://gerrit.stanford.edu/598 Reviewed-by: Russ Allbery <rra@stanford.edu> Tested-by: Russ Allbery <rra@stanford.edu>
Diffstat (limited to 'perl/Wallet/Database.pm')
-rw-r--r--perl/Wallet/Database.pm27
1 files changed, 8 insertions, 19 deletions
diff --git a/perl/Wallet/Database.pm b/perl/Wallet/Database.pm
index 7daab9f..8df338a 100644
--- a/perl/Wallet/Database.pm
+++ b/perl/Wallet/Database.pm
@@ -1,12 +1,12 @@
# Wallet::Database -- Wallet system database connection management.
#
-# This module is a thin wrapper around DBI to handle determination of the
-# database driver and configuration settings automatically on connect. The
+# This module is a thin wrapper around DBIx::Class to handle determination
+# of the database configuration settings automatically on connect. The
# intention is that Wallet::Database objects can be treated in all respects
-# like DBI objects in the rest of the code.
+# like DBIx::Class objects in the rest of the code.
#
# Written by Russ Allbery <rra@stanford.edu>
-# Copyright 2008, 2010 Board of Trustees, Leland Stanford Jr. University
+# Copyright 2008-2012 Board of Trustees, Leland Stanford Jr. University
#
# See LICENSE for licensing terms.
@@ -14,32 +14,21 @@
# Modules and declarations
##############################################################################
-# Set up the subclasses. This is required to avoid warnings under DBI 1.40
-# and later, even though we don't actually make use of any overridden
-# statement handle or database handle methods.
-package Wallet::Database::st;
-use vars qw(@ISA);
-@ISA = qw(DBI::st);
-
-package Wallet::Database::db;
-use vars qw(@ISA);
-@ISA = qw(DBI::db);
-
package Wallet::Database;
require 5.006;
use strict;
use vars qw(@ISA $VERSION);
-use DBI;
+use Wallet::Schema;
use Wallet::Config;
-@ISA = qw(DBI);
+@ISA = qw(Wallet::Schema);
# This version should be increased on any code change to this module. Always
# use two digits for the minor version with a leading zero if necessary so
# that it will sort properly.
-$VERSION = '0.03';
+$VERSION = '0.04';
##############################################################################
# Core overrides
@@ -65,7 +54,7 @@ sub connect {
}
my $user = $Wallet::Config::DB_USER;
my $pass = $Wallet::Config::DB_PASSWORD;
- my %attrs = (PrintError => 0, RaiseError => 1, AutoCommit => 0);
+ my %attrs = (PrintError => 0, RaiseError => 1);
my $dbh = eval { $class->SUPER::connect ($dsn, $user, $pass, \%attrs) };
if ($@) {
die "cannot connect to database: $@\n";