mariadb/tests/export.pl
unknown 4a3f651d6d Fixed bug in send in mysqltest
Removed usage of @r/result as this made life hard when testing different
table handlers.
Allow concurrent inserts if no update/binary log.
Don't remove key_cache at flush tables.
Fixed bug in SELECT DISTINCT SUM()...


BitKeeper/deleted/.del-rpl000012.status.result~bbbd650b5beea32f:
  Delete: mysql-test/r/rpl000012.status.result
BitKeeper/deleted/.del-rpl000013.status.result~6bee190c298cc9fd:
  Delete: mysql-test/r/rpl000013.status.result
Docs/manual.texi:
  Changelog
client/mysqltest.c:
  Fixed bug in 'send' that Sasha had introduced.
  Make database, port and socket optional parameters to connect()
mysql-test/r/rpl000005.result:
  Removed usage of @r/result as this made life hard when doing
  test for multiple table handlers.
mysql-test/r/rpl000006.result:
  Removed usage of @r/result as this made life hard when doing
  test for multiple table handlers.
mysql-test/r/rpl000012.result:
  Removed usage of @r/result as this made life hard when doing
  test for multiple table handlers.
mysql-test/r/rpl000013.result:
  Removed usage of @r/result as this made life hard when doing
  test for multiple table handlers.
mysql-test/r/sel000033.result:
  Removed usage of @r/result as this made life hard when doing
  test for multiple table handlers.
mysql-test/t/backup.test:
  Use default port and socket.
mysql-test/t/dirty-close.test:
  Use default port and socket.
mysql-test/t/flush.test:
  Use default port and socket.
mysql-test/t/kill.test:
  Use default port and socket.
mysql-test/t/overflow.test:
  Use default port and socket.
mysql-test/t/rpl000003.test:
  Removed usage of @r/result as this made life hard when doing
  test for multiple table handlers.
mysql-test/t/rpl000005.test:
  Removed usage of @r/result as this made life hard when doing
  test for multiple table handlers.
mysql-test/t/rpl000006.test:
  Removed usage of @r/result as this made life hard when doing
  test for multiple table handlers.
mysql-test/t/rpl000007.test:
  Removed usage of @r/result as this made life hard when doing
  test for multiple table handlers.
mysql-test/t/rpl000008.test:
  Removed usage of @r/result as this made life hard when doing
  test for multiple table handlers.
mysql-test/t/rpl000009.test:
  Removed usage of @r/result as this made life hard when doing
  test for multiple table handlers.
mysql-test/t/rpl000010.test:
  Removed usage of @r/result as this made life hard when doing
  test for multiple table handlers.
mysql-test/t/rpl000011.test:
  Removed usage of @r/result as this made life hard when doing
  test for multiple table handlers.
mysql-test/t/rpl000012.test:
  Removed usage of @r/result as this made life hard when doing
  test for multiple table handlers.
mysql-test/t/rpl000013.test:
  Removed usage of @r/result as this made life hard when doing
  test for multiple table handlers.
mysql-test/t/sel000001.test:
  Removed usage of @r/result as this made life hard when doing
  test for multiple table handlers.
mysql-test/t/sel000002.test:
  Removed usage of @r/result as this made life hard when doing
  test for multiple table handlers.
mysql-test/t/sel000003.test:
  Removed usage of @r/result as this made life hard when doing
  test for multiple table handlers.
mysql-test/t/sel000031.test:
  Removed usage of @r/result as this made life hard when doing
  test for multiple table handlers.
mysql-test/t/sel000032.test:
  Removed usage of @r/result as this made life hard when doing
  test for multiple table handlers.
mysql-test/t/sel000033.test:
  Removed usage of @r/result as this made life hard when doing
  test for multiple table handlers.
mysql-test/t/sel000100.test:
  Removed usage of @r/result as this made life hard when doing
  test for multiple table handlers.
mysql-test/t/shw000001.test:
  Removed usage of @r/result as this made life hard when doing
  test for multiple table handlers.
mysql-test/t/status.test:
  Use default port and socket.
sql/gen_lex_hash.cc:
  Smaller hash table
sql/mysql_priv.h:
  Allow concurrent inserts if no update/binary log
sql/mysqld.cc:
  Allow concurrent inserts if no update/binary log
  Don't remove key_cache at flush tables
sql/sql_base.cc:
  Don't remove key_cache at flush tables
sql/sql_select.cc:
  Fix bug in SELECT DISTINCT SUM().
sql/sql_yacc.yy:
  Allow concurrent inserts if no update/binary log
tests/export.pl:
  C
2001-03-25 01:02:26 +02:00

164 lines
6.2 KiB
Perl
Executable file

