From 3feff6024c08c60dd9189d2e7ed8862a1a87fbdb Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 18 Oct 2000 08:03:55 -0500 Subject: [PATCH] sel000029.xml Escaped &,< chars. sel000022.xml Escaped &,< chars. sel000021.xml Escaped &,< chars. sel000020.xml Escaped &,< chars. sel000011.xml Escaped &,< chars. sel000010.xml Escaped &,< chars. translate-tests BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/mybin/translate-tests select.tst Marked where `ok' tests end. select.res Added first 30 tests into test suite, left marker. sel000004.result BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/r/3.23/sel000004.result sel000005.result BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/r/3.23/sel000005.result sel000006.result BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/r/3.23/sel000006.result sel000007.result BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/r/3.23/sel000007.result sel000008.result BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/r/3.23/sel000008.result sel000009.result BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/r/3.23/sel000009.result sel000010.result BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/r/3.23/sel000010.result sel000011.result BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/r/3.23/sel000011.result sel000012.result BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/r/3.23/sel000012.result sel000013.result BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/r/3.23/sel000013.result sel000014.result BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/r/3.23/sel000014.result sel000015.result BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/r/3.23/sel000015.result sel000016.result BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/r/3.23/sel000016.result sel000017.result BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/r/3.23/sel000017.result sel000018.result BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/r/3.23/sel000018.result sel000019.result BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/r/3.23/sel000019.result sel000020.result BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/r/3.23/sel000020.result sel000021.result BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/r/3.23/sel000021.result sel000022.result BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/r/3.23/sel000022.result sel000023.result BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/r/3.23/sel000023.result sel000024.result BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/r/3.23/sel000024.result sel000025.result BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/r/3.23/sel000025.result sel000026.result BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/r/3.23/sel000026.result sel000027.result BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/r/3.23/sel000027.result sel000028.result BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/r/3.23/sel000028.result sel000029.result BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/r/3.23/sel000029.result sel000030.result BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/r/3.23/sel000030.result sel000015.xml BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000015.xml sel000010.xml BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000010.xml sel000011.xml BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000011.xml sel000020.xml BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000020.xml sel000021.xml BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000021.xml sel000012.xml BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000012.xml sel000013.xml BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000013.xml sel000014.xml BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000014.xml sel000016.xml BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000016.xml sel000017.xml BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000017.xml sel000018.xml BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000018.xml sel000019.xml BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000019.xml sel000022.xml BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000022.xml sel000029.xml BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000029.xml sel000023.xml BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000023.xml sel000024.xml BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000024.xml sel000025.xml BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000025.xml sel000026.xml BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000026.xml sel000027.xml BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000027.xml sel000028.xml BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000028.xml sel000009.xml BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000009.xml sel000008.xml BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000008.xml sel000007.xml BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000007.xml sel000006.xml BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000006.xml sel000005.xml BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000005.xml sel000004.xml BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000004.xml sel000030.xml BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/xml/tests/sel000030.xml mysql-test_V1.9.pl BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/chew_on_this/mysql-test_V1.9.pl stop-mysqld BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/mybin/stop-mysqld start-mysqld BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/mybin/start-mysqld select.res BitKeeper file /home/mwagner/work/bk/mysql/mysql-test/chew_on_this/select.res mysql-test/mybin/start-mysqld: ***MISSING WEAVE*** mysql-test/mybin/stop-mysqld: ***MISSING WEAVE*** mysql-test/chew_on_this/select.res: ***MISSING WEAVE*** mysql-test/chew_on_this/select.tst: Marked where `ok' tests end. mysql-test/mybin/translate-tests: ***MISSING WEAVE*** mysql-test/xml/tests/sel000010.xml: Escaped &,< chars. mysql-test/xml/tests/sel000011.xml: Escaped &,< chars. mysql-test/xml/tests/sel000020.xml: Escaped &,< chars. mysql-test/xml/tests/sel000021.xml: Escaped &,< chars. mysql-test/xml/tests/sel000022.xml: Escaped &,< chars. mysql-test/xml/tests/sel000029.xml: Escaped &,< chars. --- mysql-test/chew_on_this/mysql-test_V1.9.pl | 1121 ++++++++++++++++++++ mysql-test/chew_on_this/select.tst | 8 + mysql-test/r/3.23/sel000004.result | 2 + mysql-test/r/3.23/sel000005.result | 2 + mysql-test/r/3.23/sel000006.result | 2 + mysql-test/r/3.23/sel000007.result | 2 + mysql-test/r/3.23/sel000008.result | 2 + mysql-test/r/3.23/sel000009.result | 2 + mysql-test/r/3.23/sel000010.result | 2 + mysql-test/r/3.23/sel000011.result | 2 + mysql-test/r/3.23/sel000012.result | 2 + mysql-test/r/3.23/sel000013.result | 2 + mysql-test/r/3.23/sel000014.result | 2 + mysql-test/r/3.23/sel000015.result | 2 + mysql-test/r/3.23/sel000016.result | 2 + mysql-test/r/3.23/sel000017.result | 2 + mysql-test/r/3.23/sel000018.result | 2 + mysql-test/r/3.23/sel000019.result | 2 + mysql-test/r/3.23/sel000020.result | 2 + mysql-test/r/3.23/sel000021.result | 2 + mysql-test/r/3.23/sel000022.result | 2 + mysql-test/r/3.23/sel000023.result | 2 + mysql-test/r/3.23/sel000024.result | 2 + mysql-test/r/3.23/sel000025.result | 2 + mysql-test/r/3.23/sel000026.result | 2 + mysql-test/r/3.23/sel000027.result | 2 + mysql-test/r/3.23/sel000028.result | 2 + mysql-test/r/3.23/sel000029.result | 2 + mysql-test/r/3.23/sel000030.result | 2 + mysql-test/xml/tests/sel000004.xml | 17 + mysql-test/xml/tests/sel000005.xml | 17 + mysql-test/xml/tests/sel000006.xml | 17 + mysql-test/xml/tests/sel000007.xml | 17 + mysql-test/xml/tests/sel000008.xml | 17 + mysql-test/xml/tests/sel000009.xml | 17 + mysql-test/xml/tests/sel000010.xml | 17 + mysql-test/xml/tests/sel000011.xml | 17 + mysql-test/xml/tests/sel000012.xml | 16 + mysql-test/xml/tests/sel000013.xml | 16 + mysql-test/xml/tests/sel000014.xml | 17 + mysql-test/xml/tests/sel000015.xml | 17 + mysql-test/xml/tests/sel000016.xml | 17 + mysql-test/xml/tests/sel000017.xml | 17 + mysql-test/xml/tests/sel000018.xml | 17 + mysql-test/xml/tests/sel000019.xml | 17 + mysql-test/xml/tests/sel000020.xml | 17 + mysql-test/xml/tests/sel000021.xml | 17 + mysql-test/xml/tests/sel000022.xml | 17 + mysql-test/xml/tests/sel000023.xml | 17 + mysql-test/xml/tests/sel000024.xml | 17 + mysql-test/xml/tests/sel000025.xml | 17 + mysql-test/xml/tests/sel000026.xml | 17 + mysql-test/xml/tests/sel000027.xml | 17 + mysql-test/xml/tests/sel000028.xml | 17 + mysql-test/xml/tests/sel000029.xml | 17 + mysql-test/xml/tests/sel000030.xml | 17 + 56 files changed, 1640 insertions(+) create mode 100644 mysql-test/chew_on_this/mysql-test_V1.9.pl create mode 100644 mysql-test/r/3.23/sel000004.result create mode 100644 mysql-test/r/3.23/sel000005.result create mode 100644 mysql-test/r/3.23/sel000006.result create mode 100644 mysql-test/r/3.23/sel000007.result create mode 100644 mysql-test/r/3.23/sel000008.result create mode 100644 mysql-test/r/3.23/sel000009.result create mode 100644 mysql-test/r/3.23/sel000010.result create mode 100644 mysql-test/r/3.23/sel000011.result create mode 100644 mysql-test/r/3.23/sel000012.result create mode 100644 mysql-test/r/3.23/sel000013.result create mode 100644 mysql-test/r/3.23/sel000014.result create mode 100644 mysql-test/r/3.23/sel000015.result create mode 100644 mysql-test/r/3.23/sel000016.result create mode 100644 mysql-test/r/3.23/sel000017.result create mode 100644 mysql-test/r/3.23/sel000018.result create mode 100644 mysql-test/r/3.23/sel000019.result create mode 100644 mysql-test/r/3.23/sel000020.result create mode 100644 mysql-test/r/3.23/sel000021.result create mode 100644 mysql-test/r/3.23/sel000022.result create mode 100644 mysql-test/r/3.23/sel000023.result create mode 100644 mysql-test/r/3.23/sel000024.result create mode 100644 mysql-test/r/3.23/sel000025.result create mode 100644 mysql-test/r/3.23/sel000026.result create mode 100644 mysql-test/r/3.23/sel000027.result create mode 100644 mysql-test/r/3.23/sel000028.result create mode 100644 mysql-test/r/3.23/sel000029.result create mode 100644 mysql-test/r/3.23/sel000030.result create mode 100644 mysql-test/xml/tests/sel000004.xml create mode 100644 mysql-test/xml/tests/sel000005.xml create mode 100644 mysql-test/xml/tests/sel000006.xml create mode 100644 mysql-test/xml/tests/sel000007.xml create mode 100644 mysql-test/xml/tests/sel000008.xml create mode 100644 mysql-test/xml/tests/sel000009.xml create mode 100644 mysql-test/xml/tests/sel000010.xml create mode 100644 mysql-test/xml/tests/sel000011.xml create mode 100644 mysql-test/xml/tests/sel000012.xml create mode 100644 mysql-test/xml/tests/sel000013.xml create mode 100644 mysql-test/xml/tests/sel000014.xml create mode 100644 mysql-test/xml/tests/sel000015.xml create mode 100644 mysql-test/xml/tests/sel000016.xml create mode 100644 mysql-test/xml/tests/sel000017.xml create mode 100644 mysql-test/xml/tests/sel000018.xml create mode 100644 mysql-test/xml/tests/sel000019.xml create mode 100644 mysql-test/xml/tests/sel000020.xml create mode 100644 mysql-test/xml/tests/sel000021.xml create mode 100644 mysql-test/xml/tests/sel000022.xml create mode 100644 mysql-test/xml/tests/sel000023.xml create mode 100644 mysql-test/xml/tests/sel000024.xml create mode 100644 mysql-test/xml/tests/sel000025.xml create mode 100644 mysql-test/xml/tests/sel000026.xml create mode 100644 mysql-test/xml/tests/sel000027.xml create mode 100644 mysql-test/xml/tests/sel000028.xml create mode 100644 mysql-test/xml/tests/sel000029.xml create mode 100644 mysql-test/xml/tests/sel000030.xml diff --git a/mysql-test/chew_on_this/mysql-test_V1.9.pl b/mysql-test/chew_on_this/mysql-test_V1.9.pl new file mode 100644 index 00000000000..129ec41b4d5 --- /dev/null +++ b/mysql-test/chew_on_this/mysql-test_V1.9.pl @@ -0,0 +1,1121 @@ +#!/usr/bin/perl +# +# Tests MySQL. Output is given to the stderr. Use +# diff to check the possible differencies. +# + +use DBI; +use Getopt::Long; + +$VER = "1.9"; +$| = 1; + +$opt_db = "test"; +$opt_user = $opt_password = $opt_without = ""; +$opt_host = "localhost"; +$opt_port = "3306"; +$opt_socket = "/tmp/mysql.sock"; +$opt_help = 0; + +$NO_ERR = 0; # No error +$EXP_ERR = 1; # Expect error +$MAY_ERR = 2; # Maybe error +$HS = 0; # Horizontal style of output +$VS = 1; # Vertical style of output +$VERBOSE = 0; # Print the results +$SILENT = 1; # No output + +@test_packages = ("FUNC", "PROC", "SHOW"); + +#### +#### main program +#### + +main(); + +sub main() +{ + GetOptions("help", "db=s", "port=i", "host=s", "password=s", "user=s", "socket=s", + "without=s") || usage(); + + usage() if ($opt_help); + + $dbh = DBI->connect("DBI:mysql:$opt_db:$opt_host:port=$opt_port:mysql_socket=$opt_socket", $opt_user, $opt_password, { PrintError => 0 }) + || die $DBI::errstr; + +## QQ ###################################### + +$sth = $dbh->prepare("show felds from t2") +|| die "Couldn't prepare query: $DBI::errstr\n"; +if (!$sth->execute) +{ + print "Couldn't execute query: $DBI::errstr\n"; + $sth->finish; + die; +} +while (($row = $sth->fetchrow_arrayref)) +{ + print "$row->[1]\n"; +} + + +exit(0); + +## QQ ###################################### + + printf("####\n#### THIS IS mysql-test script RUNNING\n"); + printf("#### mysql-test version $VER\n####\n"); + + test_mysql_functions() if (&chk_package($opt_without, $test_packages[0])); + test_mysql_procedures() if (&chk_package($opt_without, $test_packages[1])); + test_mysql_show() if (&chk_package($opt_without, $test_packages[2])); + + print "\n"; + return; +} + +#### +#### test show -command of MySQL +#### + +sub test_mysql_show +{ + my ($query, $i); + + $query = create_show_tables(); + &exec_query(["drop table my_t"], $MAY_ERR, $SILENT); + for ($i = 0; $query[$i]; $i++) + { + &exec_query([$query[$i]], $NO_ERR, $VERBOSE, $HS); + &exec_query(["show fields from my_t"], $NO_ERR, $VERBOSE, $HS); + &exec_query(["show keys from my_t"], $NO_ERR, $VERBOSE, $HS); + &exec_query(["drop table my_t"], $NO_ERR, $SILENT); + } +} + +sub create_show_tables +{ + my ($query, $i); + + $query[0] = <[0][0]) + { + printf("No function found!\n"); + if (!$force) { die; } + } + + for ($i = 0; $func->[$i][0]; $i++) + { + $tbused = 0; + $no_arg = 0; + for ($j = 0; $j < $count && !$no_arg; $j++) + { + if ($tbused || $no_arg) { next; } + $query = "select $func->[$i][0]("; + #search the values for the args + for ($k = 0; $k < length($func->[$i][1]) && !$no_arg; $k++) + { + if ($mix) + { + $arg = $j + 1 + $k; + } + else + { + $arg = $j + 1; + } + if (substr($func->[$i][1], $k, 1) eq 'E') + { + $no_arg = 1; + next; + } + if ($k) { $query .= ','; } + + if (substr($func->[$i][1], $k, 1) eq 'S') + { + $query .= &find_value(\@value, 'S', $arg); + } + elsif (substr($func->[$i][1], $k, 1) eq 'N') + { + $query .= &find_value(\@value, 'N', $arg); + } + elsif (substr($func->[$i][1], $k, 1) eq 'Z') + { + $query .= &find_value(\@value, 'Z', $arg); + } + elsif ((substr($func->[$i][1], $k, 1) eq 'R')) + { + $query .= &find_value(\@value, 'R', $arg); + } + elsif (substr($func->[$i][1], $k, 1) eq 'T') + { + $query .= &find_value(\@value, 'T', $arg); + } + elsif (substr($func->[$i][1], $k, 1) eq 'D') + { + $query .= &find_value(\@value, 'D', $arg); + } + elsif (substr($func->[$i][1], $k, 1) eq 'B') + { + $query .= &find_value(\@value, 'B', $arg); + } + elsif (substr($func->[$i][1], $k, 1) eq 'C') + { + $query .= &find_value(\@value, 'C', $arg); + } + elsif (substr($func->[$i][1], $k, 1) eq 'F') + { + $query .= &find_value(\@value, 'F', $arg); + } + elsif (substr($func->[$i][1], $k, 1) eq '.') + { + chop($query); + for ($ulimit = 0; $ulimit < $ulargs; $ulimit++) + { + $query .= ','; + $query .= &find_value(\@value, + substr($func->[$i][1], $k - 1, 1), + $j + $ulimit + 2); + } + } + elsif (substr($func->[$i][1], $k, 1) eq 'A') + { + for ($tbinfo = 1; substr($table_info->[$tbinfo], 0, 1) ne + substr($func->[$i][1], $k + 1, 1); $tbinfo++) + { + if (!defined($table_info->[$tbinfo])) + { + printf("Illegal function structure!\n"); + printf("A table was needed, but no type specified!\n"); + printf("Unready query was: $query\n"); + if (!$force) { die; } + else { next; } + } + } + if ($k) { $query .= ","; } + $query .= substr($table_info->[$tbinfo], 1, + length($table_info->[$tbinfo]) - 1); + $k++; + $tbused = 1; + } + else + { + printf("Not a valid type: \n"); + printf(substr($func->[$i][1], $k, 1)); + printf("\nAttempted to be used with unready query: \n"); + printf("$query\n"); + } + } + $query .= ")"; + if ($tbused) + { + $query .= " from "; + $query .= $table_info->[0]; + } + if (!($sth = $dbh->prepare($query))) + { + printf("Couldn't prepare: $query\n"); + if (!$force) { die; } + } + if (!$sth->execute) + { + printf("Execution failed: $DBI::errstr\n"); + printf("Attempted query was:\n$query\n"); + $sth->finish; + if (!$force) { die; } + } + else + { + printf("mysql> $query;\n"); + display($sth, 1); + printf("Query OK\n\n"); + } + } + } +} + +#### +#### mk_str returns a string where the first arg is repeated second arg times +#### if repeat is 1, return the original str +#### + +sub mk_str() +{ + my ($str, $repeat) = @_; + my ($res_str); + + if ($repeat <= 0) + { + die "Invalid repeat times!\n"; + } + + for ($repeat--, $res_str = $str; $repeat > 0; $repeat--) + { + $res_str .= $str; + } + return $res_str; +} + +#### +#### find_value: returns a value from list of values +#### args: $values: list of values +#### $type: type of argument (S = string, N = integer etc.) +#### $ordinal: the ordinal number of an argument in the list +#### + +sub find_value() +{ + my ($values, $type, $ordinal) = @_; + my ($total, $i, $j, $tmp, $val); + + $total = -1; # The first one is the type + + for ($i = 0; $values[$i][0]; $i++) + { + if ($values[$i][0] eq $type) + { + $tmp = $values[$i]; + foreach $val (@$tmp) { $total++; } + for ( ;$total < $ordinal; ) + { + $ordinal -= $total; + } + return $values[$i][$ordinal]; + } + } + printf("No type '$type' found in values\n"); + die; +} + +#### +#### exec_query: execute a query, print information if wanted and exit +#### args: $queries: list of queries to be executed +#### $expect_error: if 0, error is not expected. In this case if an +#### error occurs, inform about it and quit +#### if 1, error is expected. In this case if sql server +#### doesn't give an error message, inform about it +#### and quit +#### if 2, error may happen or not, don't care +#### $silent: if true, reduce output +#### $style: type of output, 0 == horizontal, 1 == vertical +#### + +sub exec_query() +{ + my ($queries, $expect_error, $silent, $style) = @_; + my ($query); + + foreach $query (@$queries) + { + if (!($sth = $dbh->prepare($query))) + { + printf("Couldn't prepare: $query\n"); + die; + } + if (!$sth->execute) + { + if ($expect_error == 1) + { + printf("An invalid instruction was purposely made,\n"); + printf("server failed succesfully:\n"); + printf("$DBI::errstr\n"); + printf("Everything OK, continuing...\n"); + return; + } + if ($expect_error != 2) + { + printf("Execution failed: $DBI::errstr\n"); + printf("Attempted query was:\n$query\n"); + die; + } + } + if ($expect_error == 1) + { + printf("An invalid instruction was purposely made,\n"); + printf("server didn't note, ALARM!\n"); + printf("The query made was: $query\n"); + printf("The output from the server:\n"); + } + if ($expect_error == 2) { return; } + if (!$silent) { printf("mysql> $query;\n"); } + display($sth, $style); + if (!$silent) { printf("Query OK\n\n"); } + if ($expect_error) { die; } + } + return; +} + +#### +#### Display to stderr +#### Args: 1: ($sth) statememt handler +#### 2: ($style) 0 == horizontal style, 1 == vertical style +#### + +sub display() +{ + my ($sth, $style) = @_; + my (@data, @max_length, $row, $nr_rows, $nr_cols, $i, $j, $tmp, $mxl); + + # Store the field names and values in @data. + # Store the max field lengths in @max_length + for ($i = 0; ($row = $sth->fetchrow_arrayref); $i++) + { + if (!$i) + { + $nr_cols = $#$row; + for ($j = 0; $j <= $#$row; $j++) + { + $data[$i][$j] = $sth->{NAME}->[$j]; + $max_length[$j] = length($data[$i][$j]); + } + $i++; + } + for ($j = 0; $j <= $#$row; $j++) + { + $data[$i][$j] = $row->[$j]; + $max_length[$j] = $tmp if ($max_length[$j] < + ($tmp = length($data[$i][$j]))); + } + } + if (!($nr_rows = $i)) + { + return; + } + # Display data + if ($style == 0) + { + for ($i = 0; $i < $nr_rows; $i++) + { + if (!$i) + { + for ($j = 0; $j <= $nr_cols; $j++) + { + print "+"; print "-" x ($max_length[$j] + 2); + } + print "+\n"; + } + print "|"; + for ($j = 0; $j <= $nr_cols; $j++) + { + print " "; + if (defined($data[$i][$j])) + { + print $data[$i][$j]; + $tmp = length($data[$i][$j]); + } + else + { + print "NULL"; + $tmp = 4; + } + print " " x ($max_length[$j] - $tmp); + print " |"; + } + print "\n"; + if (!$i) + { + for ($j = 0; $j <= $nr_cols; $j++) + { + print "+"; print "-" x ($max_length[$j] + 2); + } + print "+\n"; + } + } + for ($j = 0; $j <= $nr_cols; $j++) + { + print "+"; print "-" x ($max_length[$j] + 2); + } + print "+\n"; + return; + } + if ($style == 1) + { + for ($i = 0; $max_length[$i]; $i++) + { + $mxl = $max_length[$i] if ($mxl < $max_length[$i]); + } + + for ($i = 1; $i < $nr_rows; $i++) + { + print "*" x 27; + print " " . $i . ". row "; + print "*" x 27; + print "\n"; + for ($j = 0; $j <= $nr_cols; $j++) + { + print " " x ($mxl - length($data[0][$j])); + print "$data[0][$j]: "; + if (defined($data[$i][$j])) + { + print "$data[$i][$j] \n"; + } + else + { + print "NULL\n"; + } + } + } + return; + } +} + +#### +#### usage +#### + +sub usage +{ + print <", "#__#"], + ["N", -1000, -500, -100, -1, 0, 1, 40, 50, 70, 90, + 100, 500, 1000], + ["Z", -100, -50, 200, 1000], + ["R", -500.5, -10.333, 100.667, 400.0], + ["T", 19980728154204, 19980728154205, 19980728154206, + 19980728154207], + ["D", "'1997-12-06'", "'1997-12-07'", "'1997-12-08'", + "'1997-12-09'"], + ["B", 1, 0, 0, 1], + ["C", "'a'", "'e'", "'r'", "'q'"], + ["F", "'%a'", "'%b'", "'%d'", "'%H'"]); + &test_func(\@functions, \@values, 4, 5, ["mysql_test1","Zi","Rd"]); + + printf("\n####\n#### Second basic test part\n####\n\n"); + + @values = (["S", "'a'", "'BC'", "'def'", "'HIJK'", "'lmnop'", "'QRSTUV'"], + ["N", 0, 1, 2, 3, 4, 5], + ["Z", 0, 1, 2, 3, 4, 5], + ["R", 0, 1, 2, 3, 4, 5], + ["T", 19990608234530, 20000709014631, 20010810024732, + 20020911034833, 20031012044934, 20041113055035], + ["D", "'1999-06-08'", "'2000-07-09'", "'2001-08-10'", + "'2002-09-11'", "'2003-10-12'", "'2004-11-13'"], + ["B", 0, 1, 0, 1, 0, 1], + ["C", "'a'", "'BC'", "'def'", "'HIJK'", "'lmnop'", "'QRSTUV'"], + ["F", "'%a'", "'%b'", "'%d'", "'%h'", "'%H'", "'%i'"]); + &test_func(\@functions, \@values, 6, 6, ["mysql_test1","Zi","Rd"], 0, 1); + + printf("\n####\n#### Third basic test part\n####\n\n"); + + @values = (["S", "'Monty'", "'Jani'", "'MySQL'", "''"], + ["N", 10, 54, -70, -499], + ["Z", 11.03, "'Abo'", 54.333, "''"], + ["R", 12, "'gnome'", -34.211, "''"], + ["T", 3, "'Redhat'", -19984021774433, "''"], + ["D", "'1990-01-31'", "'-3333-10-23'", -5631_23_12, "''"], + ["B", 0, "'asb'", -4, "''"], + ["C", "'a'", 503, -45353453, "''"], + ["F", "'%a'", -231, "'Mitsubishi'", "''"]); + &test_func(\@functions, \@values, 3, 3, ["mysql_test1","Zi","Rd"], 0, 1); + + &exec_query(["delete from mysql_test1"], $NO_ERR, $SILENT); + + #### + #### Null tests + #### + + printf("\n\n####\n#### NULL TESTS FOR FUNCTIONS\n####\n\n\n"); + + &exec_query(["insert into mysql_test1 values(null,null)"], $NO_ERR, + $SILENT); + @values = (["S", "NULL"], + ["N", "NULL"], + ["Z", "NULL"], + ["R", "NULL"], + ["T", "NULL"], + ["D", "NULL"], + ["B", "NULL"], + ["C", "NULL"], + ["F", "NULL"]); + &test_func(\@functions, \@values, 1, 5, ["mysql_test1","Zi","Rd"], 1); + &exec_query(["delete from mysql_test1"], $NO_ERR, $SILENT); + + #### + #### Tests to fulfill the main part of function tests above + #### + + printf("\n\n####\n#### FULFILL TESTS \n####\n\n\n"); + + &exec_query(["drop table my_t"], $MAY_ERR, $SILENT); + &exec_query(["create table my_t (s1 char(64), s2 char(64))"], + $NO_ERR, $VERBOSE, $HS); + $query = <> 2 4 >> 63 1<< 63 >> 60 +4294967296 -9223372036854775808 0 1 0 8 diff --git a/mysql-test/r/3.23/sel000012.result b/mysql-test/r/3.23/sel000012.result new file mode 100644 index 00000000000..579fe8d87a3 --- /dev/null +++ b/mysql-test/r/3.23/sel000012.result @@ -0,0 +1,2 @@ +10 10.0 10. .1e+2 100.0e-1 +10 10.0 10 10 10 diff --git a/mysql-test/r/3.23/sel000013.result b/mysql-test/r/3.23/sel000013.result new file mode 100644 index 00000000000..eda7608ef4d --- /dev/null +++ b/mysql-test/r/3.23/sel000013.result @@ -0,0 +1,2 @@ +6e-05 -6e-05 --6e-05 -6e-05+1.000000 +6e-05 -6e-05 6e-05 0.99994 diff --git a/mysql-test/r/3.23/sel000014.result b/mysql-test/r/3.23/sel000014.result new file mode 100644 index 00000000000..c9c359068ca --- /dev/null +++ b/mysql-test/r/3.23/sel000014.result @@ -0,0 +1,2 @@ +0 256 00000000000000065536 2147483647 -2147483648 2147483648 +4294967296 +0 256 65536 2147483647 -2147483648 2147483648 0 diff --git a/mysql-test/r/3.23/sel000015.result b/mysql-test/r/3.23/sel000015.result new file mode 100644 index 00000000000..e4fca79f398 --- /dev/null +++ b/mysql-test/r/3.23/sel000015.result @@ -0,0 +1,2 @@ +922337203685477580 92233720368547758000 +922337203685477580 92233720368547758080 diff --git a/mysql-test/r/3.23/sel000016.result b/mysql-test/r/3.23/sel000016.result new file mode 100644 index 00000000000..58384e104cc --- /dev/null +++ b/mysql-test/r/3.23/sel000016.result @@ -0,0 +1,2 @@ +-922337203685477580 -92233720368547758000 +-922337203685477580 -92233720368547758080 diff --git a/mysql-test/r/3.23/sel000017.result b/mysql-test/r/3.23/sel000017.result new file mode 100644 index 00000000000..d68bb440274 --- /dev/null +++ b/mysql-test/r/3.23/sel000017.result @@ -0,0 +1,2 @@ +9223372036854775807 -009223372036854775808 +9223372036854775807 -9223372036854775808 diff --git a/mysql-test/r/3.23/sel000018.result b/mysql-test/r/3.23/sel000018.result new file mode 100644 index 00000000000..1155ffd553e --- /dev/null +++ b/mysql-test/r/3.23/sel000018.result @@ -0,0 +1,2 @@ ++9999999999999999999 -9999999999999999999 +10000000000000000000 -10000000000000000000 diff --git a/mysql-test/r/3.23/sel000019.result b/mysql-test/r/3.23/sel000019.result new file mode 100644 index 00000000000..56e8bfebdcd --- /dev/null +++ b/mysql-test/r/3.23/sel000019.result @@ -0,0 +1,2 @@ +DEGREES(PI()) RADIANS(360) +180 6.2831853071796 diff --git a/mysql-test/r/3.23/sel000020.result b/mysql-test/r/3.23/sel000020.result new file mode 100644 index 00000000000..3d3b68fca73 --- /dev/null +++ b/mysql-test/r/3.23/sel000020.result @@ -0,0 +1,2 @@ +0=0 1>0 1>=1 1<0 1<=0 1!=0 STRCMP("abc","abcd") STRCMP("b","a") STRCMP("a","a") +1 1 1 0 0 1 -1 1 0 diff --git a/mysql-test/r/3.23/sel000021.result b/mysql-test/r/3.23/sel000021.result new file mode 100644 index 00000000000..03ab284ac5d --- /dev/null +++ b/mysql-test/r/3.23/sel000021.result @@ -0,0 +1,2 @@ +"a"<"b" "a"<="b" "b">="a" "b">"a" "a"="A" "a"<>"b" +1 1 1 1 1 1 diff --git a/mysql-test/r/3.23/sel000022.result b/mysql-test/r/3.23/sel000022.result new file mode 100644 index 00000000000..4f6dedaa83f --- /dev/null +++ b/mysql-test/r/3.23/sel000022.result @@ -0,0 +1,2 @@ +"a "="A" "A "="a" "a " <= "A b" +1 1 1 diff --git a/mysql-test/r/3.23/sel000023.result b/mysql-test/r/3.23/sel000023.result new file mode 100644 index 00000000000..835c340b686 --- /dev/null +++ b/mysql-test/r/3.23/sel000023.result @@ -0,0 +1,2 @@ +"abc" LIKE "a%" "abc" NOT LIKE "%d%" "a%" LIKE "a\%" "abc%" LIKE "a%\%" "abcd" LIKE "a%b_%d" "a" LIKE "%%a" "abcde" LIKE "a%_e" "abc" LIKE "abc%" +1 1 1 1 1 1 1 1 diff --git a/mysql-test/r/3.23/sel000024.result b/mysql-test/r/3.23/sel000024.result new file mode 100644 index 00000000000..daa9a143b60 --- /dev/null +++ b/mysql-test/r/3.23/sel000024.result @@ -0,0 +1,2 @@ +"a" LIKE "%%b" "a" LIKE "%%ab" "ab" LIKE "a\%" "ab" LIKE "_" "ab" LIKE "ab_" "abc" LIKE "%_d" "abc" LIKE "abc%d" +0 0 0 0 0 0 0 diff --git a/mysql-test/r/3.23/sel000025.result b/mysql-test/r/3.23/sel000025.result new file mode 100644 index 00000000000..caf244be1d9 --- /dev/null +++ b/mysql-test/r/3.23/sel000025.result @@ -0,0 +1,2 @@ +'?' LIKE '|%' '?' LIKE '|%' ESCAPE '|' '%' LIKE '|%' '%' LIKE '|%' ESCAPE '|' '%' LIKE '%' +0 0 0 1 1 diff --git a/mysql-test/r/3.23/sel000026.result b/mysql-test/r/3.23/sel000026.result new file mode 100644 index 00000000000..acf301a349f --- /dev/null +++ b/mysql-test/r/3.23/sel000026.result @@ -0,0 +1,2 @@ +'abc' LIKE '%c' 'abcabc' LIKE '%c' "ab" LIKE "" "ab" LIKE "a" "ab" LIKE "ab" +1 1 0 0 1 diff --git a/mysql-test/r/3.23/sel000027.result b/mysql-test/r/3.23/sel000027.result new file mode 100644 index 00000000000..df2945c6da8 --- /dev/null +++ b/mysql-test/r/3.23/sel000027.result @@ -0,0 +1,2 @@ +"Det här är svenska" REGEXP "h[[:alpha:]]+r" "aba" REGEXP "^(a|b)*$" +1 1 diff --git a/mysql-test/r/3.23/sel000028.result b/mysql-test/r/3.23/sel000028.result new file mode 100644 index 00000000000..cd5b3268b53 --- /dev/null +++ b/mysql-test/r/3.23/sel000028.result @@ -0,0 +1,2 @@ +"aba" REGEXP CONCAT("^","a") +1 diff --git a/mysql-test/r/3.23/sel000029.result b/mysql-test/r/3.23/sel000029.result new file mode 100644 index 00000000000..0ceb7494fd3 --- /dev/null +++ b/mysql-test/r/3.23/sel000029.result @@ -0,0 +1,2 @@ +!0 NOT 0=1 !(0=0) 1 AND 1 1 && 0 0 OR 1 1 || NULL 1=1 OR 1=1 AND 1=0 +1 1 0 1 0 1 1 1 diff --git a/mysql-test/r/3.23/sel000030.result b/mysql-test/r/3.23/sel000030.result new file mode 100644 index 00000000000..575549b600f --- /dev/null +++ b/mysql-test/r/3.23/sel000030.result @@ -0,0 +1,2 @@ +IF(0,"ERROR","this") IF(1,"is","ERROR") IF(NULL,"ERROR","a") IF(1,2,3)|0 IF(1,2.0,3.0)+0 +this is a 2 2.0 diff --git a/mysql-test/xml/tests/sel000004.xml b/mysql-test/xml/tests/sel000004.xml new file mode 100644 index 00000000000..9c28c632c32 --- /dev/null +++ b/mysql-test/xml/tests/sel000004.xml @@ -0,0 +1,17 @@ + + + + + + + + + + Simple arithmetic. + Testing MOD(), SIGN(), and arithmetic grouping. + + + SELECT 1+1,1-1,1+1*2,8/5,8%5,MOD(8,5),MOD(8,5)|0,-(1+1)*-2,SIGN(-5) + + + diff --git a/mysql-test/xml/tests/sel000005.xml b/mysql-test/xml/tests/sel000005.xml new file mode 100644 index 00000000000..0bcddb2fbb6 --- /dev/null +++ b/mysql-test/xml/tests/sel000005.xml @@ -0,0 +1,17 @@ + + + + + + + + + + Numeric functions. + Testing FLOOR(), CEILING(), ROUND(). + + + SELECT FLOOR(5.5),FLOOR(-5.5),CEILING(5.5),CEILING(-5.5),ROUND(5.5),ROUND(-5.5) + + + diff --git a/mysql-test/xml/tests/sel000006.xml b/mysql-test/xml/tests/sel000006.xml new file mode 100644 index 00000000000..3059f8bb7df --- /dev/null +++ b/mysql-test/xml/tests/sel000006.xml @@ -0,0 +1,17 @@ + + + + + + + + + + Numeric functions. + Testing ROUND(); hundreths precision. + + + SELECT ROUND(5.64,1),ROUND(5.64,2),ROUND(5.64,-1),ROUND(5.64,-2) + + + diff --git a/mysql-test/xml/tests/sel000007.xml b/mysql-test/xml/tests/sel000007.xml new file mode 100644 index 00000000000..8f8bb7162c3 --- /dev/null +++ b/mysql-test/xml/tests/sel000007.xml @@ -0,0 +1,17 @@ + + + + + + + + + + Numeric functions. + Testing TRUNCATE(). + + + SELECT TRUNCATE(52.64,1),TRUNCATE(52.64,2),TRUNCATE(52.64,-1),TRUNCATE(52.64,-2) + + + diff --git a/mysql-test/xml/tests/sel000008.xml b/mysql-test/xml/tests/sel000008.xml new file mode 100644 index 00000000000..70a54a15d5b --- /dev/null +++ b/mysql-test/xml/tests/sel000008.xml @@ -0,0 +1,17 @@ + + + + + + + + + + Numeric functions. + Testing ABS(), LOG(), LOG10(), EXP(), SQRT(), POW(), RAND(), POWER(). + + + SELECT ABS(-10),LOG(EXP(10)),EXP(LOG(SQRT(10))*2),POW(10,LOG10(10)),RAND(999999),RAND(),POWER(2,4) + + + diff --git a/mysql-test/xml/tests/sel000009.xml b/mysql-test/xml/tests/sel000009.xml new file mode 100644 index 00000000000..0c79f032112 --- /dev/null +++ b/mysql-test/xml/tests/sel000009.xml @@ -0,0 +1,17 @@ + + + + + + + + + + Numeric functions. + Testing PI(), SIN(), COS(), TAN(), COT(), ASIN(), ACOS(), ATAN(). + + + SELECT PI(),SIN(PI()/2),COS(PI()/2),TAN(PI()),COT(1),ASIN(1),ACOS(0),ATAN(1) + + + diff --git a/mysql-test/xml/tests/sel000010.xml b/mysql-test/xml/tests/sel000010.xml new file mode 100644 index 00000000000..6954fef0750 --- /dev/null +++ b/mysql-test/xml/tests/sel000010.xml @@ -0,0 +1,17 @@ + + + + + + + + + + Numeric bitwise comparisons. + Testing |, &, BIT_COUNT(). + + + SELECT 1 | (1+1),5 & 3,BIT_COUNT(7) + + + diff --git a/mysql-test/xml/tests/sel000011.xml b/mysql-test/xml/tests/sel000011.xml new file mode 100644 index 00000000000..5c981b2f85a --- /dev/null +++ b/mysql-test/xml/tests/sel000011.xml @@ -0,0 +1,17 @@ + + + + + + + + + + Numeric bitmoving comparisons. + Testing <<, >>. + + + SELECT 1 << 32,1 << 63, 1 << 64, 4 >> 2, 4 >> 63, 1<< 63 >> 60 + + + diff --git a/mysql-test/xml/tests/sel000012.xml b/mysql-test/xml/tests/sel000012.xml new file mode 100644 index 00000000000..7abcc498164 --- /dev/null +++ b/mysql-test/xml/tests/sel000012.xml @@ -0,0 +1,16 @@ + + + + + + + + + + Numeric floating point. + + + SELECT 10,10.0,10.,.1e+2,100.0e-1 + + + diff --git a/mysql-test/xml/tests/sel000013.xml b/mysql-test/xml/tests/sel000013.xml new file mode 100644 index 00000000000..fbeca6663fc --- /dev/null +++ b/mysql-test/xml/tests/sel000013.xml @@ -0,0 +1,16 @@ + + + + + + + + + + Numeric floating point. + + + SELECT 6e-05, -6e-05, --6e-05, -6e-05+1.000000 + + + diff --git a/mysql-test/xml/tests/sel000014.xml b/mysql-test/xml/tests/sel000014.xml new file mode 100644 index 00000000000..96a51e671fc --- /dev/null +++ b/mysql-test/xml/tests/sel000014.xml @@ -0,0 +1,17 @@ + + + + + + + + + + Numerics. + Testing pos/neg and zero padding. + + + SELECT 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296 + + + diff --git a/mysql-test/xml/tests/sel000015.xml b/mysql-test/xml/tests/sel000015.xml new file mode 100644 index 00000000000..a339330e6b1 --- /dev/null +++ b/mysql-test/xml/tests/sel000015.xml @@ -0,0 +1,17 @@ + + + + + + + + + + Numerics. + Testing big numbers. + + + SELECT 922337203685477580,92233720368547758000 + + + diff --git a/mysql-test/xml/tests/sel000016.xml b/mysql-test/xml/tests/sel000016.xml new file mode 100644 index 00000000000..ae971e6576a --- /dev/null +++ b/mysql-test/xml/tests/sel000016.xml @@ -0,0 +1,17 @@ + + + + + + + + + + Numerics. + Testing big negative numbers. + + + SELECT -922337203685477580,-92233720368547758000 + + + diff --git a/mysql-test/xml/tests/sel000017.xml b/mysql-test/xml/tests/sel000017.xml new file mode 100644 index 00000000000..9d06d640ac3 --- /dev/null +++ b/mysql-test/xml/tests/sel000017.xml @@ -0,0 +1,17 @@ + + + + + + + + + + Numerics. + Testing big pos/neg numbers. + + + SELECT 9223372036854775807,-009223372036854775808 + + + diff --git a/mysql-test/xml/tests/sel000018.xml b/mysql-test/xml/tests/sel000018.xml new file mode 100644 index 00000000000..909728599fa --- /dev/null +++ b/mysql-test/xml/tests/sel000018.xml @@ -0,0 +1,17 @@ + + + + + + + + + + Numerics. + Testing big pos/neg numbers. + + + SELECT +9999999999999999999,-9999999999999999999 + + + diff --git a/mysql-test/xml/tests/sel000019.xml b/mysql-test/xml/tests/sel000019.xml new file mode 100644 index 00000000000..e0286ae2db7 --- /dev/null +++ b/mysql-test/xml/tests/sel000019.xml @@ -0,0 +1,17 @@ + + + + + + + + + + Numerics. + Testing DEGREES(), RADIANS(). + + + SELECT DEGREES(PI()),RADIANS(360) + + + diff --git a/mysql-test/xml/tests/sel000020.xml b/mysql-test/xml/tests/sel000020.xml new file mode 100644 index 00000000000..41ad5981cb9 --- /dev/null +++ b/mysql-test/xml/tests/sel000020.xml @@ -0,0 +1,17 @@ + + + + + + + + + + Strings. + Testing string comparisons; STRCMP(), =, >, >=, <=, !=. + + + SELECT 0=0,1>0,1>=1,1<0,1<=0,1!=0,STRCMP("abc","abcd"),STRCMP("b","a"),STRCMP("a","a") + + + diff --git a/mysql-test/xml/tests/sel000021.xml b/mysql-test/xml/tests/sel000021.xml new file mode 100644 index 00000000000..ba2e8149abd --- /dev/null +++ b/mysql-test/xml/tests/sel000021.xml @@ -0,0 +1,17 @@ + + + + + + + + + + Strings. + Testing string comparisons; =, >, >=, <=, <>. + + + SELECT "a"<"b","a"<="b","b">="a","b">"a","a"="A","a"<>"b" + + + diff --git a/mysql-test/xml/tests/sel000022.xml b/mysql-test/xml/tests/sel000022.xml new file mode 100644 index 00000000000..3dca0eb9b7f --- /dev/null +++ b/mysql-test/xml/tests/sel000022.xml @@ -0,0 +1,17 @@ + + + + + + + + + + Strings. + Testing string comparisons; =, >, <=. + + + SELECT "a "="A", "A "="a", "a " <= "A b" + + + diff --git a/mysql-test/xml/tests/sel000023.xml b/mysql-test/xml/tests/sel000023.xml new file mode 100644 index 00000000000..7cceb4aabca --- /dev/null +++ b/mysql-test/xml/tests/sel000023.xml @@ -0,0 +1,17 @@ + + + + + + + + + + Strings. + Testing string comparisons; LIKE, NOT LIKE, '%'. + + + SELECT "abc" LIKE "a%", "abc" NOT LIKE "%d%", "a%" LIKE "a\%","abc%" LIKE "a%\%","abcd" LIKE "a%b_%d", "a" LIKE "%%a","abcde" LIKE "a%_e","abc" LIKE "abc%" + + + diff --git a/mysql-test/xml/tests/sel000024.xml b/mysql-test/xml/tests/sel000024.xml new file mode 100644 index 00000000000..5bf9c0be7dc --- /dev/null +++ b/mysql-test/xml/tests/sel000024.xml @@ -0,0 +1,17 @@ + + + + + + + + + + Strings. + Testing string comparisons; LIKE, '%'. + + + SELECT "a" LIKE "%%b","a" LIKE "%%ab","ab" LIKE "a\%", "ab" LIKE "_", "ab" LIKE "ab_", "abc" LIKE "%_d", "abc" LIKE "abc%d" + + + diff --git a/mysql-test/xml/tests/sel000025.xml b/mysql-test/xml/tests/sel000025.xml new file mode 100644 index 00000000000..4144b65775f --- /dev/null +++ b/mysql-test/xml/tests/sel000025.xml @@ -0,0 +1,17 @@ + + + + + + + + + + Strings. + Testing string comparisons; LIKE, ESCAPE, '%'. + + + SELECT '?' LIKE '|%', '?' LIKE '|%' ESCAPE '|', '%' LIKE '|%', '%' LIKE '|%' ESCAPE '|', '%' LIKE '%' + + + diff --git a/mysql-test/xml/tests/sel000026.xml b/mysql-test/xml/tests/sel000026.xml new file mode 100644 index 00000000000..afaa34009fa --- /dev/null +++ b/mysql-test/xml/tests/sel000026.xml @@ -0,0 +1,17 @@ + + + + + + + + + + Strings. + Testing string comparisons; LIKE, '%'. + + + SELECT 'abc' LIKE '%c','abcabc' LIKE '%c', "ab" LIKE "", "ab" LIKE "a", "ab" LIKE "ab" + + + diff --git a/mysql-test/xml/tests/sel000027.xml b/mysql-test/xml/tests/sel000027.xml new file mode 100644 index 00000000000..641d5d3a619 --- /dev/null +++ b/mysql-test/xml/tests/sel000027.xml @@ -0,0 +1,17 @@ + + + + + + + + + + Strings. + Testing string comparisons; REGEXP. + + + SELECT "Det här är svenska" REGEXP "h[[:alpha:]]+r", "aba" REGEXP "^(a|b)*$" + + + diff --git a/mysql-test/xml/tests/sel000028.xml b/mysql-test/xml/tests/sel000028.xml new file mode 100644 index 00000000000..c8db245c25d --- /dev/null +++ b/mysql-test/xml/tests/sel000028.xml @@ -0,0 +1,17 @@ + + + + + + + + + + Strings. + Testing string comparisons; REGEXP, CONCAT(). + + + SELECT "aba" REGEXP CONCAT("^","a") + + + diff --git a/mysql-test/xml/tests/sel000029.xml b/mysql-test/xml/tests/sel000029.xml new file mode 100644 index 00000000000..84d12a44dc5 --- /dev/null +++ b/mysql-test/xml/tests/sel000029.xml @@ -0,0 +1,17 @@ + + + + + + + + + + Strings. + Testing string comparisons; NOT, AND, OR, !, &&, ||. + + + SELECT !0,NOT 0=1,!(0=0),1 AND 1,1 && 0,0 OR 1,1 || NULL, 1=1 OR 1=1 AND 1=0 + + + diff --git a/mysql-test/xml/tests/sel000030.xml b/mysql-test/xml/tests/sel000030.xml new file mode 100644 index 00000000000..8a8a4d5e0d2 --- /dev/null +++ b/mysql-test/xml/tests/sel000030.xml @@ -0,0 +1,17 @@ + + + + + + + + + + Control flow. + Testing control flow; IF() + + + SELECT IF(0,"ERROR","this"),IF(1,"is","ERROR"),IF(NULL,"ERROR","a"),IF(1,2,3)|0,IF(1,2.0,3.0)+0 + + +