mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-25 21:54:48 +00:00
Test case and fix: remove multi-line comments before -- one line comments.
This commit is contained in:
@@ -166,9 +166,9 @@ sub fingerprint {
|
||||
if ( my ($beginning) = $query =~ m/\A((?:INSERT|REPLACE)(?: IGNORE)?\s+INTO.+?VALUES\s*\(.*?\))\s*,\s*\(/is ) {
|
||||
$query = $beginning; # Shorten multi-value INSERT statements ASAP
|
||||
}
|
||||
|
||||
$query =~ s/$olc_re//go;
|
||||
|
||||
$query =~ s/$mlc_re//go;
|
||||
$query =~ s/$olc_re//go;
|
||||
$query =~ s/\Ause \S+\Z/use ?/i # Abstract the DB in USE
|
||||
&& return $query;
|
||||
|
||||
|
@@ -10,7 +10,7 @@ BEGIN {
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
use English qw(-no_match_vars);
|
||||
use Test::More tests => 271;
|
||||
use Test::More;
|
||||
|
||||
use QueryRewriter;
|
||||
use QueryParser;
|
||||
@@ -407,6 +407,15 @@ is(
|
||||
"Fingerprint db.tbl<number>name (preserve number)"
|
||||
);
|
||||
|
||||
|
||||
is(
|
||||
$qr->fingerprint(
|
||||
"/* -- S++ SU ABORTABLE -- spd_user: rspadim */SELECT SQL_SMALL_RESULT SQL_CACHE DISTINCT centro_atividade FROM est_dia WHERE unidade_id=1001 AND item_id=67 AND item_id_red=573"
|
||||
),
|
||||
"select sql_small_result sql_cache distinct centro_atividade from est_dia where unidade_id=? and item_id=? and item_id_red=?",
|
||||
"Fingerprint /* -- comment */ SELECT (bug 1174956)"
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# convert_to_select()
|
||||
# #############################################################################
|
||||
@@ -1406,4 +1415,4 @@ is(
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
exit;
|
||||
done_testing;
|
||||
|
Reference in New Issue
Block a user