mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-09 18:30:16 +00:00
Merged changehandler-dont-hexify-text-cols, addendum to bug 1038276
This commit is contained in:
@@ -3576,7 +3576,7 @@ sub make_fetch_back_query {
|
||||
map {
|
||||
my $col = $_;
|
||||
if ( $self->{hex_blob}
|
||||
&& $tbl_struct->{type_for}->{$col} =~ m/blob|text|binary/ ) {
|
||||
&& $tbl_struct->{type_for}->{$col} =~ m/b(?:lob|inary)/ ) {
|
||||
$col = "IF(BINARY(`$col`)='', '', CONCAT('0x', HEX(`$col`))) AS `$col`";
|
||||
}
|
||||
else {
|
||||
|
@@ -496,7 +496,7 @@ sub make_fetch_back_query {
|
||||
map {
|
||||
my $col = $_;
|
||||
if ( $self->{hex_blob}
|
||||
&& $tbl_struct->{type_for}->{$col} =~ m/blob|text|binary/ ) {
|
||||
&& $tbl_struct->{type_for}->{$col} =~ m/b(?:lob|inary)/ ) {
|
||||
# Here we cast to binary, as otherwise, since text columns are
|
||||
# space padded, MySQL would compare ' ' and '' to be the same.
|
||||
# See https://bugs.launchpad.net/percona-toolkit/+bug/930693
|
||||
|
@@ -386,7 +386,7 @@ is(
|
||||
# #############################################################################
|
||||
$tbl_struct = {
|
||||
cols => [qw(t)],
|
||||
type_for => {t=>'text'},
|
||||
type_for => {t=>'blob'},
|
||||
};
|
||||
$ch = new ChangeHandler(
|
||||
Quoter => $q,
|
||||
@@ -406,6 +406,33 @@ is(
|
||||
"Don't prepend 0x to blank blob/text column value (issue 1052)"
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# An update to the above bug; It should only hexify for blob and binary, not
|
||||
# for text columns; The latter not only breaks for UTF-8 data, but also
|
||||
# breaks now that hex-looking columns aren't automatically left unquoted.
|
||||
# #############################################################################
|
||||
$tbl_struct = {
|
||||
cols => [qw(t)],
|
||||
type_for => {t=>'text'},
|
||||
};
|
||||
$ch = new ChangeHandler(
|
||||
Quoter => $q,
|
||||
left_db => 'test',
|
||||
left_tbl => 't',
|
||||
right_db => 'test',
|
||||
right_tbl => 't',
|
||||
actions => [ sub {} ],
|
||||
replace => 0,
|
||||
queue => 0,
|
||||
tbl_struct => $tbl_struct,
|
||||
);
|
||||
|
||||
is(
|
||||
$ch->make_fetch_back_query('1=1'),
|
||||
"SELECT `t` FROM `test`.`t` WHERE 1=1 LIMIT 1",
|
||||
"Don't prepend 0x to blank blob/text column value (issue 1052)"
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
|
||||
SKIP: {
|
||||
|
Reference in New Issue
Block a user