Bug 322771: PostgreSQL incorrectly detects that some summaries have control characters when they don't

Patch By Frederic Buclin <LpSolit@gmail.com> r=mkanat, a=justdave
This commit is contained in:
mkanat%kerio.com 2006-01-12 07:03:46 +00:00
Родитель 2e727311b0
Коммит 43530e54a5
1 изменённых файлов: 12 добавлений и 7 удалений

Просмотреть файл

@ -4245,17 +4245,22 @@ $dbh->bz_alter_column('logincookies', 'cookie',
my $controlchar_bugs = my $controlchar_bugs =
$dbh->selectall_arrayref("SELECT short_desc, bug_id FROM bugs WHERE " . $dbh->selectall_arrayref("SELECT short_desc, bug_id FROM bugs WHERE " .
$dbh->sql_regexp('short_desc', "'[[:cntrl:]]'")); $dbh->sql_regexp('short_desc', "'[[:cntrl:]]'"));
if (@$controlchar_bugs) if (scalar(@$controlchar_bugs))
{ {
print 'Cleaning control characters from bug summaries...'; my $msg = 'Cleaning control characters from bug summaries...';
my $found = 0;
foreach (@$controlchar_bugs) { foreach (@$controlchar_bugs) {
my ($short_desc, $bug_id) = @$_; my ($short_desc, $bug_id) = @$_;
print " $bug_id..."; my $clean_short_desc = clean_text($short_desc);
$short_desc = clean_text($short_desc); if ($clean_short_desc ne $short_desc) {
$dbh->do("UPDATE bugs SET short_desc = ? WHERE bug_id = ?", print $msg if !$found;
undef, $short_desc, $bug_id); $found = 1;
print " $bug_id...";
$dbh->do("UPDATE bugs SET short_desc = ? WHERE bug_id = ?",
undef, $clean_short_desc, $bug_id);
}
} }
print " done.\n"; print " done.\n" if $found;
} }
# If you had to change the --TABLE-- definition in any way, then add your # If you had to change the --TABLE-- definition in any way, then add your