r715 - in packages/libapache-dbilogger-perl/trunk: . debian

Gunnar Wolf gwolf@costa.debian.org
Tue, 08 Mar 2005 00:16:54 +0100


Author: gwolf
Date: 2005-03-08 00:16:53 +0100 (Tue, 08 Mar 2005)
New Revision: 715

Modified:
   packages/libapache-dbilogger-perl/trunk/DBILogger.pm
   packages/libapache-dbilogger-perl/trunk/debian/changelog
Log:
Fixed _REALLY_ old bug regarding the usage of this module with PostgreSQL


Modified: packages/libapache-dbilogger-perl/trunk/DBILogger.pm
===================================================================
--- packages/libapache-dbilogger-perl/trunk/DBILogger.pm	2005-03-07 07:12:32 UTC (rev 714)
+++ packages/libapache-dbilogger-perl/trunk/DBILogger.pm	2005-03-07 23:16:53 UTC (rev 715)
@@ -57,16 +57,12 @@
   		return DECLINED;
   	}
   	
-  	my @valueslist;
-  	
-  	foreach (keys %data) {
-		$data{$_} = $dbh->quote($data{$_});
-		push @valueslist, $data{$_};
-	}
-
 	my $table = $r->dir_config("DBILogger_table") || 'requests';
 
-	my $statement = "insert into $table (". join(',', keys %data) .") VALUES (". join(',', @valueslist) .")";
+        my @columns = map($dbh->quote_identifier($_), keys   %data);
+        my @values  = map($dbh->quote($_),            values %data);
+        
+	my $statement = "INSERT INTO $table (" . join(', ', @columns) . ") VALUES (" . join(', ', @values ) . ")";
 
 	my $tries = 0;
 	
@@ -139,6 +135,10 @@
   KEY timeserved_idx (timeserved)
 );
 
+Please note that for some databases (notably, PostgreSQL) you will need to
+double-quote the user column name (that is, to specify it as C<"user" 
+varchar(15)>) in order for the database not to mistake it with a keyword.
+
 Its recommended that you include
 
 use Apache::DBI;

Modified: packages/libapache-dbilogger-perl/trunk/debian/changelog
===================================================================
--- packages/libapache-dbilogger-perl/trunk/debian/changelog	2005-03-07 07:12:32 UTC (rev 714)
+++ packages/libapache-dbilogger-perl/trunk/debian/changelog	2005-03-07 23:16:53 UTC (rev 715)
@@ -1,3 +1,11 @@
+libapache-dbilogger-perl (0.93-6) unstable; urgency=low
+
+  * Documented how the table should be used in PostgreSQL, added a small
+    patch (Thanks, Julian Mehnle!) preventing the problem from
+    happening. (Closes: #41890)
+
+ -- Gunnar Wolf <gwolf@mosca.iiec.unam.mx>  Mon,  7 Mar 2005 17:15:31 -0600
+
 libapache-dbilogger-perl (0.93-5) unstable; urgency=low
 
   * Fixed missing build-depends (Closes: #276292)