summaryrefslogtreecommitdiffstats
path: root/Bugzilla/DB
diff options
context:
space:
mode:
authormkanat%kerio.com <>2005-03-05 16:36:07 +0100
committermkanat%kerio.com <>2005-03-05 16:36:07 +0100
commit0c1b77e123dbafb96168fe6affd6373b9aa081fe (patch)
tree9f4bf1de4a3b85d423238ed47a56746d70181e24 /Bugzilla/DB
parent8b47184604eb5868736e0a2a8ae894f6feceaa95 (diff)
downloadbugzilla-0c1b77e123dbafb96168fe6affd6373b9aa081fe.tar.gz
bugzilla-0c1b77e123dbafb96168fe6affd6373b9aa081fe.tar.xz
Bug 284598: INSTR function is not supported by postgres
Patch By Tomas Kopal <Tomas.Kopal@altap.cz> r=mkanat, a=justdave
Diffstat (limited to 'Bugzilla/DB')
-rw-r--r--Bugzilla/DB/Mysql.pm14
1 files changed, 14 insertions, 0 deletions
diff --git a/Bugzilla/DB/Mysql.pm b/Bugzilla/DB/Mysql.pm
index 4e0a3e5b2..ae24d13bc 100644
--- a/Bugzilla/DB/Mysql.pm
+++ b/Bugzilla/DB/Mysql.pm
@@ -117,6 +117,20 @@ sub sql_interval {
return "INTERVAL $interval";
}
+sub sql_position {
+ my ($self, $fragment, $text) = @_;
+
+ # mysql 4.0.1 and lower do not support CAST
+ # mysql 3.*.* had a case-sensitive INSTR
+ # (checksetup has a check for unsupported versions)
+ my $server_version = $self->bz_server_version;
+ if ($server_version =~ /^3\./) {
+ return "INSTR($text, $fragment)";
+ } else {
+ return "INSTR(CAST($text AS BINARY), CAST($fragment AS BINARY))";
+ }
+}
+
sub bz_lock_tables {
my ($self, @tables) = @_;