summaryrefslogtreecommitdiff
path: root/sql-bench
diff options
context:
space:
mode:
authorunknown <walrus@kishkin.ru>2002-12-10 18:40:38 +0500
committerunknown <walrus@kishkin.ru>2002-12-10 18:40:38 +0500
commit89991c65f3327f33f11b81c23914dfad57c4002d (patch)
treefb3c1191f6b4adbe71321e611e742430e47a8734 /sql-bench
parent5a55e25c8734c349abf9c3db54823105a365de49 (diff)
downloadmariadb-git-89991c65f3327f33f11b81c23914dfad57c4002d.tar.gz
merge Ranger's patches to crash-me, add new tests ( DEFAULT VALUES )
to crash-me sql-bench/crash-me.sh: new tests: - INSERT with DEFAULT: - INSERT with empty value list: - Insert DEFAULT VALUES; ------- -checking of reserved keywords (by courtesy of Ranger) -------- - added "--suffix" option - added description of "--config-file" to help section - fixed test for DIFFERENCE() - fixed small bug in safe_query_result (was s/,/,/ should s/,/./) (by courtesy of Ranger) sql-bench/server-cfg.sh: remove "KERNEL" and add "SAPDB" to sapdb version BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
Diffstat (limited to 'sql-bench')
-rw-r--r--sql-bench/crash-me.sh267
-rw-r--r--sql-bench/server-cfg.sh3
2 files changed, 265 insertions, 5 deletions
diff --git a/sql-bench/crash-me.sh b/sql-bench/crash-me.sh
index 6c3ee9bd0dc..d18070d30b7 100644
--- a/sql-bench/crash-me.sh
+++ b/sql-bench/crash-me.sh
@@ -55,6 +55,7 @@ $opt_check_server=0; # Check if server is alive before each query
$opt_sleep=10; # time to sleep while starting the db server
$limit_changed=0; # For configure file
$reconnect_count=0;
+$opt_suffix="";
$opt_comment=$opt_config_file=$opt_log_queries_to_file="";
$limits{'crash_me_safe'}='yes';
$prompts{'crash_me_safe'}='crash me safe';
@@ -62,10 +63,13 @@ $limits{'operating_system'}= machine();
$prompts{'operating_system'}='crash-me tested on';
$retry_limit=3;
-GetOptions("Information","help","server=s","debug","user=s","password=s","database=s","restart","force","quick","log-all-queries","comment=s","host=s","fix-limit-file","dir=s","db-start-cmd=s","sleep=s","batch-mode","config-file=s","log-queries-to-file=s","check-server") || usage();
+GetOptions("Information","help","server=s","debug","user=s","password=s","database=s","restart","force","quick","log-all-queries","comment=s","host=s","fix-limit-file","dir=s","db-start-cmd=s","sleep=s","suffix=s","batch-mode","config-file=s","log-queries-to-file=s","check-server") || usage();
usage() if ($opt_help || $opt_Information);
-$opt_config_file="$pwd/$opt_dir/$opt_server.cfg" if (length($opt_config_file) == 0);
+$opt_suffix = '-'.$opt_suffix if (length($opt_suffix) == 0);
+$opt_config_file = "$pwd/$opt_dir/$opt_server$opt_suffix.cfg" if (length($opt_config_file) == 0);
+
+#!!!
if ($opt_fix_limit_file)
{
@@ -298,6 +302,21 @@ report("INSERT with set syntax",'insert_with_set',
"create table crash_q (a integer)",
"insert into crash_q SET a=1",
"drop table crash_q $drop_attr");
+report("INSERT with DEFAULT","insert_with_default",
+ "create table crash_me_q (a int)",
+ "insert into crash_me_q (a) values (DEFAULT)",
+ "drop table crash_me_q $drop_attr");
+
+report("INSERT with empty value list","insert_with_empty_value_list",
+ "create table crash_me_q (a int)",
+ "insert into crash_me_q (a) values ()",
+ "drop table crash_me_q $drop_attr");
+
+report("INSERT DEFAULT VALUES","insert_default_values",
+ "create table crash_me_q (a int)",
+ "insert into crash_me_q DEFAULT VALUES",
+ "drop table crash_me_q $drop_attr");
+
report("allows end ';'","end_colon", "select * from crash_me;");
try_and_report("LIMIT number of rows","select_limit",
["with LIMIT",
@@ -553,6 +572,13 @@ if (!defined($limits{'query_size'}))
$query_size=$limits{'query_size'};
print "$limits{'query_size'}\n";
+
+#
+# Check for reserved words
+#
+
+check_reserved_words($dbh);
+
#
# Test database types
#
@@ -794,7 +820,7 @@ try_and_report("Automatic row id", "automatic_rowid",
(["ASCII", "ascii", "ASCII('A')","65",0],
["CHAR", "char", "CHAR(65)" ,"A",1],
["CONCAT(2 arg)","concat", "concat('a','b')","ab",1],
- ["DIFFERENCE()","difference","difference('abc','abe')",0,2],
+ ["DIFFERENCE()","difference","difference('abc','abe')",3,0],
["INSERT","insert","insert('abcd',2,2,'ef')","aefd",1],
["LEFT","left","left('abcd',2)","ab",1],
["LTRIM","ltrim","ltrim(' abcd')","abcd",1],
@@ -2332,6 +2358,9 @@ $0 takes the following options:
--batch-mode
Don\'t ask any questions, quit on errors.
+--config-file='filename'
+ Read limit results from specific file
+
--comment='some comment'
Add this comment to the crash-me limit file
@@ -2379,6 +2408,10 @@ $0 takes the following options:
Known servers names are: Access, Adabas, AdabasD, Empress, Oracle, Informix, DB2, Mimer, mSQL, MS-SQL, MySQL, Pg, Solid or Sybase.
For others $0 can\'t report the server version.
+--suffix='suffix' (Default '')
+ Add suffix to the output filename. For instance if you run crash-me like "crash-me --suffix="myisam",
+ then output filename will look "mysql-myisam.cfg".
+
--user='user_name'
User name to log into the SQL server.
@@ -2687,6 +2720,228 @@ sub safe_query
return $ok;
}
+sub check_reserved_words
+{
+ my ($dbh)= @_;
+
+ my $answer, $prompt, $config, $keyword_type;
+
+ my @keywords_type = ( "(ANSI SQL 92/99)", "(ANSI SQL 92)", "(ANSI SQL 99)", "(EXTRA)");
+ my @keywords_ext = ( "ansi92/99", "ansi92", "ansi99", "extra");
+
+ my %reserved_words = (
+ ABSOLUTE => 0, ACTION => 0, ADD => 0,
+ AFTER => 0, ALIAS => 0, ALL => 0,
+ ALLOCATE => 0, ALTER => 0, AND => 0,
+ ANY => 0, ARE => 0, AS => 0,
+ ASC => 0, ASSERTION => 0, AT => 0,
+ AUTHORIZATION => 0, BEFORE => 0, BEGIN => 0,
+ BIT => 0, BOOLEAN => 0, BOTH => 0,
+ BREADTH => 0, BY => 0, CALL => 0,
+ CASCADE => 0, CASCADED => 0, CASE => 0,
+ CAST => 0, CATALOG => 0, CHAR => 0,
+ CHARACTER => 0, CHECK => 0, CLOSE => 0,
+ COLLATE => 0, COLLATION => 0, COLUMN => 0,
+ COMMIT => 0, COMPLETION => 0, CONNECT => 0,
+ CONNECTION => 0, CONSTRAINT => 0, CONSTRAINTS => 0,
+ CONTINUE => 0, CORRESPONDING => 0, CREATE => 0,
+ CROSS => 0, CURRENT => 0, CURRENT_DATE => 0,
+ CURRENT_TIME => 0, CURRENT_TIMESTAMP => 0, CURRENT_USER => 0,
+ CURSOR => 0, CYCLE => 0, DATA => 0,
+ DATE => 0, DAY => 0, DEALLOCATE => 0,
+ DEC => 0, DECIMAL => 0, DECLARE => 0,
+ DEFAULT => 0, DEFERRABLE => 0, DEFERRED => 0,
+ DELETE => 0, DEPTH => 0, DESC => 0,
+ DESCRIBE => 0, DESCRIPTOR => 0, DIAGNOSTICS => 0,
+ DICTIONARY => 0, DISCONNECT => 0, DISTINCT => 0,
+ DOMAIN => 0, DOUBLE => 0, DROP => 0,
+ EACH => 0, ELSE => 0, ELSEIF => 0,
+ END => 0, END-EXEC => 0, EQUALS => 0,
+ ESCAPE => 0, EXCEPT => 0, EXCEPTION => 0,
+ EXEC => 0, EXECUTE => 0, EXTERNAL => 0,
+ FALSE => 0, FETCH => 0, FIRST => 0,
+ FLOAT => 0, FOR => 0, FOREIGN => 0,
+ FOUND => 0, FROM => 0, FULL => 0,
+ GENERAL => 0, GET => 0, GLOBAL => 0,
+ GO => 0, GOTO => 0, GRANT => 0,
+ GROUP => 0, HAVING => 0, HOUR => 0,
+ IDENTITY => 0, IF => 0, IGNORE => 0,
+ IMMEDIATE => 0, IN => 0, INDICATOR => 0,
+ INITIALLY => 0, INNER => 0, INPUT => 0,
+ INSERT => 0, INT => 0, INTEGER => 0,
+ INTERSECT => 0, INTERVAL => 0, INTO => 0,
+ IS => 0, ISOLATION => 0, JOIN => 0,
+ KEY => 0, LANGUAGE => 0, LAST => 0,
+ LEADING => 0, LEAVE => 0, LEFT => 0,
+ LESS => 0, LEVEL => 0, LIKE => 0,
+ LIMIT => 0, LOCAL => 0, LOOP => 0,
+ MATCH => 0, MINUTE => 0, MODIFY => 0,
+ MODULE => 0, MONTH => 0, NAMES => 0,
+ NATIONAL => 0, NATURAL => 0, NCHAR => 0,
+ NEW => 0, NEXT => 0, NO => 0,
+ NONE => 0, NOT => 0, NULL => 0,
+ NUMERIC => 0, OBJECT => 0, OF => 0,
+ OFF => 0, OLD => 0, ON => 0,
+ ONLY => 0, OPEN => 0, OPERATION => 0,
+ OPTION => 0, OR => 0, ORDER => 0,
+ OUTER => 0, OUTPUT => 0, PAD => 0,
+ PARAMETERS => 0, PARTIAL => 0, PRECISION => 0,
+ PREORDER => 0, PREPARE => 0, PRESERVE => 0,
+ PRIMARY => 0, PRIOR => 0, PRIVILEGES => 0,
+ PROCEDURE => 0, PUBLIC => 0, READ => 0,
+ REAL => 0, RECURSIVE => 0, REF => 0,
+ REFERENCES => 0, REFERENCING => 0, RELATIVE => 0,
+ RESIGNAL => 0, RESTRICT => 0, RETURN => 0,
+ RETURNS => 0, REVOKE => 0, RIGHT => 0,
+ ROLE => 0, ROLLBACK => 0, ROUTINE => 0,
+ ROW => 0, ROWS => 0, SAVEPOINT => 0,
+ SCHEMA => 0, SCROLL => 0, SEARCH => 0,
+ SECOND => 0, SECTION => 0, SELECT => 0,
+ SEQUENCE => 0, SESSION => 0, SESSION_USER => 0,
+ SET => 0, SIGNAL => 0, SIZE => 0,
+ SMALLINT => 0, SOME => 0, SPACE => 0,
+ SQL => 0, SQLEXCEPTION => 0, SQLSTATE => 0,
+ SQLWARNING => 0, STRUCTURE => 0, SYSTEM_USER => 0,
+ TABLE => 0, TEMPORARY => 0, THEN => 0,
+ TIME => 0, TIMESTAMP => 0, TIMEZONE_HOUR => 0,
+ TIMEZONE_MINUTE => 0, TO => 0, TRAILING => 0,
+ TRANSACTION => 0, TRANSLATION => 0, TRIGGER => 0,
+ TRUE => 0, UNDER => 0, UNION => 0,
+ UNIQUE => 0, UNKNOWN => 0, UPDATE => 0,
+ USAGE => 0, USER => 0, USING => 0,
+ VALUE => 0, VALUES => 0, VARCHAR => 0,
+ VARIABLE => 0, VARYING => 0, VIEW => 0,
+ WHEN => 0, WHENEVER => 0, WHERE => 0,
+ WHILE => 0, WITH => 0, WITHOUT => 0,
+ WORK => 0, WRITE => 0, YEAR => 0,
+ ZONE => 0,
+
+ ASYNC => 1, AVG => 1, BETWEEN => 1,
+ BIT_LENGTH => 1, CHARACTER_LENGTH => 1, CHAR_LENGTH => 1,
+ COALESCE => 1, CONVERT => 1, COUNT => 1,
+ EXISTS => 1, EXTRACT => 1, INSENSITIVE => 1,
+ LOWER => 1, MAX => 1, MIN => 1,
+ NULLIF => 1, OCTET_LENGTH => 1, OID => 1,
+ OPERATORS => 1, OTHERS => 1, OVERLAPS => 1,
+ PENDANT => 1, POSITION => 1, PRIVATE => 1,
+ PROTECTED => 1, REPLACE => 1, SENSITIVE => 1,
+ SIMILAR => 1, SQLCODE => 1, SQLERROR => 1,
+ SUBSTRING => 1, SUM => 1, TEST => 1,
+ THERE => 1, TRANSLATE => 1, TRIM => 1,
+ TYPE => 1, UPPER => 1, VIRTUAL => 1,
+ VISIBLE => 1, WAIT => 1,
+
+ ADMIN => 2, AGGREGATE => 2, ARRAY => 2,
+ BINARY => 2, BLOB => 2, CLASS => 2,
+ CLOB => 2, CONDITION => 2, CONSTRUCTOR => 2,
+ CONTAINS => 2, CUBE => 2, CURRENT_PATH => 2,
+ CURRENT_ROLE => 2, DATALINK => 2, DEREF => 2,
+ DESTROY => 2, DESTRUCTOR => 2, DETERMINISTIC => 2,
+ DO => 2, DYNAMIC => 2, EVERY => 2,
+ EXIT => 2, EXPAND => 2, EXPANDING => 2,
+ FREE => 2, FUNCTION => 2, GROUPING => 2,
+ HANDLER => 2, HAST => 2, HOST => 2,
+ INITIALIZE => 2, INOUT => 2, ITERATE => 2,
+ LARGE => 2, LATERAL => 2, LOCALTIME => 2,
+ LOCALTIMESTAMP => 2, LOCATOR => 2, MEETS => 2,
+ MODIFIES => 2, NCLOB => 2, NORMALIZE => 2,
+ ORDINALITY => 2, OUT => 2, PARAMETER => 2,
+ PATH => 2, PERIOD => 2, POSTFIX => 2,
+ PRECEDES => 2, PREFIX => 2, READS => 2,
+ REDO => 2, REPEAT => 2, RESULT => 2,
+ ROLLUP => 2, SETS => 2, SPECIFIC => 2,
+ SPECIFICTYPE => 2, START => 2, STATE => 2,
+ STATIC => 2, SUCCEEDS => 2, TERMINATE => 2,
+ THAN => 2, TREAT => 2, UNDO => 2,
+ UNTIL => 2,
+
+ ANALYZE => 3, AUTO_INCREMENT => 3, BDB => 3,
+ BERKELEYDB => 3, BIGINT => 3, BTREE => 3,
+ CHANGE => 3, COLUMNS => 3, DATABASE => 3,
+ DATABASES => 3, DAY_HOUR => 3, DAY_MINUTE => 3,
+ DAY_SECOND => 3, DELAYED => 3, DISTINCTROW => 3,
+ ENCLOSED => 3, ERRORS => 3, ESCAPED => 3,
+ EXPLAIN => 3, FIELDS => 3, FULLTEXT => 3,
+ GEOMETRY => 3, HASH => 3, HIGH_PRIORITY => 3,
+ HOUR_MINUTE => 3, HOUR_SECOND => 3, INDEX => 3,
+ INFILE => 3, INNODB => 3, KEYS => 3,
+ KILL => 3, LINES => 3, LOAD => 3,
+ LOCK => 3, LONG => 3, LONGBLOB => 3,
+ LONGTEXT => 3, LOW_PRIORITY => 3, MASTER_SERVER_ID => 3,
+ MEDIUMBLOB => 3, MEDIUMINT => 3, MEDIUMTEXT => 3,
+ MIDDLEINT => 3, MINUTE_SECOND => 3, MRG_MYISAM => 3,
+ OPTIMIZE => 3, OPTIONALLY => 3, OUTFILE => 3,
+ PURGE => 3, REGEXP => 3, RENAME => 3,
+ REQUIRE => 3, RLIKE => 3, RTREE => 3,
+ SHOW => 3, SONAME => 3, SPATIAL => 3,
+ SQL_BIG_RESULT => 3,SQL_CALC_FOUND_ROWS => 3, SQL_SMALL_RESULT => 3,
+ SSL => 3, STARTING => 3, STRAIGHT_JOIN => 3,
+ STRIPED => 3, TABLES => 3, TERMINATED => 3,
+ TINYBLOB => 3, TINYINT => 3, TINYTEXT => 3,
+ TYPES => 3, UNLOCK => 3, UNSIGNED => 3,
+ USE => 3, USER_RESOURCES => 3, VARBINARY => 3,
+ WARNINGS => 3, XOR => 3, YEAR_MONTH => 3,
+ ZEROFILL => 3,
+
+ BACKUP => 3, BREAK => 3, BROWSE => 3,
+ BULK => 3, CHECKPOINT => 3, CLUSTERED => 3,
+ COMPUTE => 3, CONTAINSTABLE => 3, DBCC => 3,
+ DENY => 3, DISK => 3, DISTRIBUTED => 3,
+ DUMMY => 3, DUMP => 3, ERRLVL => 3,
+ FILE => 3, FILLFACTOR => 3, FREETEXT => 3,
+ FREETEXTTABLE => 3, HOLDLOCK => 3, IDENTITYCOL => 3,
+ IDENTITY_INSERT => 3, LINENO => 3, NOCHECK => 3,
+ NONCLUSTERED => 3, OFFSETS => 3, OPENDATASOURCE => 3,
+ OPENQUERY => 3, OPENROWSET => 3, OPENXML => 3,
+ OVER => 3, PERCENT => 3, PLAN => 3,
+ PRINT => 3, PROC => 3, RAISERROR => 3,
+ READTEXT => 3, RECONFIGURE => 3, REPLICATION => 3,
+ RESTORE => 3, ROWCOUNT => 3, ROWGUIDCOL => 3,
+ RULE => 3, SAVE => 3, SETUSER => 3,
+ SHUTDOWN => 3, STATISTICS => 3, TEXTSIZE => 3,
+ TOP => 3, TRAN => 3, TRUNCATE => 3,
+ TSEQUAL => 3, UPDATETEXT => 3, WAITFOR => 3,
+ WRITETEXT => 3,
+
+ ACCESS => 3, AUDIT => 3, CLUSTER => 3,
+ COMMENT => 3, COMPRESS => 3, EXCLUSIVE => 3,
+ IDENTIFIED => 3, INCREMENT => 3, INITIAL => 3,
+ MAXEXTENTS => 3, MINUS => 3, MLSLABEL => 3,
+ MODE => 3, NOAUDIT => 3, NOCOMPRESS => 3,
+ NOWAIT => 3, NUMBER => 3, OFFLINE => 3,
+ ONLINE => 3, PCTFREE => 3, RAW => 3,
+ RESOURCE => 3, ROWID => 3, ROWNUM => 3,
+ SHARE => 3, SUCCESSFUL => 3, SYNONYM => 3,
+ SYSDATE => 3, UID => 3, VALIDATE => 3,
+ VARCHAR2 => 3
+ );
+
+ $dbh->do("drop table crash_me10");
+ $dbh->do("create table crash_me10 (id int not null)") or warn "$dbh->errstr\n";
+ $dbh->{RaiseError}= 1;
+
+ foreach my $keyword (keys %reserved_words)
+ {
+
+ $keyword_type= $reserved_words{$keyword};
+
+ $prompt= "Reserved keyword ".$keyword." ".$keywords_type[$keyword_type];
+ $config= "reserved_word_".$keywords_ext[$keyword_type]."_".lc($keyword);
+
+ eval {
+ $dbh->do("alter table crash_me10 add column $keyword int not null");
+ };
+
+ $answer= ($@) ? "yes" : "no";
+
+ save_config_data($config,$answer,$prompt);
+
+ print "$prompt: ",$limits{$config},"\n";
+
+ }
+
+ $dbh->{RaiseError}= 0;
+}
#
# Do a query on a query package object.
@@ -3007,9 +3262,13 @@ sub safe_query_result
}
$result=0; # Ok
$last_result= $row->[0]; # Save for report_result;
+
+ # Note:
+ # if ($result_type == 2) We accept any return value as answer
+
if ($result_type == 0) # Compare numbers
{
- $row->[0] =~ s/,/,/; # Fix if ',' is used instead of '.'
+ $row->[0] =~ s/,/./; # Fix if ',' is used instead of '.'
if ($row->[0] != $answer && (abs($row->[0]- $answer)/
(abs($row->[0]) + abs($answer))) > 0.01)
{
diff --git a/sql-bench/server-cfg.sh b/sql-bench/server-cfg.sh
index 7f96c06ef99..533e7aea574 100644
--- a/sql-bench/server-cfg.sh
+++ b/sql-bench/server-cfg.sh
@@ -3470,7 +3470,8 @@ sub version
if ($sth->execute && (@row = $sth->fetchrow_array)
&& $row[0] =~ /([\d\.]+)/)
{
- $version="sap-db $1";
+ $version=$row[0];
+ $verson =~ s/KERNEL/SAP DB/i;
}
$sth->finish;
$dbh->disconnect;