summaryrefslogtreecommitdiffstats
path: root/Bugzilla/DB.pm
diff options
context:
space:
mode:
authormkanat%kerio.com <>2005-03-03 16:15:01 +0100
committermkanat%kerio.com <>2005-03-03 16:15:01 +0100
commit0e8f16e1c64b07cf6d90264f8f754307d340b30e (patch)
tree152e914a81eab2318a92d22e7c7033feec662ccc /Bugzilla/DB.pm
parentd0d2e9fddc55b47bc9df5f5d60acac9f86d13183 (diff)
downloadbugzilla-0e8f16e1c64b07cf6d90264f8f754307d340b30e.tar.gz
bugzilla-0e8f16e1c64b07cf6d90264f8f754307d340b30e.tar.xz
Bug 284172: checksetup cannot run CREATE DATABASE on PostgreSQL
Patch By Max Kanat-Alexander <mkanat@kerio.com> r=glob, a=justdave
Diffstat (limited to 'Bugzilla/DB.pm')
-rw-r--r--Bugzilla/DB.pm38
1 files changed, 26 insertions, 12 deletions
diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm
index 073e929eb..db6c0b405 100644
--- a/Bugzilla/DB.pm
+++ b/Bugzilla/DB.pm
@@ -173,7 +173,8 @@ sub _handle_error {
# List of abstract methods we are checking the derived class implements
our @_abstract_methods = qw(new sql_regexp sql_not_regexp sql_limit
sql_to_days sql_date_format sql_interval
- bz_lock_tables bz_unlock_tables);
+ bz_lock_tables bz_unlock_tables
+ REQUIRED_VERSION PROGRAM_NAME);
# This overriden import method will check implementation of inherited classes
# for missing implementation of abstract methods
@@ -200,17 +201,10 @@ sub import {
$Exporter::ExportLevel-- if $is_exporter;
}
-# note that when multiple databases are supported, version number does not
-# make sense anymore (as it is DB-dependent). This needs to be removed in
-# the future and places where it's used fixed.
-my $cached_server_version;
-sub server_version {
- return $cached_server_version if defined($cached_server_version);
- my $dbh = Bugzilla->dbh;
- my $sth = $dbh->prepare('SELECT VERSION()');
- $sth->execute();
- ($cached_server_version) = $sth->fetchrow_array();
- return $cached_server_version;
+# XXX - Needs to be documented.
+sub bz_server_version {
+ my ($self) = @_;
+ return $self->get_info(18); # SQL_DBMS_VER
}
sub bz_get_field_defs {
@@ -522,6 +516,26 @@ Access to the old SendSQL-based database routines are also provided by
importing the C<:deprecated> tag. These routines should not be used in new
code.
+=head1 CONSTANTS
+
+Subclasses of Bugzilla::DB are required to define certain constants. These
+constants are required to be subroutines or "use constant" variables.
+
+=over 4
+
+=item C<REQUIRED_VERSION>
+
+This is the minimum required version of the database server that the
+Bugzilla::DB subclass requires. It should be in a format suitable for
+passing to vers_cmp during installation.
+
+=item C<PROGRAM_NAME>
+
+The human-readable name of this database. For example, for MySQL, this
+would be 'MySQL.' You should not depend on this variable to know what
+type of database you are running on; this is intended merely for displaying
+to the admin to let them know what DB they're running.
+
=head1 CONNECTION
A new database handle to the required database can be created using this