aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2012-05-31 15:27:32 +0200
committerNils Adermann <naderman@naderman.de>2012-05-31 15:27:32 +0200
commitb789758f1bf431accb1226ff34f28e25c7ebe5c6 (patch)
treeff6fd76991bc8e54e3de29ae3245ba783908df6e /phpBB/includes
parent0261a9acffd47beb5b40bfa58d987e44b5ebf0c3 (diff)
parent9ab5ad2986a836554bbf137d577c38155540c0a8 (diff)
downloadforums-b789758f1bf431accb1226ff34f28e25c7ebe5c6.tar
forums-b789758f1bf431accb1226ff34f28e25c7ebe5c6.tar.gz
forums-b789758f1bf431accb1226ff34f28e25c7ebe5c6.tar.bz2
forums-b789758f1bf431accb1226ff34f28e25c7ebe5c6.tar.xz
forums-b789758f1bf431accb1226ff34f28e25c7ebe5c6.zip
Merge remote-tracking branch 'github-bantu/ticket/10751' into develop-olympus
By Andreas Fischer via Andreas Fischer * github-bantu/ticket/10751: [ticket/10751] Use sql_lower_text() in view_log(). log_data is a text column. [ticket/10751] Add sql_lower_text() to database abstraction layer.
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/db/dbal.php12
-rw-r--r--phpBB/includes/db/mssql.php8
-rw-r--r--phpBB/includes/db/mssql_odbc.php8
-rw-r--r--phpBB/includes/db/mssqlnative.php8
-rw-r--r--phpBB/includes/functions_admin.php3
5 files changed, 38 insertions, 1 deletions
diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php
index 358df50402..9cc337955b 100644
--- a/phpBB/includes/db/dbal.php
+++ b/phpBB/includes/db/dbal.php
@@ -501,6 +501,18 @@ class dbal
}
/**
+ * Run LOWER() on DB column of type text (i.e. neither varchar nor char).
+ *
+ * @param string $column_name The column name to use
+ *
+ * @return string A SQL statement like "LOWER($column_name)"
+ */
+ function sql_lower_text($column_name)
+ {
+ return "LOWER($column_name)";
+ }
+
+ /**
* Run more than one insert statement.
*
* @param string $table table name to run the statements on
diff --git a/phpBB/includes/db/mssql.php b/phpBB/includes/db/mssql.php
index 6899a73902..b7178593dc 100644
--- a/phpBB/includes/db/mssql.php
+++ b/phpBB/includes/db/mssql.php
@@ -333,6 +333,14 @@ class dbal_mssql extends dbal
}
/**
+ * {@inheritDoc}
+ */
+ function sql_lower_text($column_name)
+ {
+ return "LOWER(SUBSTRING($column_name, 1, DATALENGTH($column_name)))";
+ }
+
+ /**
* Build LIKE expression
* @access private
*/
diff --git a/phpBB/includes/db/mssql_odbc.php b/phpBB/includes/db/mssql_odbc.php
index 34f7a87337..2ecc42cadf 100644
--- a/phpBB/includes/db/mssql_odbc.php
+++ b/phpBB/includes/db/mssql_odbc.php
@@ -311,6 +311,14 @@ class dbal_mssql_odbc extends dbal
}
/**
+ * {@inheritDoc}
+ */
+ function sql_lower_text($column_name)
+ {
+ return "LOWER(SUBSTRING($column_name, 1, DATALENGTH($column_name)))";
+ }
+
+ /**
* Build LIKE expression
* @access private
*/
diff --git a/phpBB/includes/db/mssqlnative.php b/phpBB/includes/db/mssqlnative.php
index 92ac9b1fb9..c91cc188b0 100644
--- a/phpBB/includes/db/mssqlnative.php
+++ b/phpBB/includes/db/mssqlnative.php
@@ -493,6 +493,14 @@ class dbal_mssqlnative extends dbal
}
/**
+ * {@inheritDoc}
+ */
+ function sql_lower_text($column_name)
+ {
+ return "LOWER(SUBSTRING($column_name, 1, DATALENGTH($column_name)))";
+ }
+
+ /**
* Build LIKE expression
* @access private
*/
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 0e1a11b4aa..204fa9a43d 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -2557,7 +2557,8 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
{
$sql_keywords .= $db->sql_in_set('l.log_operation', $operations) . ' OR ';
}
- $sql_keywords .= 'LOWER(l.log_data) ' . implode(' OR LOWER(l.log_data) ', $keywords) . ')';
+ $sql_lower = $db->sql_lower_text('l.log_data');
+ $sql_keywords .= "$sql_lower " . implode(" OR $sql_lower ", $keywords) . ')';
}
if ($log_count !== false)