summaryrefslogtreecommitdiffstats
path: root/Bugzilla/DB.pm
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2007-07-19 19:27:46 +0200
committermkanat%bugzilla.org <>2007-07-19 19:27:46 +0200
commit7261190b84649b8da49e9d512a6cf9e7f5cac06b (patch)
treeebff3ef75c89c9fe907402cdc47cc71f858c26a4 /Bugzilla/DB.pm
parent33f63df58557de8dbbb7a46eebf19a35e517d24a (diff)
downloadbugzilla-7261190b84649b8da49e9d512a6cf9e7f5cac06b.tar.gz
bugzilla-7261190b84649b8da49e9d512a6cf9e7f5cac06b.tar.xz
Bug 388765: Bugzilla::DB::db_new should accept attributes that *override* the default attributes
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> (module owner) a=mkanat
Diffstat (limited to 'Bugzilla/DB.pm')
-rw-r--r--Bugzilla/DB.pm38
1 files changed, 23 insertions, 15 deletions
diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm
index b42672398..b43b237eb 100644
--- a/Bugzilla/DB.pm
+++ b/Bugzilla/DB.pm
@@ -942,22 +942,28 @@ sub bz_rollback_transaction {
#####################################################################
sub db_new {
- my ($class, $dsn, $user, $pass, $attributes) = @_;
+ my ($class, $dsn, $user, $pass, $override_attrs) = @_;
# set up default attributes used to connect to the database
- # (if not defined by DB specific implementation)
- $attributes = { RaiseError => 0,
- AutoCommit => 1,
- PrintError => 0,
- ShowErrorStatement => 1,
- HandleError => \&_handle_error,
- TaintIn => 1,
- FetchHashKeyName => 'NAME',
- # Note: NAME_lc causes crash on ActiveState Perl
- # 5.8.4 (see Bug 253696)
- # XXX - This will likely cause problems in DB
- # back ends that twiddle column case (Oracle?)
- } if (!defined($attributes));
+ # (may be overridden by DB driver implementations)
+ my $attributes = { RaiseError => 0,
+ AutoCommit => 1,
+ PrintError => 0,
+ ShowErrorStatement => 1,
+ HandleError => \&_handle_error,
+ TaintIn => 1,
+ FetchHashKeyName => 'NAME',
+ # Note: NAME_lc causes crash on ActiveState Perl
+ # 5.8.4 (see Bug 253696)
+ # XXX - This will likely cause problems in DB
+ # back ends that twiddle column case (Oracle?)
+ };
+
+ if ($override_attrs) {
+ foreach my $key (keys %$override_attrs) {
+ $attributes->{$key} = $override_attrs->{$key};
+ }
+ }
# connect using our known info to the specified db
# Apache::DBI will cache this when using mod_perl
@@ -2340,7 +2346,9 @@ Constructor
=item C<$pass> - password used to log in to the database
-=item C<\%attributes> - set of attributes for DB connection (optional)
+=item C<\%override_attrs> - set of attributes for DB connection (optional).
+You only have to set attributes that you want to be different from
+the default attributes set inside of C<db_new>.
=back