From 0c1b77e123dbafb96168fe6affd6373b9aa081fe Mon Sep 17 00:00:00 2001 From: "mkanat%kerio.com" <> Date: Sat, 5 Mar 2005 15:36:07 +0000 Subject: Bug 284598: INSTR function is not supported by postgres Patch By Tomas Kopal r=mkanat, a=justdave --- Bugzilla/DB/Mysql.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'Bugzilla/DB') 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) = @_; -- cgit v1.2.3-24-g4f1b