Commit 745f9e65 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 450379: Searching SQL for candidates to truncate short_desc (> 255 chars)…

Bug 450379: Searching SQL for candidates to truncate short_desc (> 255 chars) should use CHAR_LENGTH - Patch by A.A. Shimono (himorin) <shimono@mozilla.gr.jp> and Xiaoou <xiaoou.wu@oracle.com> r/a=mkanat
parent 75e8ed22
......@@ -489,6 +489,8 @@ sub bz_setup_database {
# have that function, So we have to create one ourself.
$self->do("CREATE OR REPLACE FUNCTION NOW "
. " RETURN DATE IS BEGIN RETURN SYSDATE; END;");
$self->do("CREATE OR REPLACE FUNCTION CHAR_LENGTH(COLUMN_NAME VARCHAR2)"
. " RETURN NUMBER IS BEGIN RETURN LENGTH(COLUMN_NAME); END;");
# Create a WORLD_LEXER named BZ_LEX for multilingual fulltext search
my $lexer = $self->selectcol_arrayref(
"SELECT pre_name FROM CTXSYS.CTX_PREFERENCES WHERE pre_name = ? AND
......
......@@ -2623,7 +2623,7 @@ sub _change_short_desc_from_mediumtext_to_varchar {
# and then truncate the summary.
my $long_summary_bugs = $dbh->selectall_arrayref(
'SELECT bug_id, short_desc, reporter
FROM bugs WHERE LENGTH(short_desc) > 255');
FROM bugs WHERE CHAR_LENGTH(short_desc) > 255');
if (@$long_summary_bugs) {
print <<EOT;
......@@ -2979,7 +2979,7 @@ sub _check_content_length {
my $dbh = Bugzilla->dbh;
my %contents = @{ $dbh->selectcol_arrayref(
"SELECT $id_field, $field_name FROM $table_name
WHERE LENGTH($field_name) > ?", {Columns=>[1,2]}, $max_length) };
WHERE CHAR_LENGTH($field_name) > ?", {Columns=>[1,2]}, $max_length) };
if (scalar keys %contents) {
print install_string('install_data_too_long',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment