mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-22 11:54:54 +00:00
Fix a number of SQL queries to work with ANSI_QUOTES
This commit is contained in:
@@ -313,7 +313,7 @@ SKIP: {
|
||||
|
||||
$master_dbh->do('DROP TABLE IF EXISTS test.issue_371');
|
||||
$master_dbh->do('CREATE TABLE test.issue_371 (id INT, foo varchar(16), bar char)');
|
||||
$master_dbh->do('INSERT INTO test.issue_371 VALUES (1,"foo","a"),(2,"bar","b")');
|
||||
$master_dbh->do("INSERT INTO test.issue_371 VALUES (1,'foo','a'),(2,'bar','b')");
|
||||
|
||||
$ch->fetch_back($master_dbh);
|
||||
|
||||
|
@@ -131,7 +131,7 @@ isa_ok($cr, 'CompareResults');
|
||||
);
|
||||
|
||||
is_deeply(
|
||||
$dbh1->selectrow_arrayref('SHOW TABLES FROM test LIKE "dropme"'),
|
||||
$dbh1->selectrow_arrayref("SHOW TABLES FROM test LIKE 'dropme'"),
|
||||
['dropme'],
|
||||
'checksum: temp table exists'
|
||||
);
|
||||
@@ -145,7 +145,7 @@ is(
|
||||
);
|
||||
|
||||
is_deeply(
|
||||
$dbh1->selectall_arrayref('SHOW TABLES FROM test LIKE "dropme"'),
|
||||
$dbh1->selectall_arrayref("SHOW TABLES FROM test LIKE 'dropme'"),
|
||||
[],
|
||||
'checksum: before_execute() drops temp table'
|
||||
);
|
||||
@@ -199,7 +199,7 @@ is(
|
||||
);
|
||||
|
||||
is_deeply(
|
||||
$dbh1->selectall_arrayref('SHOW TABLES FROM test LIKE "dropme"'),
|
||||
$dbh1->selectall_arrayref("SHOW TABLES FROM test LIKE 'dropme'"),
|
||||
[],
|
||||
'checksum: after_execute() drops temp table'
|
||||
);
|
||||
@@ -335,7 +335,7 @@ isa_ok($cr, 'CompareResults');
|
||||
);
|
||||
|
||||
is_deeply(
|
||||
$dbh1->selectrow_arrayref('SHOW TABLES FROM test LIKE "dropme"'),
|
||||
$dbh1->selectrow_arrayref("SHOW TABLES FROM test LIKE 'dropme'"),
|
||||
['dropme'],
|
||||
'rows: temp table exists'
|
||||
);
|
||||
@@ -349,7 +349,7 @@ is(
|
||||
);
|
||||
|
||||
is_deeply(
|
||||
$dbh1->selectrow_arrayref('SHOW TABLES FROM test LIKE "dropme"'),
|
||||
$dbh1->selectrow_arrayref("SHOW TABLES FROM test LIKE 'dropme'"),
|
||||
['dropme'],
|
||||
"rows: before_execute() doesn't drop temp table"
|
||||
);
|
||||
@@ -455,7 +455,7 @@ is_deeply(
|
||||
},
|
||||
);
|
||||
|
||||
$dbh2->do('update test.t2 set c="should be c" where i=3');
|
||||
$dbh2->do("update test.t2 set c='should be c' where i=3");
|
||||
|
||||
is_deeply(
|
||||
$dbh2->selectrow_arrayref('select c from test.t2 where i=3'),
|
||||
@@ -517,8 +517,8 @@ is_deeply(
|
||||
# Test max-different-rows.
|
||||
# #############################################################################
|
||||
$cr->reset();
|
||||
$dbh2->do('update test.t2 set c="should be a" where i=1');
|
||||
$dbh2->do('update test.t2 set c="should be b" where i=2');
|
||||
$dbh2->do("update test.t2 set c='should be a' where i=1");
|
||||
$dbh2->do("update test.t2 set c='should be b' where i=2");
|
||||
proc('before_execute');
|
||||
proc('execute');
|
||||
|
||||
|
@@ -166,12 +166,12 @@ is_deeply(
|
||||
# #############################################################################
|
||||
@events = (
|
||||
{
|
||||
arg => 'insert into test.t values (-2,"hi2",2)',
|
||||
arg => "insert into test.t values (-2,'hi2',2)",
|
||||
fingerprint => 'insert into test.t values (?,?,?)',
|
||||
sampleno => 1,
|
||||
},
|
||||
{
|
||||
arg => 'insert into test.t values (-2,"hi2",2)',
|
||||
arg => "insert into test.t values (-2,'hi2',2)",
|
||||
fingerprint => 'insert into test.t values (?,?,?)',
|
||||
sampleno => 1,
|
||||
},
|
||||
@@ -341,7 +341,7 @@ is(
|
||||
|
||||
is_deeply(
|
||||
[ $cw->samples('insert into test.t values (?,?,?)') ],
|
||||
[ '1', 'insert into test.t values (-2,"hi2",2)' ],
|
||||
[ '1', "insert into test.t values (-2,'hi2',2)" ],
|
||||
'samples()'
|
||||
);
|
||||
|
||||
|
@@ -35,7 +35,7 @@ if ( !$dbh ) {
|
||||
plan skip_all => 'Cannot connect to MySQL';
|
||||
|
||||
}
|
||||
elsif ( !@{$dbh->selectcol_arrayref('SHOW DATABASES LIKE "sakila"')} ) {
|
||||
elsif ( !@{$dbh->selectcol_arrayref("SHOW DATABASES LIKE 'sakila'")} ) {
|
||||
plan skip_all => "Sandbox master does not have the sakila database";
|
||||
}
|
||||
else {
|
||||
|
@@ -461,23 +461,25 @@ SKIP: {
|
||||
# #############################################################################
|
||||
# Issue 801: DSNParser clobbers SQL_MODE
|
||||
# #############################################################################
|
||||
SKIP: {
|
||||
diag(`SQL_MODE="no_zero_date" $trunk/sandbox/start-sandbox master 12348 >/dev/null`);
|
||||
my $dsn = $dp->parse('h=127.1,P=12348,u=msandbox,p=msandbox');
|
||||
my $dbh = $dp->get_dbh($dp->get_cxn_params($dsn), {});
|
||||
diag('Setting SQL mode globally on 12345');
|
||||
my $old_mode = `/tmp/12345/use -ss -e 'select \@\@sql_mode'`;
|
||||
chomp $old_mode;
|
||||
diag("Old SQL mode: $old_mode");
|
||||
diag(`/tmp/12345/use -e 'set global sql_mode=no_zero_date'`);
|
||||
my $new_mode = `/tmp/12345/use -ss -e 'select \@\@sql_mode'`;
|
||||
chomp $new_mode;
|
||||
diag("New SQL mode: $new_mode");
|
||||
my $dsn = $dp->parse('h=127.1,P=12345,u=msandbox,p=msandbox');
|
||||
my $mdbh = $dp->get_dbh($dp->get_cxn_params($dsn), {});
|
||||
|
||||
skip 'Cannot connect to second sandbox master', 1 unless $dbh;
|
||||
|
||||
my $row = $dbh->selectrow_arrayref('select @@sql_mode');
|
||||
is(
|
||||
$row->[0],
|
||||
'NO_AUTO_VALUE_ON_ZERO,NO_ZERO_DATE',
|
||||
"Did not clobber server SQL mode"
|
||||
);
|
||||
|
||||
$dbh->disconnect();
|
||||
diag(`$trunk/sandbox/stop-sandbox 12348 >/dev/null`);
|
||||
};
|
||||
my $row = $mdbh->selectrow_arrayref('select @@sql_mode');
|
||||
is(
|
||||
$row->[0],
|
||||
'NO_AUTO_VALUE_ON_ZERO,NO_ZERO_DATE',
|
||||
"Did not clobber server SQL mode"
|
||||
);
|
||||
diag(`/tmp/12345/use -e "set global sql_mode='$old_mode'"`);
|
||||
$mdbh->disconnect;
|
||||
|
||||
# #############################################################################
|
||||
# Passwords with commas don't work, expose part of password
|
||||
|
@@ -111,7 +111,7 @@ is_deeply(
|
||||
SKIP: {
|
||||
skip "Cannot connect to sandbox master", 5 unless $dbh;
|
||||
skip "Sakila database is not loaded", 5
|
||||
unless @{ $dbh->selectall_arrayref('show databases like "sakila"') };
|
||||
unless @{ $dbh->selectall_arrayref("show databases like 'sakila'") };
|
||||
|
||||
# Use mk-index-usage to create all the save results tables.
|
||||
# Must --databases foo so it won't find anything, else it will
|
||||
|
@@ -214,7 +214,7 @@ is(
|
||||
# ############################################################################
|
||||
# a-y w/ chunk-size 5, even nibbles
|
||||
# ############################################################################
|
||||
$dbh->do('delete from test.t where c="z"');
|
||||
$dbh->do("delete from test.t where c='z'");
|
||||
my $all_rows = $dbh->selectall_arrayref('select * from test.t order by c');
|
||||
$ni = make_nibble_iter(
|
||||
db => 'test',
|
||||
@@ -254,7 +254,7 @@ is_deeply(
|
||||
# ############################################################################
|
||||
# single row table
|
||||
# ############################################################################
|
||||
$dbh->do('delete from test.t where c != "d"');
|
||||
$dbh->do("delete from test.t where c != 'd'");
|
||||
$ni = make_nibble_iter(
|
||||
db => 'test',
|
||||
tbl => 't',
|
||||
|
@@ -234,7 +234,7 @@ SKIP: {
|
||||
# ########################################################################
|
||||
SKIP: {
|
||||
skip 'Sandbox master does not have the sakila database', 1
|
||||
unless @{$dbh->selectcol_arrayref('SHOW DATABASES LIKE "sakila"')};
|
||||
unless @{$dbh->selectcol_arrayref("SHOW DATABASES LIKE 'sakila'")};
|
||||
|
||||
test_so(
|
||||
filters => [qw(-d sakila)],
|
||||
|
@@ -130,7 +130,7 @@ is(
|
||||
# #############################################################################
|
||||
SKIP: {
|
||||
skip 'Sandbox master does not have the sakila database', 21
|
||||
unless @{$dbh->selectcol_arrayref('SHOW DATABASES LIKE "sakila"')};
|
||||
unless @{$dbh->selectcol_arrayref("SHOW DATABASES LIKE 'sakila'")};
|
||||
|
||||
my @chunks;
|
||||
|
||||
@@ -1115,7 +1115,7 @@ sub count_rows {
|
||||
|
||||
SKIP: {
|
||||
skip 'Sandbox master does not have the sakila database', 1
|
||||
unless @{$dbh->selectcol_arrayref('SHOW DATABASES LIKE "sakila"')};
|
||||
unless @{$dbh->selectcol_arrayref("SHOW DATABASES LIKE 'sakila'")};
|
||||
|
||||
my @chunks;
|
||||
|
||||
@@ -1228,7 +1228,7 @@ ok( @chunks, "calculate_chunks picks a sane default for chunk_range" );
|
||||
# #############################################################################
|
||||
SKIP: {
|
||||
skip 'Sandbox master does not have the sakila database', 1
|
||||
unless @{$dbh->selectcol_arrayref('SHOW DATABASES LIKE "sakila"')};
|
||||
unless @{$dbh->selectcol_arrayref("SHOW DATABASES LIKE 'sakila'")};
|
||||
|
||||
my @chunks;
|
||||
$t = $tp->parse( load_file('t/lib/samples/sakila.film.sql') );
|
||||
|
@@ -30,7 +30,7 @@ my $sample = "t/lib/samples/tables/";
|
||||
SKIP: {
|
||||
skip "Cannot connect to sandbox master", 2 unless $dbh;
|
||||
skip 'Sandbox master does not have the sakila database', 2
|
||||
unless @{$dbh->selectcol_arrayref('SHOW DATABASES LIKE "sakila"')};
|
||||
unless @{$dbh->selectcol_arrayref("SHOW DATABASES LIKE 'sakila'")};
|
||||
|
||||
is(
|
||||
$tp->get_create_table($dbh, 'sakila', 'FOO'),
|
||||
@@ -702,7 +702,7 @@ SKIP: {
|
||||
|
||||
SKIP: {
|
||||
skip 'Sandbox master does not have the sakila database', 2
|
||||
unless $dbh && @{$dbh->selectcol_arrayref('SHOW DATABASES LIKE "sakila"')};
|
||||
unless $dbh && @{$dbh->selectcol_arrayref("SHOW DATABASES LIKE 'sakila'")};
|
||||
is_deeply(
|
||||
[$tp->find_possible_keys(
|
||||
$dbh, 'sakila', 'film_actor', $q, 'film_id > 990 and actor_id > 1')],
|
||||
|
Reference in New Issue
Block a user