1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
#!/usr/bin/env perl
# This program is copyright 2009-2011 Percona Inc.
# Feedback and improvements are welcome.
#
# THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, version 2; OR the Perl Artistic License. On UNIX and similar
# systems, you can issue `man perlgpl' or `man perlartistic' to read these
# licenses.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA.
# This program is intended to be run after loading Sakila into our test
# database, when starting the "sandbox" MySQL instances. It will store the
# checksums of all of the mysql and sakila tables into a magical
# percona_test.checksums table on instance 12345. Afterwards, one can verify the
# integrity of all of these tables by running
# lib/Sandbox.pm::verify_test_data_integrity() which will checksum the master
# and all of the slaves, and make sure all are OK.
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use DBI;
my $dbh = DBI->connect(
'DBI:mysql:;host=127.0.0.1;port=12345;', 'msandbox', 'msandbox',
{
AutoCommit => 1,
RaiseError => 1,
PrintError => 1,
ShowErrorStatement => 1,
# mysql_local_infile => 1,
});
$dbh->do("CREATE TABLE IF NOT EXISTS percona_test.load_data (i int)");
`echo 1 > /tmp/load_data_test.$$`;
eval {
$dbh->do("LOAD DATA INFILE '/tmp/load_data_test.$$' INTO TABLE percona_test.load_data");
};
if ( $EVAL_ERROR ) {
$dbh->do("INSERT INTO percona_test.load_data (i) VALUES (0)");
}
unlink "/tmp/load_data_test.$$";
my ($val) = $dbh->selectrow_array("SELECT i FROM percona_test.load_data");
if ( ($val || 0) == 1 ) {
print "LOAD DATA LOCAL INFILE is enabled\n";
}
else {
print "LOAD DATA LOCAL INFILE is disabled\n"
}
exit;
|