summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2011-02-02 09:53:25 +0100
committerMax Kanat-Alexander <mkanat@bugzilla.org>2011-02-02 09:53:25 +0100
commit02d24f0b9a74611ab2b0b0770188c1dd3a4f164d (patch)
tree8a0c1c1e0569a6d25090539e8a672e63f0c4ff29
parent77eca5f6eb051fcc468dcd5de6f004cd1b5eb18a (diff)
downloadbugzilla-02d24f0b9a74611ab2b0b0770188c1dd3a4f164d.tar.gz
bugzilla-02d24f0b9a74611ab2b0b0770188c1dd3a4f164d.tar.xz
Bug 630681: Implement a MOD function for SQLite so collectstats.pl can run
r=mkanat, a=mkanat (module owner)
-rw-r--r--Bugzilla/DB/Sqlite.pm3
1 files changed, 3 insertions, 0 deletions
diff --git a/Bugzilla/DB/Sqlite.pm b/Bugzilla/DB/Sqlite.pm
index 2c3448acf..e40a264f0 100644
--- a/Bugzilla/DB/Sqlite.pm
+++ b/Bugzilla/DB/Sqlite.pm
@@ -48,6 +48,8 @@ use constant WORD_END => '(?:$|\W)';
# not accent-insensitive).
sub _sqlite_collate_ci { lc($_[0]) cmp lc($_[1]) }
+sub _sqlite_mod { $_[0] % $_[1] }
+
sub _sqlite_now {
my $now = DateTime->now(time_zone => Bugzilla->local_timezone);
return $now->ymd . ' ' . $now->hms;
@@ -135,6 +137,7 @@ sub new {
# so that's what we use, and I don't know of any way in SQLite to
# alias the SQL "substr" function to be called "SUBSTRING".
$self->sqlite_create_function('substring', 3, \&CORE::substr);
+ $self->sqlite_create_function('mod', 2, \&_sqlite_mod);
$self->sqlite_create_function('now', 0, \&_sqlite_now);
$self->sqlite_create_function('localtimestamp', 1, \&_sqlite_now);
$self->sqlite_create_function('floor', 1, \&POSIX::floor);