]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 285403: LearnAboutColumns does not work on PostgreSQL
authormkanat%kerio.com <>
Thu, 10 Mar 2005 16:07:34 +0000 (16:07 +0000)
committermkanat%kerio.com <>
Thu, 10 Mar 2005 16:07:34 +0000 (16:07 +0000)
Patch By Max Kanat-Alexander <mkanat@kerio.com> r=Tomas.Kopal, a=justdave

Bugzilla/DB.pm
globals.pl

index cf1e391f52d8b21c756c6ad7b0d36a528aa268c3..6e0903a76f5ed0077befccae4e1efa067e5beeff 100644 (file)
@@ -456,6 +456,13 @@ sub bz_get_index_def ($$) {
    }
 }
 
+# XXX - Should be updated to use _bz_real_schema when we have that,
+#       if we ever need it.
+sub bz_table_columns {
+    my ($self, $table) = @_;
+    return $self->_bz_schema->get_table_columns($table);
+}
+
 # XXX - Needs to be made cross-db compatible
 sub bz_table_exists ($) {
    my ($self, $table) = @_;
index 53119c0342aa2a3911deba9800a8b99df4636a60..13542dcac514598d225cb36daa4769a5be500f20 100644 (file)
@@ -148,6 +148,8 @@ sub GetFieldID {
 
 # XXXX - this needs to go away
 sub GenerateVersionTable {
+    my $dbh = Bugzilla->dbh;
+
     SendSQL("SELECT versions.value, products.name " .
             "FROM versions, products " .
             "WHERE products.id = versions.product_id " .
@@ -217,9 +219,8 @@ sub GenerateVersionTable {
         $::prodmaxvotes{$p} = $votesperuser;
     }
             
-    my $cols = LearnAboutColumns("bugs");
+    @::log_columns = $dbh->bz_table_columns('bugs');
     
-    @::log_columns = @{$cols->{"-list-"}};
     foreach my $i ("bug_id", "creation_ts", "delta_ts", "lastdiffed") {
         my $w = lsearch(\@::log_columns, $i);
         if ($w >= 0) {
@@ -982,26 +983,6 @@ sub GetLongDescriptionAsText {
     return ($result, $anyprivate);
 }
 
-# Fills in a hashtable with info about the columns for the given table in the
-# database.  The hashtable has the following entries:
-#   -list-  the list of column names
-#   <name>,type  the type for the given name
-
-sub LearnAboutColumns {
-    my ($table) = (@_);
-    my %a;
-    SendSQL("show columns from $table");
-    my @list = ();
-    my @row;
-    while (@row = FetchSQLData()) {
-        my ($name,$type) = (@row);
-        $a{"$name,type"} = $type;
-        push @list, $name;
-    }
-    $a{"-list-"} = \@list;
-    return \%a;
-}
-
 # Returns a list of all the legal values for a field that has a
 # list of legal values, like rep_platform or resolution.
 sub get_legal_field_values {