summaryrefslogtreecommitdiffstats
path: root/Bugzilla/DB.pm
diff options
context:
space:
mode:
authormkanat%kerio.com <>2005-07-08 11:31:41 +0200
committermkanat%kerio.com <>2005-07-08 11:31:41 +0200
commit4f25eedf9065f28badf1e5e1df6c925062d8279e (patch)
tree01adc7e1f641b2104a5177bd84ad4ab084e71dda /Bugzilla/DB.pm
parent6bff5c39e564cc34c85c4d30e11f6ff14482548a (diff)
downloadbugzilla-4f25eedf9065f28badf1e5e1df6c925062d8279e.tar.gz
bugzilla-4f25eedf9065f28badf1e5e1df6c925062d8279e.tar.xz
Bug 285695: [PostgreSQL] Username checks for login, etc. need to be case insensitive
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=justdave
Diffstat (limited to 'Bugzilla/DB.pm')
-rw-r--r--Bugzilla/DB.pm40
1 files changed, 40 insertions, 0 deletions
diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm
index e11d52592..76e090d6c 100644
--- a/Bugzilla/DB.pm
+++ b/Bugzilla/DB.pm
@@ -218,6 +218,19 @@ sub import {
$Exporter::ExportLevel-- if $is_exporter;
}
+sub sql_istrcmp {
+ my ($self, $left, $right, $op) = @_;
+ $op ||= "=";
+
+ return $self->sql_istring($left) . " $op " . $self->sql_istring($right);
+}
+
+sub sql_istring {
+ my ($self, $string) = @_;
+
+ return "LOWER($string)";
+}
+
sub sql_position {
my ($self, $fragment, $text) = @_;
@@ -1153,6 +1166,33 @@ formatted SQL command have prefix C<sql_>. All other methods have prefix C<bz_>.
$text = text to search for (scalar)
Returns: formatted SQL for for full text search
+=item C<sql_istrcmp>
+
+ Description: Returns SQL for a case-insensitive string comparison.
+ Params: $left - What should be on the left-hand-side of the
+ operation.
+ $right - What should be on the right-hand-side of the
+ operation.
+ $op (optional) - What the operation is. Should be a
+ valid ANSI SQL comparison operator, like "=", "<",
+ "LIKE", etc. Defaults to "=" if not specified.
+ Returns: A SQL statement that will run the comparison in
+ a case-insensitive fashion.
+ Note: Uses sql_istring, so it has the same performance concerns.
+ Try to avoid using this function unless absolutely necessary.
+ Subclass Implementors: Override sql_istring instead of this
+ function, most of the time (this function uses sql_istring).
+
+=item C<sql_istring>
+
+ Description: Returns SQL syntax "preparing" a string or text column for
+ case-insensitive comparison.
+ Params: $string - string to convert (scalar)
+ Returns: formatted SQL making the string case insensitive
+ Note: The default implementation simply calls LOWER on the parameter.
+ If this is used to search on a text column with index, the index
+ will not be usually used unless it was created as LOWER(column).
+
=item C<bz_lock_tables>
Description: Performs a table lock operation on specified tables.