#!/usr/bin/perl
# This is a test with uses two processes to a database.
# The other inserts records in two tables, the other does a lot of joins
# on these.
#
# Warning, the output from this test will differ in 'found' from time to time,
# but there should never be any errors
#
$host= shift || "";
$test_db="test";
use Mysql;
$|= 1; # Autoflush
$org_file="/tmp/export-org.$$";
$tmp_file="/tmp/export-old.$$";
$tmp_file2="/tmp/export-new.$$";
print "Connection to database $test_db\n";
$dbh = Mysql->Connect($host) || die "Can't connect: $Mysql::db_errstr\n";
$dbh->SelectDB($test_db) || die "Can't use database $test_db: $Mysql::db_errstr\n";
$dbh->Query("drop table if exists export"); # Ignore this error
print "Creating table\n";
($dbh->Query("\
CREATE TABLE export (
auto int(5) unsigned NOT NULL DEFAULT '0' auto_increment,
string char(11) NOT NULL,
tiny tinyint(4) NOT NULL DEFAULT '0',
short smallint(6) NOT NULL DEFAULT '0',
medium mediumint(8) NOT NULL DEFAULT '0',
longint int(11) NOT NULL DEFAULT '0',
longlong bigint(20) NOT NULL DEFAULT '0',
real_float float(13,1) NOT NULL DEFAULT '0.0',
real_double double(13,1) NOT NULL,
utiny tinyint(3) unsigned NOT NULL DEFAULT '0',
ushort smallint(5) unsigned zerofill NOT NULL DEFAULT '00000',
umedium mediumint(8) unsigned NOT NULL DEFAULT '0',
ulong int(11) unsigned NOT NULL DEFAULT '0',
ulonglong bigint(20) unsigned NOT NULL DEFAULT '0',
time_stamp timestamp,
blob_col blob,
tinyblob_col tinyblob,
mediumblob_col tinyblob not null,
longblob_col longblob not null,
PRIMARY KEY (auto),
KEY (string(5)),
KEY unsigned_tinykey (utiny),
KEY (tiny),
KEY (short),
FOREIGN KEY (medium) references export,
KEY (longlong),
KEY (real_float),
KEY (real_double),
KEY (ushort),
KEY (umedium),
KEY (ulong),
KEY (ulonglong),
KEY (ulonglong,ulong))")) or die $Mysql::db_errstr;
print "Inserting data\n";
@A=("insert into export values (10, 1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1)",
"insert into export values (NULL,2,2,2,2,2,2,2,2,2,2,2,2,2,NULL,NULL,NULL,2,2)",
"insert into export values (0,1/3,3,3,3,3,3,3,3,3,3,3,3,3,3,'','','','3')",
"insert into export values (0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,'-1')",
"insert into export values (0,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,'-4294967295')",
"insert into export values (0,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,'4294967295')",
"insert into export (string,tinyblob_col) values ('special','''\\0\\t\t\n''')",
"insert into export (string) values (',,!!\\\\##')",
"insert into export (tinyblob_col) values (',,!!!\\\\\\##')"
);
foreach $A (@A)
{
$dbh->Query($A) or die "query: $A returned: " . $Mysql::db_errstr;
}
print "Doing dump, load, check on different formats\n";
@A=(# Ordinary format
"",
# Field terminated by something
"fields optionally enclosed by '+' escaped by '' terminated by ',,,' lines terminated by ',,,,'",
"fields enclosed by '' terminated by ',' lines terminated by ''",
"fields enclosed by '' terminated by ',' lines terminated by '!!'",
#Fields enclosed by
#"fields enclosed by '+' terminated by ''",
#"fields enclosed by '+' terminated by '' lines terminated by ''",
"fields enclosed by '+' terminated by ',,' lines terminated by '!!!'",
"fields enclosed by '+' terminated by ',,' lines terminated by '##'",
"fields enclosed by '+' escaped by '' terminated by ',,' lines terminated by '###'",
"fields enclosed by '+' escaped by '' terminated by '!' lines terminated by ''",
"fields enclosed by '+' terminated by ',' lines terminated by ''",
#Fields optionally enclosed by
"fields optionally enclosed by '+' terminated by ','",
"fields optionally enclosed by '+' terminated by ',' lines terminated by ''",
"fields optionally enclosed by '''' terminated by ',' lines starting by 'INSERT INTO a VALUES(' terminated by ');\n'",
);
$dbh->Query("select * into outfile '$org_file' from export") or die $Mysql::db_errstr;
foreach $A (@A)
{
unlink($tmp_file);
unlink($tmp_file2);
$dbh->Query("select * into outfile '$tmp_file' $A from export") or die $Mysql::db_errstr;
$dbh->Query("delete from export") or die $Mysql::db_errstr;
$dbh->Query("load data infile '$tmp_file' into table export $A") or die $Mysql::db_errstr . " with format: $A\n";
$dbh->Query("select * into outfile '$tmp_file2' from export") or die $Mysql::db_errstr;
if (`cmp $tmp_file2 $org_file`)
{
print "Using format $A\n";
print "$tmp_file2 and $org_file differ. Plese check files\n";
exit 1;
}
}
@A=(#Fixed size fields
"fields enclosed by '' escaped by '' terminated by ''",
"fields enclosed by '' escaped by '' terminated by '' lines terminated by '\\r\\n'",
"fields enclosed by '' terminated by '' lines terminated by ''"
);
unlink($org_file);
$field_list="auto,ifnull(string,''),tiny,short,medium,longint,longlong,real_float,ifnull(real_double,''),utiny,ushort,umedium,ulong,ulonglong,time_stamp";
$dbh->Query("select $field_list into outfile '$org_file' from export") or die $Mysql::db_errstr;
$field_list="auto,string,tiny,short,medium,longint,longlong,real_float,real_double,utiny,ushort,umedium,ulong,ulonglong,time_stamp";
foreach $A (@A)
{
unlink($tmp_file);
unlink($tmp_file2);
$dbh->Query("select $field_list into outfile '$tmp_file' $A from export") or die $Mysql::db_errstr;
$dbh->Query("delete from export") or die $Mysql::db_errstr;
$dbh->Query("load data infile '$tmp_file' into table export $A ($field_list)") or die $Mysql::db_errstr;
$dbh->Query("select $field_list into outfile '$tmp_file2' from export") or die $Mysql::db_errstr;
if (`cmp $tmp_file2 $org_file`)
{
print "Using format $A\n";
print "$tmp_file2 and $org_file differ. Plese check files\n";
exit 1;
}
}
unlink($tmp_file);
unlink($tmp_file2);
unlink($org_file);
$dbh->Query("drop table export") or die $Mysql::db_errstr;
print "Test ok\n";
exit 0;