diff options
author | unknown <monty@narttu.mysql.fi> | 2003-04-03 21:19:12 +0300 |
---|---|---|
committer | unknown <monty@narttu.mysql.fi> | 2003-04-03 21:19:12 +0300 |
commit | 6b8e2938f21c508f67ec141256d1ffc77a935851 (patch) | |
tree | 2559697c56918e4fd2af81f84fcce0ea24dc60d4 /sql-bench | |
parent | fb9a939416165321ff4f8b9dae29363671b84de9 (diff) | |
parent | dba3a0b03181126cfc46048396b96e5cd768fe5a (diff) | |
download | mariadb-git-6b8e2938f21c508f67ec141256d1ffc77a935851.tar.gz |
Merge with 4.0
BitKeeper/etc/logging_ok:
auto-union
BitKeeper/deleted/.del-libmysqld.def~6ca0fa0537a3431c:
Auto merged
BitKeeper/deleted/.del-mysql.xdc:
Delete: netware/mysql.xdc
BitKeeper/deleted/.del-mysqld.xdc~1befdfee55e31716:
Auto merged
BitKeeper/deleted/.del-nwbootstrap~f3bc723dad4ed7e:
Auto merged
BitKeeper/deleted/.del-nwconfigure~86da352b5e031ed9:
Auto merged
client/mysql.cc:
Auto merged
include/my_pthread.h:
Auto merged
libmysqld/examples/Makefile.am:
Auto merged
mysql-test/r/func_str.result:
Auto merged
mysql-test/r/myisam.result:
Auto merged
mysql-test/t/backup.test:
Auto merged
mysql-test/t/myisam.test:
Auto merged
mysys/default.c:
Auto merged
mysys/my_init.c:
Auto merged
mysys/my_pthread.c:
Auto merged
mysys/thr_mutex.c:
Auto merged
scripts/make_binary_distribution.sh:
Auto merged
sql/ha_myisam.cc:
Auto merged
sql/log.cc:
Auto merged
sql-bench/crash-me.sh:
Auto merged
sql/slave.cc:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_delete.cc:
Auto merged
sql/sql_show.cc:
Auto merged
strings/my_vsnprintf.c:
Auto merged
sql/sql_parse.cc:
Merge with 4.0 (Ignore not existing tables with DROP TEMPOARAY TABLE on slave)
mysql-test/r/rpl_loaddata.result:
Auto merged
Diffstat (limited to 'sql-bench')
-rw-r--r-- | sql-bench/crash-me.sh | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/sql-bench/crash-me.sh b/sql-bench/crash-me.sh index 79090e3e6db..61468d69fb1 100644 --- a/sql-bench/crash-me.sh +++ b/sql-bench/crash-me.sh @@ -2210,6 +2210,40 @@ if ($limits{'foreign_key'} eq 'yes') } } +if ($limits{'func_sql_character_length'} eq 'yes') +{ + my $result = 'error'; + my ($resultset); + my $key = 'length_of_varchar_field'; + my $prompt='CHARACTER_LENGTH(varchar_field)'; + print $prompt," = "; + if (!defined($limits{$key})) { + save_incomplete($key,$prompt); + safe_query_l($key,[ + "CREATE TABLE crash_me1 (S1 VARCHAR(100))", + "INSERT INTO crash_me1 VALUES ('X')" + ]); + my $recset = get_recordset($key, + "SELECT CHARACTER_LENGTH(S1) FROM crash_me1"); + print_recordset($key,$recset); + if (defined($recset)){ + if ( $recset->[0][0] eq 1 ) { + $result = 'actual length'; + } elsif( $recset->[0][0] eq 100 ) { + $result = 'defined length'; + }; + } else { + add_log($key,$DBI::errstr); + } + safe_query_l($key, "drop table crash_me1 $drop_attr"); + save_config_data($key,$result,$prompt); + } else { + $result = $limits{$key}; + }; + print "$result\n"; +} + + check_constraint("Column constraints","constraint_check", "create table crash_q (a int check (a>0))", "insert into crash_q values(0)", @@ -2873,6 +2907,81 @@ sub make_date { } +sub print_recordset{ + my ($key,$recset) = @_; + my $rec; + foreach $rec (@$recset) + { + add_log($key, " > ".join(',', map(repr($_), @$rec))); + } +} + +# +# read result recordset from sql server. +# returns arrayref to (arrayref to) values +# or undef (in case of sql errors) +# +sub get_recordset{ + my ($key,$query) = @_; + add_log($key, "< $query"); + return $dbh->selectall_arrayref($query); +} + +# function for comparing recordset (that was returned by get_recordset) +# and arrayref of (arrayref of) values. +# +# returns : zero if recordset equal that array, 1 if it doesn't equal +# +# parameters: +# $key - current operation (for logging) +# $recset - recordset +# $mustbe - array of values that we expect +# +# example: $a=get_recordset('some_parameter','select a,b from c'); +# if (compare_recordset('some_parameter',$a,[[1,1],[1,2],[1,3]]) neq 0) +# { +# print "unexpected result\n"; +# } ; +# +sub compare_recordset { + my ($key,$recset,$mustbe) = @_; + my $rec,$recno,$fld,$fldno,$fcount; + add_log($key,"\n Check recordset:"); + $recno=0; + foreach $rec (@$recset) + { + add_log($key," " . join(',', map(repr($_),@$rec)) . " expected: " . + join(',', map(repr($_), @{$mustbe->[$recno]} ) )); + $fcount = @$rec; + $fcount--; + foreach $fldno (0 .. $fcount ) + { + if ($mustbe->[$recno][$fldno] ne $rec->[$fldno]) + { + add_log($key," Recordset doesn't correspond with template"); + return 1; + }; + } + $recno++; + } + add_log($key," Recordset corresponds with template"); + return 0; +} + +# +# converts inner perl value to printable representation +# for example: undef maps to 'NULL', +# string -> 'string' +# int -> int +# +sub repr { + my $s = shift; + return "'$s'"if ($s =~ /\D/); + return 'NULL'if ( not defined($s)); + return $s; +} + + sub version { print "$0 Ver $version\n"; |