mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
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.
This commit is contained in:
commit
b789758f1b
5 changed files with 38 additions and 1 deletions
|
@ -500,6 +500,18 @@ class dbal
|
||||||
return $column_name . ' | ' . (1 << $bit) . (($compare) ? ' ' . $compare : '');
|
return $column_name . ' | ' . (1 << $bit) . (($compare) ? ' ' . $compare : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
* Run more than one insert statement.
|
||||||
*
|
*
|
||||||
|
|
|
@ -332,6 +332,14 @@ class dbal_mssql extends dbal
|
||||||
return str_replace(array("'", "\0"), array("''", ''), $msg);
|
return str_replace(array("'", "\0"), array("''", ''), $msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
function sql_lower_text($column_name)
|
||||||
|
{
|
||||||
|
return "LOWER(SUBSTRING($column_name, 1, DATALENGTH($column_name)))";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build LIKE expression
|
* Build LIKE expression
|
||||||
* @access private
|
* @access private
|
||||||
|
|
|
@ -310,6 +310,14 @@ class dbal_mssql_odbc extends dbal
|
||||||
return str_replace(array("'", "\0"), array("''", ''), $msg);
|
return str_replace(array("'", "\0"), array("''", ''), $msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
function sql_lower_text($column_name)
|
||||||
|
{
|
||||||
|
return "LOWER(SUBSTRING($column_name, 1, DATALENGTH($column_name)))";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build LIKE expression
|
* Build LIKE expression
|
||||||
* @access private
|
* @access private
|
||||||
|
|
|
@ -492,6 +492,14 @@ class dbal_mssqlnative extends dbal
|
||||||
return str_replace(array("'", "\0"), array("''", ''), $msg);
|
return str_replace(array("'", "\0"), array("''", ''), $msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
function sql_lower_text($column_name)
|
||||||
|
{
|
||||||
|
return "LOWER(SUBSTRING($column_name, 1, DATALENGTH($column_name)))";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build LIKE expression
|
* Build LIKE expression
|
||||||
* @access private
|
* @access private
|
||||||
|
|
|
@ -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 .= $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)
|
if ($log_count !== false)
|
||||||
|
|
Loading…
Add table
Reference in a new issue