3
# Tests MySQL. Output is given to the stderr. Use
4
# diff to check the possible differencies.
14
$opt_user = $opt_password = $opt_without = "";
15
$opt_host = "localhost";
17
$opt_socket = "/tmp/mysql.sock";
20
$NO_ERR = 0; # No error
21
$EXP_ERR = 1; # Expect error
22
$MAY_ERR = 2; # Maybe error
23
$HS = 0; # Horizontal style of output
24
$VS = 1; # Vertical style of output
25
$VERBOSE = 0; # Print the results
26
$SILENT = 1; # No output
28
@test_packages = ("FUNC", "PROC", "SHOW");
38
GetOptions("help", "db=s", "port=i", "host=s", "password=s", "user=s", "socket=s",
39
"without=s") || usage();
41
usage() if ($opt_help);
43
$dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host:port=$opt_port:mysql_socket=$opt_socket", $opt_user, $opt_password, { PrintError => 0 })
46
## QQ ######################################
48
$sth = $dbh->prepare("show felds from t2")
49
|| die "Couldn't prepare query: $DBI::errstr\n";
52
print "Couldn't execute query: $DBI::errstr\n";
56
while (($row = $sth->fetchrow_arrayref))
64
## QQ ######################################
66
printf("####\n#### THIS IS mysql-test script RUNNING\n");
67
printf("#### mysql-test version $VER\n####\n");
69
test_mysql_functions() if (&chk_package($opt_without, $test_packages[0]));
70
test_mysql_procedures() if (&chk_package($opt_without, $test_packages[1]));
71
test_mysql_show() if (&chk_package($opt_without, $test_packages[2]));
78
#### test show -command of MySQL
85
$query = create_show_tables();
86
&exec_query(["drop table my_t"], $MAY_ERR, $SILENT);
87
for ($i = 0; $query[$i]; $i++)
89
&exec_query([$query[$i]], $NO_ERR, $VERBOSE, $HS);
90
&exec_query(["show fields from my_t"], $NO_ERR, $VERBOSE, $HS);
91
&exec_query(["show keys from my_t"], $NO_ERR, $VERBOSE, $HS);
92
&exec_query(["drop table my_t"], $NO_ERR, $SILENT);
96
sub create_show_tables
101
create table my_t (i int, f float, s char(64), b blob, t text)
104
create table my_t (i int, f float, s char(64), b blob, t text, primary key (i))
107
create table my_t (i int, f float, s char(64), b blob, t text, unique (i), unique(s))
109
for ($i = 0; $query[$i]; $i++) { chop($query[$i]); }
114
#### test procedures, currently only procedure analyze()
117
sub test_mysql_procedures
131
&exec_query(["select * from mails procedure analyse(-1)"],
132
$EXP_ERR, $VERBOSE, $HS);
133
&exec_query(["select * from mails procedure analyse(10, -1)"],
134
$EXP_ERR, $VERBOSE, $HS);
135
&exec_query(["select * from mails procedure analyse(1, 2, 3)"],
136
$EXP_ERR, $VERBOSE, $HS);
137
&exec_query(["select * from mails procedure analyse(-10, 10)"],
138
$EXP_ERR, $VERBOSE, $HS);
139
&exec_query(["select * from mails procedure analyse('a', 'a')"],
140
$EXP_ERR, $VERBOSE, $HS);
142
# &exec_query(["select * from mails procedure analyse(10)"], 0, 0);
143
# &exec_query(["select * from mails procedure analyse(10, 10)"], 0, 0);
144
# &exec_query(["select hash from mails procedure analyse()"], 0, 0);
145
&exec_query(["use mysql_test"], $NO_ERR, $VERBOSE, $HS);
146
# &exec_query(["select timestamp from w32_user procedure analyse(0)"], 0, 0);
147
$query = create_test_tables();
148
&exec_query(["drop table my_t"], $MAY_ERR, $SILENT);
149
for ($i = 0; $query[$i][0]; $i++)
151
&exec_query([$query[$i][0]], $NO_ERR, $SILENT); # create table
152
for ($j = 1; $query[$i][$j]; $j++)
154
&exec_query([$query[$i][$j]], $NO_ERR, $SILENT); # do inserts
156
&exec_query(["select * from my_t procedure analyse(0,0)"],
157
$NO_ERR, $VERBOSE, $HS);
158
&exec_query(["select * from my_t procedure analyse()"],
159
$NO_ERR, $VERBOSE, $HS);
160
&exec_query(["drop table my_t"], $NO_ERR, $SILENT);
165
#### if $opt is found as a part from the '--without=...' option string
166
#### return 0, else 1. if zero is returned, then that part of MySQL
172
my ($opt_str, $opt) = @_;
175
for ($i = 0, $ptr = substr($opt_str, $i, 1); $ptr || $ptr eq '0';
176
$i++, $ptr = substr($opt_str, $i, 1))
178
$sub_opt_str .= $ptr;
179
if ($sub_opt_str eq $opt)
181
$next_chr = substr($opt_str, ($i + 1), 1);
182
if ($next_chr eq ',' || (!$next_chr && $next_chr ne '0'))
189
# next word on the opt_str
197
#### Tests given function(s) with given value(s) $count rounds
198
#### If function doesn't have an arg, test it once and continue.
199
#### ulargs (number of unlimited args) is the number of arguments
200
#### to be placed in place of '.' . '.' means that any number
201
#### of the last argument type is possible to the function.
202
#### If force is given, never mind about errors
203
#### args: $func: list of functions to be tested
204
#### $value: list of values to be used with functions
205
#### $count: number of times one function should be tested
206
#### $ulargs: number of unlimited args to be used when possible
207
#### $table_info: information about the table to be used, contains:
208
#### table name, info about the fields in the table, for example:
209
#### [mysql_test1, "Zi", "Rd"], where mysql_test1 is the name of the
210
#### table, "Zi" tells, that the first field name is 'i' and it is
211
#### type 'Z' (integer), see test_mysql_functions, 'Rd' tells that
212
#### the second field name is 'd' and the type is 'R' (real number)
213
#### $force: if given, never mind about errors
214
#### $mix: if 0, use the same argument at a time in a
215
#### function that has two or more same type arguments
216
#### if 1, use different values
221
my ($func, $value, $count, $ulargs, $table_info, $force, $mix) = @_;
222
my ($query, $i, $j, $k, $no_arg, $row, $ulimit, $tbinfo, $tbused, $arg);
226
printf("No function found!\n");
227
if (!$force) { die; }
230
for ($i = 0; $func->[$i][0]; $i++)
234
for ($j = 0; $j < $count && !$no_arg; $j++)
236
if ($tbused || $no_arg) { next; }
237
$query = "select $func->[$i][0](";
238
#search the values for the args
239
for ($k = 0; $k < length($func->[$i][1]) && !$no_arg; $k++)
249
if (substr($func->[$i][1], $k, 1) eq 'E')
254
if ($k) { $query .= ','; }
256
if (substr($func->[$i][1], $k, 1) eq 'S')
258
$query .= &find_value(\@value, 'S', $arg);
260
elsif (substr($func->[$i][1], $k, 1) eq 'N')
262
$query .= &find_value(\@value, 'N', $arg);
264
elsif (substr($func->[$i][1], $k, 1) eq 'Z')
266
$query .= &find_value(\@value, 'Z', $arg);
268
elsif ((substr($func->[$i][1], $k, 1) eq 'R'))
270
$query .= &find_value(\@value, 'R', $arg);
272
elsif (substr($func->[$i][1], $k, 1) eq 'T')
274
$query .= &find_value(\@value, 'T', $arg);
276
elsif (substr($func->[$i][1], $k, 1) eq 'D')
278
$query .= &find_value(\@value, 'D', $arg);
280
elsif (substr($func->[$i][1], $k, 1) eq 'B')
282
$query .= &find_value(\@value, 'B', $arg);
284
elsif (substr($func->[$i][1], $k, 1) eq 'C')
286
$query .= &find_value(\@value, 'C', $arg);
288
elsif (substr($func->[$i][1], $k, 1) eq 'F')
290
$query .= &find_value(\@value, 'F', $arg);
292
elsif (substr($func->[$i][1], $k, 1) eq '.')
295
for ($ulimit = 0; $ulimit < $ulargs; $ulimit++)
298
$query .= &find_value(\@value,
299
substr($func->[$i][1], $k - 1, 1),
303
elsif (substr($func->[$i][1], $k, 1) eq 'A')
305
for ($tbinfo = 1; substr($table_info->[$tbinfo], 0, 1) ne
306
substr($func->[$i][1], $k + 1, 1); $tbinfo++)
308
if (!defined($table_info->[$tbinfo]))
310
printf("Illegal function structure!\n");
311
printf("A table was needed, but no type specified!\n");
312
printf("Unready query was: $query\n");
313
if (!$force) { die; }
317
if ($k) { $query .= ","; }
318
$query .= substr($table_info->[$tbinfo], 1,
319
length($table_info->[$tbinfo]) - 1);
325
printf("Not a valid type: \n");
326
printf(substr($func->[$i][1], $k, 1));
327
printf("\nAttempted to be used with unready query: \n");
335
$query .= $table_info->[0];
337
if (!($sth = $dbh->prepare($query)))
339
printf("Couldn't prepare: $query\n");
340
if (!$force) { die; }
344
printf("Execution failed: $DBI::errstr\n");
345
printf("Attempted query was:\n$query\n");
347
if (!$force) { die; }
351
printf("mysql> $query;\n");
353
printf("Query OK\n\n");
360
#### mk_str returns a string where the first arg is repeated second arg times
361
#### if repeat is 1, return the original str
366
my ($str, $repeat) = @_;
371
die "Invalid repeat times!\n";
374
for ($repeat--, $res_str = $str; $repeat > 0; $repeat--)
382
#### find_value: returns a value from list of values
383
#### args: $values: list of values
384
#### $type: type of argument (S = string, N = integer etc.)
385
#### $ordinal: the ordinal number of an argument in the list
390
my ($values, $type, $ordinal) = @_;
391
my ($total, $i, $j, $tmp, $val);
393
$total = -1; # The first one is the type
395
for ($i = 0; $values[$i][0]; $i++)
397
if ($values[$i][0] eq $type)
400
foreach $val (@$tmp) { $total++; }
401
for ( ;$total < $ordinal; )
405
return $values[$i][$ordinal];
408
printf("No type '$type' found in values\n");
413
#### exec_query: execute a query, print information if wanted and exit
414
#### args: $queries: list of queries to be executed
415
#### $expect_error: if 0, error is not expected. In this case if an
416
#### error occurs, inform about it and quit
417
#### if 1, error is expected. In this case if sql server
418
#### doesn't give an error message, inform about it
420
#### if 2, error may happen or not, don't care
421
#### $silent: if true, reduce output
422
#### $style: type of output, 0 == horizontal, 1 == vertical
427
my ($queries, $expect_error, $silent, $style) = @_;
430
foreach $query (@$queries)
432
if (!($sth = $dbh->prepare($query)))
434
printf("Couldn't prepare: $query\n");
439
if ($expect_error == 1)
441
printf("An invalid instruction was purposely made,\n");
442
printf("server failed succesfully:\n");
443
printf("$DBI::errstr\n");
444
printf("Everything OK, continuing...\n");
447
if ($expect_error != 2)
449
printf("Execution failed: $DBI::errstr\n");
450
printf("Attempted query was:\n$query\n");
454
if ($expect_error == 1)
456
printf("An invalid instruction was purposely made,\n");
457
printf("server didn't note, ALARM!\n");
458
printf("The query made was: $query\n");
459
printf("The output from the server:\n");
461
if ($expect_error == 2) { return; }
462
if (!$silent) { printf("mysql> $query;\n"); }
463
display($sth, $style);
464
if (!$silent) { printf("Query OK\n\n"); }
465
if ($expect_error) { die; }
471
#### Display to stderr
472
#### Args: 1: ($sth) statememt handler
473
#### 2: ($style) 0 == horizontal style, 1 == vertical style
478
my ($sth, $style) = @_;
479
my (@data, @max_length, $row, $nr_rows, $nr_cols, $i, $j, $tmp, $mxl);
481
# Store the field names and values in @data.
482
# Store the max field lengths in @max_length
483
for ($i = 0; ($row = $sth->fetchrow_arrayref); $i++)
488
for ($j = 0; $j <= $#$row; $j++)
490
$data[$i][$j] = $sth->{NAME}->[$j];
491
$max_length[$j] = length($data[$i][$j]);
495
for ($j = 0; $j <= $#$row; $j++)
497
$data[$i][$j] = $row->[$j];
498
$max_length[$j] = $tmp if ($max_length[$j] <
499
($tmp = length($data[$i][$j])));
502
if (!($nr_rows = $i))
509
for ($i = 0; $i < $nr_rows; $i++)
513
for ($j = 0; $j <= $nr_cols; $j++)
515
print "+"; print "-" x ($max_length[$j] + 2);
520
for ($j = 0; $j <= $nr_cols; $j++)
523
if (defined($data[$i][$j]))
526
$tmp = length($data[$i][$j]);
533
print " " x ($max_length[$j] - $tmp);
539
for ($j = 0; $j <= $nr_cols; $j++)
541
print "+"; print "-" x ($max_length[$j] + 2);
546
for ($j = 0; $j <= $nr_cols; $j++)
548
print "+"; print "-" x ($max_length[$j] + 2);
555
for ($i = 0; $max_length[$i]; $i++)
557
$mxl = $max_length[$i] if ($mxl < $max_length[$i]);
560
for ($i = 1; $i < $nr_rows; $i++)
563
print " " . $i . ". row ";
566
for ($j = 0; $j <= $nr_cols; $j++)
568
print " " x ($mxl - length($data[0][$j]));
569
print "$data[0][$j]: ";
570
if (defined($data[$i][$j]))
572
print "$data[$i][$j] \n";
591
mysql-test $VER by Jani Tolonen
593
Usage: mysql-test [options]
596
--help Show this help
597
--db= Database to use (Default: $opt_db)
598
--port= TCP/IP port to use for connection (Default: $opt_port)
599
--socket= UNIX socket to use for connection (Default: $opt_socket)
600
--host= Connect to host (Default: $opt_host)
601
--user= User for login if not current user
602
--password Password to use when connecting to server
604
--without=PART_NAME1,PART_NAME2,...
605
test without a certain part of MySQL, optional parts listed below
609
FUNC Ignore MySQL basic functions
610
PROC Ignore MySQL procedure functions
616
sub test_mysql_functions
622
#### Types: S = string (or real number) , N = unsigned integer, Z = integer,
623
#### R = real number, T = time_stamp, E = no argument, D = date,
624
#### B = boolean, C = character
625
#### F = format (usually used with the date-types)
626
#### . = any number of the last argument type possible
627
#### A = require table for test, the following argument
628
#### is the argument for the function
630
# Muista get_lock,group_unique_users,
631
# position, unique_users
633
# ks. kaikki date function, ker�� yhteen, testaa erikseen
634
# adddate, date_add, subdate, date_sub, between, benchmark, count
636
# decode, encode, get_lock, make_set, position
638
@functions = (["abs","R"],["acos","R"],["ascii","C"],["asin","R"],
639
["atan","R"],["atan2","R"],["avg","AR"],["bin","Z"],
640
["bit_count","Z"],["bit_or","AZ"],["bit_and","AZ"],
641
["ceiling","R"],["char","N."],["char_length","S"],
642
["concat","SS."],["conv","ZZZ"],
643
["cos","R"],["cot","R"],["curdate","E"],
644
["curtime","E"],["database","E"],["date_format","DF"],
645
["dayofmonth","D"],["dayofyear","D"],["dayname","D"],
646
["degrees","R"],["elt","NS."],["encode","SS"],
647
["encrypt","S"],["encrypt","SS"],["exp","R"],["field","SS."],
648
["find_in_set","SS"],["floor","R"],["format","RN"],
649
["from_days","N"],["from_unixtime","N"],
650
["from_unixtime","NF"],["greatest","RR."],["hex","Z"],
651
["hour","D"],["if","ZSS"],["ifnull","SS"],["insert","SNNS"],
652
["instr","SS"],["interval","RR."],["isnull","S"],
653
["last_insert_id","E"],["lcase","S"],["least","RR."],
654
["left","SN"],["length","S"],["locate","SS"],
655
["log","R"],["log10","R"],["lpad","SNS"],["ltrim","S"],
656
["max","AR"],["mid","SNN"],["min","AR"],["minute","D"],
657
["mod","ZZ"],["monthname","D"],
658
["month","D"],["now","E"],["oct","Z"],
659
["octet_length","S"],["password","S"],["period_add","DD"],
660
["period_diff","DD"],["pi","E"],
661
["pow","RR"],["quarter","D"],["radians","R"],
662
["rand","E"],["rand","R"],["release_lock","S"],
663
["repeat","SN"],["replace","SSS"],["reverse","S"],
664
["right","SN"],["round","R"],["round","RN"],
665
["rpad","SNS"],["rtrim","S"],["sec_to_time","N"],
666
["second","T"],["sign","R"],["sin","R"],
667
["space","N"],["soundex","S"],["sqrt","R"],["std","AR"],
668
["strcmp","SS"],["substring","SN"],["substring","SNN"],
669
["substring_index","SSZ"],["sum","AR"],
670
["tan","R"],["time_format","TF"],["time_to_sec","T"],
671
["to_days","D"],["trim","S"],
672
["truncate","RN"],["ucase","S"],
673
["unix_timestamp","E"],["unix_timestamp","D"],["user","E"],
674
["version","E"],["week","D"],["weekday","D"],["year","D"]);
677
#### Various tests for the functions above
680
&exec_query(["drop table mysql_test1"], $MAY_ERR, $SILENT);
683
create table mysql_test1 (
689
&exec_query([$query], $NO_ERR, $SILENT);
695
printf("####\n#### BASIC TESTS FOR FUNCTIONS\n####\n\n");
697
@bunch = ("insert into mysql_test1 values(-20,-10.5),(20,10.5),(50,100.00)",
698
"insert into mysql_test1 values(100,500.333)");
699
&exec_query(\@bunch, $NO_ERR, $SILENT);
701
printf("\n####\n#### First basic test part\n####\n\n");
703
@values = (["S", "'a'", "'abc'", "'abc def'", "'abcd'", "'QWERTY'",
704
"'\\\\'", "'*.!\"#ďż˝%&/()'", "'" . &mk_str('a',1024) . "'",
706
["N", -1000, -500, -100, -1, 0, 1, 40, 50, 70, 90,
708
["Z", -100, -50, 200, 1000],
709
["R", -500.5, -10.333, 100.667, 400.0],
710
["T", 19980728154204, 19980728154205, 19980728154206,
712
["D", "'1997-12-06'", "'1997-12-07'", "'1997-12-08'",
715
["C", "'a'", "'e'", "'r'", "'q'"],
716
["F", "'%a'", "'%b'", "'%d'", "'%H'"]);
717
&test_func(\@functions, \@values, 4, 5, ["mysql_test1","Zi","Rd"]);
719
printf("\n####\n#### Second basic test part\n####\n\n");
721
@values = (["S", "'a'", "'BC'", "'def'", "'HIJK'", "'lmnop'", "'QRSTUV'"],
722
["N", 0, 1, 2, 3, 4, 5],
723
["Z", 0, 1, 2, 3, 4, 5],
724
["R", 0, 1, 2, 3, 4, 5],
725
["T", 19990608234530, 20000709014631, 20010810024732,
726
20020911034833, 20031012044934, 20041113055035],
727
["D", "'1999-06-08'", "'2000-07-09'", "'2001-08-10'",
728
"'2002-09-11'", "'2003-10-12'", "'2004-11-13'"],
729
["B", 0, 1, 0, 1, 0, 1],
730
["C", "'a'", "'BC'", "'def'", "'HIJK'", "'lmnop'", "'QRSTUV'"],
731
["F", "'%a'", "'%b'", "'%d'", "'%h'", "'%H'", "'%i'"]);
732
&test_func(\@functions, \@values, 6, 6, ["mysql_test1","Zi","Rd"], 0, 1);
734
printf("\n####\n#### Third basic test part\n####\n\n");
736
@values = (["S", "'Monty'", "'Jani'", "'MySQL'", "''"],
737
["N", 10, 54, -70, -499],
738
["Z", 11.03, "'Abo'", 54.333, "''"],
739
["R", 12, "'gnome'", -34.211, "''"],
740
["T", 3, "'Redhat'", -19984021774433, "''"],
741
["D", "'1990-01-31'", "'-3333-10-23'", -5631_23_12, "''"],
742
["B", 0, "'asb'", -4, "''"],
743
["C", "'a'", 503, -45353453, "''"],
744
["F", "'%a'", -231, "'Mitsubishi'", "''"]);
745
&test_func(\@functions, \@values, 3, 3, ["mysql_test1","Zi","Rd"], 0, 1);
747
&exec_query(["delete from mysql_test1"], $NO_ERR, $SILENT);
753
printf("\n\n####\n#### NULL TESTS FOR FUNCTIONS\n####\n\n\n");
755
&exec_query(["insert into mysql_test1 values(null,null)"], $NO_ERR,
757
@values = (["S", "NULL"],
766
&test_func(\@functions, \@values, 1, 5, ["mysql_test1","Zi","Rd"], 1);
767
&exec_query(["delete from mysql_test1"], $NO_ERR, $SILENT);
770
#### Tests to fulfill the main part of function tests above
773
printf("\n\n####\n#### FULFILL TESTS \n####\n\n\n");
775
&exec_query(["drop table my_t"], $MAY_ERR, $SILENT);
776
&exec_query(["create table my_t (s1 char(64), s2 char(64))"],
777
$NO_ERR, $VERBOSE, $HS);
779
insert into my_t values('aaa','aaa'),('aaa|qqq','qqq'),('gheis','^[^a-dXYZ]+\$'),('aab','^aa?b'),('Baaan','^Ba*n'),('aaa','qqq|aaa'),('qqq','qqq|aaa'),('bbb','qqq|aaa'),('bbb','qqq'),('aaa','aba'),(null,'abc'),('def',null),(null,null),('ghi','ghi[')
782
&exec_query([$query], $NO_ERR, $VERBOSE, $HS);
783
&exec_query(["select s1 regexp s2 from my_t"],
784
$NO_ERR, $VERBOSE, $HS);
788
#### ["position","SS"],
793
sub create_test_tables
795
$query[0][0] = <<EOF;
797
auto int(5) unsigned DEFAULT '0' NOT NULL auto_increment,
798
string varchar(10) DEFAULT 'hello',
799
binary_string varchar(10) binary DEFAULT '' NOT NULL,
800
tiny tinyint(4) DEFAULT '0' NOT NULL,
801
short smallint(6) DEFAULT '1' NOT NULL,
802
medium mediumint(8) DEFAULT '0' NOT NULL,
803
longint int(11) DEFAULT '0' NOT NULL,
804
longlong bigint(13) DEFAULT '0' NOT NULL,
805
num decimal(5,2) DEFAULT '0.00' NOT NULL,
806
num_fill decimal(6,2) unsigned zerofill DEFAULT '0000.00' NOT NULL,
807
real_float float(13,1) DEFAULT '0.0' NOT NULL,
808
real_double double(13,1),
809
utiny tinyint(3) unsigned DEFAULT '0' NOT NULL,
810
ushort smallint(5) unsigned zerofill DEFAULT '00000' NOT NULL,
811
umedium mediumint(8) unsigned DEFAULT '0' NOT NULL,
812
ulong int(11) unsigned DEFAULT '0' NOT NULL,
813
ulonglong bigint(13) unsigned DEFAULT '0' NOT NULL,
814
zero int(5) unsigned zerofill,
815
time_stamp timestamp(14),
820
tinyblob_col tinyblob,
821
mediumblob_col mediumblob NOT NULL,
822
longblob_col longblob NOT NULL,
823
options enum('one','two','three'),
824
flags set('one','two','three'),
829
$query[0][1] = <<EOF;
830
INSERT INTO my_t VALUES (1,'hello','',0,1,0,0,0,0.00,0000.00,0.0,NULL,0,
831
00000,0,0,0,NULL,19980728154204,NULL,'01:00:00',
832
NULL,NULL,NULL,'','',NULL,NULL)
835
$query[0][2] = <<EOF;
836
INSERT INTO my_t VALUES (2,'hello','',0,1,0,0,0,0.00,0000.00,
837
-340282346638528859811704183484516925440.0,NULL,0,
838
00000,0,0,0,NULL,19980728154205,NULL,NULL,NULL,NULL,
839
NULL,'','',NULL,NULL)
842
$query[0][3] = <<EOF;
843
INSERT INTO my_t VALUES (3,'hello','',0,1,0,0,0,0.00,0000.00,0.0,NULL,0,00000,
844
0,0,0,NULL,19980728154205,NULL,NULL,
845
'2002-12-30 22:04:02',NULL,NULL,'','',NULL,NULL)
848
$query[0][4] = <<EOF;
849
INSERT INTO my_t VALUES (4,'hello','',0,1,0,0,0,0.00,0000.00,0.0,NULL,0,00000,
850
0,0,0,NULL,19980728154205,'1997-12-06',NULL,NULL,
851
NULL,NULL,'','',NULL,NULL)
854
$query[0][5] = <<EOF;
855
INSERT INTO my_t VALUES (5,'hello','',0,1,0,0,0,0.00,0000.00,0.0,NULL,0,00000,
856
0,0,0,NULL,19980728154205,NULL,'20:10:08',NULL,NULL,
857
NULL,'','',NULL,NULL)
860
$query[0][6] = <<EOF;
861
INSERT INTO my_t VALUES (6,'hello','',0,1,0,0,0,-0.22,0000.00,0.0,NULL,0,
862
00000,0,0,0,NULL,19980728154205,NULL,NULL,NULL,
863
NULL,NULL,'','',NULL,NULL)
866
$query[0][7] = <<EOF;
867
INSERT INTO my_t VALUES (7,'hello','',0,1,0,0,0,-0.00,0000.00,0.0,NULL,0,
868
00000,0,0,0,NULL,19980728154205,NULL,NULL,NULL,
869
NULL,NULL,'','',NULL,NULL)
872
$query[0][8] = <<EOF;
873
INSERT INTO my_t VALUES (8,'hello','',0,1,0,0,0,+0.00,0000.00,0.0,NULL,0,
874
00000,0,0,0,NULL,19980728154205,NULL,NULL,NULL,
875
NULL,NULL,'','',NULL,NULL)
878
$query[0][9] = <<EOF;
879
INSERT INTO my_t VALUES (9,'hello','',0,1,0,0,0,+0.90,0000.00,0.0,NULL,0,
880
00000,0,0,0,NULL,19980728154205,NULL,NULL,NULL,
881
NULL,NULL,'','',NULL,NULL)
884
$query[0][10] = <<EOF;
885
INSERT INTO my_t VALUES (10,'hello','',0,1,0,0,0,-999.99,0000.00,0.0,NULL,0,
886
00000,0,0,0,NULL,19980728154206,NULL,NULL,NULL,NULL,
887
NULL,'','',NULL,NULL)
890
$query[0][11] = <<EOF;
891
INSERT INTO my_t VALUES (11,'hello','',127,32767,8388607,2147483647,
892
9223372036854775807,9999.99,9999.99,
893
329999996548271212625250308919809540096.0,9.0,255,
894
65535,16777215,4294967295,18446744073709551615,
895
4294967295,00000000000000,'9999-12-31','23:59:59',
896
'9999-12-31 23:59:59',NULL,NULL,' ',' ','',
900
$query[0][12] = <<EOF;
901
INSERT INTO my_t VALUES (12,'hello','',-128,-32768,-8388608,-2147483648,
902
-9223372036854775808,-999.99,0000.00,
903
-329999996548271212625250308919809540096.0,10.0,0,
904
00000,0,0,0,00000,00000000000000,
905
'9999-12-31','23:59:59','9999-12-31 23:59:59',NULL,
906
NULL,' ,-',' ,-','','one,two,three')
909
$query[0][13] = <<EOF;
910
INSERT INTO my_t VALUES (13,'hello','',0,1,0,0,0,0.09,0000.00,0.0,NULL,0,
911
00000,0,0,0,NULL,19980728154223,NULL,NULL,NULL,
912
NULL,NULL,'','',NULL,NULL)
915
$query[0][14] = <<EOF;
916
INSERT INTO my_t VALUES (14,'hello','',0,1,0,0,0,0.00,0000.00,0.0,NULL,0,
917
00000,0,0,0,NULL,19980728154223,NULL,NULL,NULL,
918
NULL,NULL,'','',NULL,NULL)
921
$query[0][15] = <<EOF;
922
INSERT INTO my_t VALUES (15,'hello','',0,1,0,0,0,0.00,0044.00,0.0,NULL,0,
923
00000,0,0,0,NULL,19980728154223,NULL,NULL,NULL,
924
NULL,NULL,'','',NULL,NULL)
927
$query[0][16] = <<EOF;
928
INSERT INTO my_t VALUES (16,'hello','',0,1,0,0,0,0.00,9999.99,0.0,NULL,0,
929
00000,0,0,0,NULL,19980728154223,NULL,NULL,NULL,
930
NULL,NULL,'','',NULL,NULL)
933
$query[0][17] = <<EOF;
934
INSERT INTO my_t VALUES (17,'hello','',127,32767,8388607,2147483647,
935
9223372036854775807,9999.99,9999.99,
936
329999996548271212625250308919809540096.0,9.0,255,
937
65535,16777215,4294967295,18446744073709551615,
938
4294967295,00000000000000,'9999-12-31','23:59:59',
939
'9999-12-31 23:59:59',NULL,NULL,' ',' ','',
943
$query[0][18] = <<EOF;
944
INSERT INTO my_t VALUES (18,'hello','',127,32767,8388607,2147483647,
945
9223372036854775807,9999.99,9999.99,0.0,NULL,255,
946
65535,16777215,4294967295,18446744073709551615,
947
4294967295,19980728154224,NULL,NULL,NULL,NULL,
948
NULL,'','',NULL,NULL)
951
$query[0][19] = <<EOF;
952
INSERT INTO my_t VALUES (19,'hello','',127,32767,8388607,2147483647,
953
9223372036854775807,9999.99,9999.99,0.0,NULL,255,
954
65535,16777215,4294967295,0,4294967295,
955
19980728154224,NULL,NULL,NULL,NULL,NULL,'','',
959
$query[0][20] = <<EOF;
960
INSERT INTO my_t VALUES (20,'hello','',-128,-32768,-8388608,-2147483648,
961
-9223372036854775808,-999.99,0000.00,0.0,NULL,0,
962
00000,0,0,18446744073709551615,00000,19980728154224,
963
NULL,NULL,NULL,NULL,NULL,'','',NULL,NULL)
966
$query[0][21] = <<EOF;
967
INSERT INTO my_t VALUES (21,'hello','',-128,-32768,-8388608,-2147483648,
968
-9223372036854775808,-999.99,0000.00,0.0,NULL,0,
969
00000,0,0,0,00000,19980728154225,NULL,NULL,NULL,
970
NULL,NULL,'','',NULL,NULL)
973
$query[0][22] = <<EOF;
974
INSERT INTO my_t VALUES (22,NULL,'1',1,1,1,1,1,1.00,0001.00,1.0,NULL,1,00001,
975
1,1,1,00001,19980728154244,NULL,NULL,NULL,NULL,NULL,
979
$query[0][23] = <<EOF;
980
INSERT INTO my_t VALUES (23,'2','2',2,2,2,2,2,2.00,0002.00,2.0,2.0,2,00002,
981
2,2,2,00002,00000000000000,'0000-00-00','02:00:00',
982
'0000-00-00 00:00:00','2','2','2','2','','')
985
$query[0][24] = <<EOF;
986
INSERT INTO my_t VALUES (24,'3','3',3,3,3,3,3,3.00,0003.00,3.0,3.0,3,00003,
987
3,3,3,00003,00000000000000,'2000-00-03','00:00:03',
988
'0000-00-00 00:00:03','3.00','3.00','3.00','3.00',
992
$query[0][25] = <<EOF;
993
INSERT INTO my_t VALUES (25,'-4.7','-4.7',-5,-5,-5,-5,-5,-4.70,0000.00,-4.7,
994
-4.7,0,00000,0,0,0,00000,00000000000000,'0000-00-00',
995
'00:00:00','0000-00-00 00:00:00','-4.70','-4.70',
996
'-4.70','-4.70','','three')
999
$query[0][26] = <<EOF;
1000
INSERT INTO my_t VALUES (26,'+0.09','+0.09',0,0,0,0,0,+0.09,0000.00,0.1,0.1,
1001
0,00000,0,0,0,00000,00000000000000,'0000-00-00',
1002
'00:09:00','0000-00-00 00:00:00','+0.09','+0.09',
1003
'+0.09','+0.09','','')
1005
chop($query[0][26]);
1006
$query[0][27] = <<EOF;
1007
INSERT INTO my_t VALUES (27,'1','1',1,1,1,1,1,1.00,0001.00,1.0,1.0,1,00001,
1008
1,1,1,00001,00000000000000,'2000-00-01','00:00:01',
1009
'0000-00-00 00:00:01','1','1','1','1','one','one')
1011
chop($query[0][27]);
1012
$query[0][28] = <<EOF;
1013
INSERT INTO my_t VALUES (28,'-1','-1',-1,-1,-1,-1,-1,-1.00,0000.00,-1.0,-1.0,
1014
0,00000,0,0,18446744073709551615,00000,
1015
00000000000000,'0000-00-00','00:00:00',
1016
'0000-00-00 00:00:00','-1','-1','-1','-1','',
1019
chop($query[0][28]);
1020
$query[0][29] = <<EOF;
1021
INSERT INTO my_t VALUES (29,'','',0,0,0,0,0,0.00,0000.00,0.0,0.0,0,00000,0,0,
1022
0,00000,00000000000000,'0000-00-00','00:00:00',
1023
'0000-00-00 00:00:00','','','','','','')
1025
chop($query[0][29]);
1026
$query[1][0] = "CREATE TABLE my_t (str char(64))";
1027
$query[1][1] = "INSERT INTO my_t VALUES ('5.5')";
1028
$query[1][2] = "INSERT INTO my_t VALUES ('6.8')";
1029
$query[2][0] = "CREATE TABLE my_t (str char(64))";
1030
$query[2][1] = <<EOF;
1031
INSERT INTO my_t VALUES
1032
('9999999999993242342442323423443534529999.02235000054213')
1035
$query[3][0] = "CREATE TABLE my_t (str char(64))";
1036
$query[3][1] = <<EOF;
1037
INSERT INTO my_t VALUES
1038
('8494357934579347593475349579347593845948793454350349543348736453')
1041
$query[4][0] = "CREATE TABLE my_t (d double(20,10))";
1042
$query[4][1] = "INSERT INTO my_t VALUES (10.0000000000)";
1043
$query[4][2] = "INSERT INTO my_t VALUES (-10.0000000000)";
1044
$query[5][0] = "CREATE TABLE my_t (d double(20,10))";
1045
$query[5][1] = "INSERT INTO my_t VALUES (50000.0000000000)";
1046
$query[6][0] = "CREATE TABLE my_t (d double(20,10))";
1047
$query[6][1] = "INSERT INTO my_t VALUES (5000000.0000000000)";
1048
$query[7][0] = "CREATE TABLE my_t (d double(20,10))";
1049
$query[7][1] = "INSERT INTO my_t VALUES (500000000.0000000000)";
1050
$query[8][0] = "CREATE TABLE my_t (d double(20,10))";
1051
$query[8][1] = "INSERT INTO my_t VALUES (50000000000.0000000000)";
1052
$query[8][2] = "INSERT INTO my_t VALUES (NULL)";
1053
$query[9][0] = "CREATE TABLE my_t (d double(60,10))";
1054
$query[9][1] = "INSERT INTO my_t VALUES (93850983054983462912.0000000000)";
1055
$query[9][2] = "INSERT INTO my_t VALUES (93850983.3495762944)";
1056
$query[9][3] = <<EOF;
1057
INSERT INTO my_t VALUES (938509832438723448371221493568778534912.0000000000)
1060
$query[10][0] = "CREATE TABLE my_t (i int(11))";
1061
$query[10][1] = "INSERT INTO my_t VALUES (-100)";
1062
$query[10][2] = "INSERT INTO my_t VALUES (-200)";
1063
$query[11][0] = "CREATE TABLE my_t (s char(64))";
1064
$query[11][1] = "INSERT INTO my_t VALUES ('100.')";
1065
$query[12][0] = "CREATE TABLE my_t (s char(64))";
1066
$query[12][1] = "INSERT INTO my_t VALUES ('1e+50')";
1067
$query[13][0] = "CREATE TABLE my_t (s char(64))";
1068
$query[13][1] = "INSERT INTO my_t VALUES ('1E+50u')";
1069
$query[14][0] = "CREATE TABLE my_t (s char(64))";
1070
$query[14][1] = "INSERT INTO my_t VALUES ('1EU50')";
1071
$query[15][0] = "CREATE TABLE my_t (s char(64))";
1072
$query[15][1] = "INSERT INTO my_t VALUES ('123.000')";
1073
$query[15][2] = "INSERT INTO my_t VALUES ('123.000abc')";
1074
$query[16][0] = "CREATE TABLE my_t (s char(128))";
1075
$query[16][1] = <<EOF;
1076
INSERT INTO my_t VALUES
1077
('-999999999999999999999999999999999999999999999999999999999999999999999999')
1079
chop($query[16][1]);
1080
$query[17][0] = "CREATE TABLE my_t (s char(128))";
1081
$query[17][1] = "INSERT INTO my_t VALUES ('-9999999999999999')";
1082
$query[18][0] = "CREATE TABLE my_t (s char(128))";
1083
$query[18][1] = "INSERT INTO my_t VALUES ('28446744073709551615001')";
1084
$query[18][2] = "INSERT INTO my_t VALUES ('184467440737095516150000000')";
1085
$query[19][0] = "CREATE TABLE my_t (s char(128))";
1086
$query[19][1] = "INSERT INTO my_t VALUES ('18446744073709551615')";
1087
$query[20][0] = "CREATE TABLE my_t (s char(128))";
1088
$query[20][1] = "INSERT INTO my_t VALUES ('18446744073709551616')";
1089
$query[21][0] = "CREATE TABLE my_t (s char(64))";
1090
$query[21][1] = "INSERT INTO my_t VALUES ('00740')";
1091
$query[21][2] = "INSERT INTO my_t VALUES ('00740.')";
1092
$query[22][0] = "CREATE TABLE my_t (s char(128))";
1093
$query[22][1] = "INSERT INTO my_t VALUES ('-18446744073709551615')";
1094
$query[23][0] = "CREATE TABLE my_t (s char(32))";
1095
$query[23][1] = "INSERT INTO my_t VALUES ('740')";
1096
$query[23][2] = "INSERT INTO my_t VALUES ('12345')";
1097
$query[23][3] = "INSERT INTO my_t VALUES ('12345')";
1098
$query[24][0] = "CREATE TABLE my_t (s char(32))";
1099
$query[24][1] = "INSERT INTO my_t VALUES ('00740')";
1100
$query[24][2] = "INSERT INTO my_t VALUES ('00730')";
1101
$query[24][3] = "INSERT INTO my_t VALUES ('00720')";
1102
$query[24][4] = "INSERT INTO my_t VALUES ('12345.02')";
1103
$query[25][0] = "CREATE TABLE my_t (i bigint(20) unsigned)";
1104
$query[25][1] = "INSERT INTO my_t VALUES (3000)";
1105
$query[25][2] = "INSERT INTO my_t VALUES (NULL)";
1106
$query[25][3] = "INSERT INTO my_t VALUES (900000000003)";
1107
$query[25][4] = "INSERT INTO my_t VALUES (90)";
1108
$query[26][0] = "CREATE TABLE my_t (i int(11))";
1109
$query[26][1] = "INSERT INTO my_t VALUES (NULL)";
1110
$query[27][0] = "CREATE TABLE my_t (d date)";
1111
$query[27][1] = "INSERT INTO my_t VALUES ('1999-05-01')";
1112
$query[28][0] = "CREATE TABLE my_t (y year(4))";
1113
$query[28][1] = "INSERT INTO my_t VALUES (1999)";
1114
$query[29][0] = "CREATE TABLE my_t (s char(128))";
1115
$query[29][1] = "INSERT INTO my_t VALUES ('453453444451.7976')";
1116
$query[30][0] = "CREATE TABLE my_t (s char(128))";
1117
$query[30][1] = "INSERT INTO my_t VALUES('')";
1118
$query[31][0] = "CREATE TABLE my_t (s char(128))";
1119
$query[31][1] = "INSERT INTO my_t VALUES(' ')";