summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2005-12-23 11:01:51 +0100
committerlpsolit%gmail.com <>2005-12-23 11:01:51 +0100
commit598f0d1a8db925cdb235d401554f1a403f506358 (patch)
treea2772c8ef7f20ef71432257cdbe8ac970c4891b9 /Bugzilla
parentac921416d48a3a2b5f43bb9f6a88cb7fee15f469 (diff)
downloadbugzilla-598f0d1a8db925cdb235d401554f1a403f506358.tar.gz
bugzilla-598f0d1a8db925cdb235d401554f1a403f506358.tar.xz
Bug 316971: [PostgreSQL] ./collectstats.pl --regenerate fails - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=justdave
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/DB.pm7
-rw-r--r--Bugzilla/DB/Mysql.pm6
-rw-r--r--Bugzilla/DB/Pg.pm6
3 files changed, 19 insertions, 0 deletions
diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm
index 09c941ec8..1da845942 100644
--- a/Bugzilla/DB.pm
+++ b/Bugzilla/DB.pm
@@ -1124,6 +1124,13 @@ formatted SQL command have prefix C<sql_>. All other methods have prefix C<bz_>.
Returns: formatted SQL for limiting number of rows returned from query
with optional offset (e.g. LIMIT 1, 1) (scalar)
+=item C<sql_from_days>
+
+ Description: Outputs SQL syntax for converting Julian days to date.
+ Abstract method, should be overriden by database specific code.
+ Params: $days = days to convert to date
+ Returns: formatted SQL for returning Julian days in dates. (scalar)
+
=item C<sql_to_days>
Description: Outputs SQL syntax for converting date to Julian days.
diff --git a/Bugzilla/DB/Mysql.pm b/Bugzilla/DB/Mysql.pm
index 71bb97588..c006e5fd0 100644
--- a/Bugzilla/DB/Mysql.pm
+++ b/Bugzilla/DB/Mysql.pm
@@ -133,6 +133,12 @@ sub sql_istring {
return $string;
}
+sub sql_from_days {
+ my ($self, $days) = @_;
+
+ return "FROM_DAYS($days)";
+}
+
sub sql_to_days {
my ($self, $date) = @_;
diff --git a/Bugzilla/DB/Pg.pm b/Bugzilla/DB/Pg.pm
index 4424e65fd..a8f54f903 100644
--- a/Bugzilla/DB/Pg.pm
+++ b/Bugzilla/DB/Pg.pm
@@ -111,6 +111,12 @@ sub sql_limit {
}
}
+sub sql_from_days {
+ my ($self, $days) = @_;
+
+ return "TO_TIMESTAMP(${days}::int, 'J')::date";
+}
+
sub sql_to_days {
my ($self, $date) = @_;