summaryrefslogtreecommitdiff
path: root/sql-bench
diff options
context:
space:
mode:
authorunknown <walrus@mysql.com>2002-11-04 23:12:31 +0500
committerunknown <walrus@mysql.com>2002-11-04 23:12:31 +0500
commit034fbeb61e6b3c4cdc15403388db2bb0aec77ab8 (patch)
tree7b3a2ba6139f88ccc01728804006ad043ca85ed8 /sql-bench
parent9b7e5a7f206bcad74ac7555471c67681b4dc45ab (diff)
downloadmariadb-git-034fbeb61e6b3c4cdc15403388db2bb0aec77ab8.tar.gz
add safe ariphmetic test to crash-me
sql-bench/crash-me.sh: add safe ariphmetic test
Diffstat (limited to 'sql-bench')
-rw-r--r--sql-bench/crash-me.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/sql-bench/crash-me.sh b/sql-bench/crash-me.sh
index d66e8f47d6a..02e3072a3f9 100644
--- a/sql-bench/crash-me.sh
+++ b/sql-bench/crash-me.sh
@@ -2009,6 +2009,43 @@ find_limit("number of columns in group by","columns_in_group_by",
["drop table crash_q $drop_attr"],
$max_order_by));
+
+
+# Safe arithmetic test
+
+$prompt="safe decimal arithmetic";
+$key="safe_decimal_arithmetic";
+if (!defined($limits{$key}))
+{
+ print "$prompt=";
+ save_incomplete($limit,$prompt);
+ if (!safe_query($server->create("crash_me_a",["a decimal(10,2)","b decimal(10,2)"])))
+ {
+ print DBI->errstr();
+ die "Can't create table 'crash_me_a' $DBI::errstr\n";
+ };
+
+ if (!safe_query(["insert into crash_me_a (a,b) values (11.4,18.9)"]))
+ {
+ die "Can't insert into table 'crash_me_a' a record: $DBI::errstr\n";
+ };
+
+ $arithmetic_safe = 'no';
+ $arithmetic_safe = 'yes'
+ if ( (safe_query_result('select count(*) from crash_me_a where a+b=30.3',1,0) == 0)
+ and (safe_query_result('select count(*) from crash_me_a where a+b-30.3 = 0',1,0) == 0)
+ and (safe_query_result('select count(*) from crash_me_a where a+b-30.3 < 0',0,0) == 0)
+ and (safe_query_result('select count(*) from crash_me_a where a+b-30.3 > 0',0,0) == 0) );
+ save_config_data($key,$arithmetic_safe,$prompt);
+ print "$arithmetic_safe\n";
+ assert("drop table crash_me_a $drop_attr");
+}
+ else
+{
+ print "$prompt=$limits{$key} (cached)\n";
+}
+
+
#
# End of test
#