summaryrefslogtreecommitdiff
path: root/sql-bench
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2002-12-05 19:38:42 +0200
committerunknown <monty@mashka.mysql.fi>2002-12-05 19:38:42 +0200
commit6d33f73416b5576b4e48412fd3a7342385c1c747 (patch)
tree56f9dc35fe3c9e6c4f341e577ff3db68855d9e81 /sql-bench
parent930b3fa897112c49392c2154de1ec21b9e44edda (diff)
parent9b5167eeac3e8d14134769334d94f260cb5db277 (diff)
downloadmariadb-git-6d33f73416b5576b4e48412fd3a7342385c1c747.tar.gz
Merge with 4.0.6
BitKeeper/etc/ignore: auto-union acinclude.m4: Auto merged configure.in: Auto merged heap/hp_delete.c: Auto merged heap/hp_scan.c: Auto merged include/my_base.h: Auto merged libmysql/libmysql.c: Auto merged libmysqld/lib_sql.cc: Auto merged myisam/mi_check.c: Auto merged myisam/mi_rnext_same.c: Auto merged myisam/sort.c: Auto merged mysql-test/r/alter_table.result: Auto merged mysql-test/r/distinct.result: Auto merged mysql-test/r/func_math.result: Auto merged mysql-test/r/group_by.result: Auto merged mysql-test/r/innodb.result: Auto merged mysql-test/r/select.result: Auto merged mysql-test/t/group_by.test: Auto merged mysql-test/t/select.test: Auto merged mysys/hash.c: Auto merged sql/field.h: Auto merged sql/field_conv.cc: Auto merged sql/ha_innodb.cc: Auto merged sql/handler.cc: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/log.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/opt_sum.cc: Auto merged sql/set_var.cc: Auto merged sql/set_var.h: Auto merged sql/sql_analyse.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_udf.cc: Auto merged sql/structs.h: Auto merged sql/uniques.cc: Auto merged strings/strto.c: Auto merged vio/vio.c: Auto merged BitKeeper/triggers/post-commit: Add changeset to commit messages sql-bench/crash-me.sh: Use version from 4.0 sql-bench/server-cfg.sh: Use version from 4.0
Diffstat (limited to 'sql-bench')
-rw-r--r--sql-bench/crash-me.sh173
-rw-r--r--sql-bench/server-cfg.sh44
2 files changed, 152 insertions, 65 deletions
diff --git a/sql-bench/crash-me.sh b/sql-bench/crash-me.sh
index 5fa67773566..6c3ee9bd0dc 100644
--- a/sql-bench/crash-me.sh
+++ b/sql-bench/crash-me.sh
@@ -280,13 +280,14 @@ report("Order by function","order_by_function",
"select a from crash_me order by a+1");
report("Order by on unused column",'order_on_unused',
"select b from crash_me order by a");
-check_and_report("Order by DESC is remembered",'order_by_remember_desc',
- ["create table crash_q (s int,s1 int)",
- "insert into crash_q values(1,1)",
- "insert into crash_q values(3,1)",
- "insert into crash_q values(2,1)"],
- "select s,s1 from crash_q order by s1 DESC,s",
- ["drop table crash_q $drop_attr"],[3,2,1],7,undef(),3);
+# little bit deprecated
+#check_and_report("Order by DESC is remembered",'order_by_remember_desc',
+# ["create table crash_q (s int,s1 int)",
+# "insert into crash_q values(1,1)",
+# "insert into crash_q values(3,1)",
+# "insert into crash_q values(2,1)"],
+# "select s,s1 from crash_q order by s1 DESC,s",
+# ["drop table crash_q $drop_attr"],[3,2,1],7,undef(),3);
report("Compute",'compute',
"select a from crash_me order by a compute sum(a) by a");
report("INSERT with Value lists",'insert_multi_value',
@@ -844,7 +845,6 @@ try_and_report("Automatic row id", "automatic_rowid",
["DAYOFWEEK","dayofweek","dayofweek(DATE '1997-02-01')",7,0],
["DAYOFYEAR","dayofyear","dayofyear(DATE '1997-02-01')",32,0],
["QUARTER","quarter","quarter(DATE '1997-02-01')",1,0],
- ["WEEK","week","week(DATE '1997-02-01')",5,0],
["YEAR","year","year(DATE '1997-02-01')",1997,0],
["CURTIME","curtime","curtime()",0,2],
["HOUR","hour","hour('12:13:14')",12,0],
@@ -980,7 +980,6 @@ try_and_report("Automatic row id", "automatic_rowid",
["ASCII in string cast",'ascii_string',"ascii('a')",'a',1],
["EBCDIC in string cast",'ebcdic_string',"ebcdic('a')",'a',1],
["TRUNC (1 arg)",'trunc1arg',"trunc(222.6)",222,0],
- ["NOROUND",'noround',"noround(222.6)",222.6,0],
["FIXED",'fixed',"fixed(222.6666,10,2)",'222.67',0],
["FLOAT",'float',"float(6666.66,4)",6667,0],
["LENGTH",'length',"length(1)",2,0],
@@ -1187,12 +1186,31 @@ else
}
-if ($limits{'func_extra_noround'} eq 'yes')
+# Test: NOROUND
{
- report("Ignoring NOROUND","ignoring_noround",
- "create table crash_q (a int)",
- "insert into crash_q values(noround(10.22))",
- "drop table crash_q $drop_attr");
+ my $resultat = 'undefined';
+ my $error;
+ print "NOROUND: ";
+ save_incomplete('func_extra_noround','Function NOROUND');
+
+# 1) check if noround() function is supported
+ $error = safe_query("select noround(22.6) $end_query");
+ if ($error ne 1) # syntax error -- noround is not supported
+ {
+ $resultat = 'no'
+ } else # Ok, now check if it really works
+ {
+ $error=safe_query( "create table crash_me_nr (a int)",
+ "insert into crash_me_nr values(noround(10.2))",
+ "drop table crash_me_nr $drop_attr");
+ if ($error eq 1) {
+ $resultat = "syntax only";
+ } else {
+ $resultat = 'yes';
+ }
+ }
+ print "$resultat\n";
+ save_config_data('func_extra_noround',$resultat,"Function NOROUND");
}
check_parenthesis("func_sql_","CURRENT_USER");
@@ -1200,6 +1218,32 @@ check_parenthesis("func_sql_","SESSION_USER");
check_parenthesis("func_sql_","SYSTEM_USER");
check_parenthesis("func_sql_","USER");
+# Test: WEEK()
+{
+ my $explain="";
+ my $resultat="no";
+ my $error;
+ print "WEEK:";
+ save_incomplete('func_odbc_week','WEEK');
+ $error = safe_query_result("select week(DATE '1997-02-01') $end_query",5,0);
+ # actually this query must return 4 or 5 in the $last_result,
+ # $error can be 1 (not supported at all) , -1 ( probably USA weeks)
+ # and 0 - EURO weeks
+ if ($error == -1) {
+ if ($last_result == 4) {
+ $resultat = 'USA';
+ $explain = ' started from Sunday';
+ } else {
+ $resultat='error';
+ $explain = " must return 4 or 5, but $last_error";
+ }
+ } elsif ($error == 0) {
+ $resultat = 'EURO';
+ $explain = ' started from Monday';
+ }
+ print " $resultat\n";
+ save_config_data('func_odbc_week',$resultat,"WEEK $explain");
+}
report("LIKE on numbers","like_with_number",
"create table crash_q (a int,b int)",
@@ -1682,28 +1726,36 @@ report("views","views",
"create view crash_q as select a from crash_me",
"drop view crash_q $drop_attr");
-report("foreign key syntax","foreign_key_syntax",
- create_table("crash_q",["a integer not null"],["primary key (a)"]),
- create_table("crash_q2",["a integer not null",
- "foreign key (a) references crash_q (a)"],
- []),
- "insert into crash_q values (1)",
- "insert into crash_q2 values (1)",
- "drop table crash_q2 $drop_attr",
- "drop table crash_q $drop_attr");
-
-if ($limits{'foreign_key_syntax'} eq 'yes')
+# Test: foreign key
{
- report_fail("foreign keys","foreign_key",
- create_table("crash_q",["a integer not null"],
- ["primary key (a)"]),
- create_table("crash_q2",["a integer not null",
- "foreign key (a) references crash_q (a)"],
- []),
- "insert into crash_q values (1)",
- "insert into crash_q2 values (2)",
- "drop table crash_q2 $drop_attr",
- "drop table crash_q $drop_attr");
+ my $resultat = 'undefined';
+ my $error;
+ print "foreign keys: ";
+ save_incomplete('foreign_key','foreign keys');
+
+# 1) check if foreign keys are supported
+ safe_query(create_table("crash_me_qf",["a integer not null"],
+ ["primary key (a)"]));
+ $error = safe_query( create_table("crash_me_qf2",["a integer not null",
+ "foreign key (a) references crash_me_qf (a)"], []));
+
+ if ($error eq 1) # OK -- syntax is supported
+ {
+ $resultat = 'error';
+ # now check if foreign key really works
+ safe_query( "insert into crash_me_qf values (1)");
+ if (safe_query( "insert into crash_me_qf2 values (2)") eq 1) {
+ $resultat = 'syntax only';
+ } else {
+ $resultat = 'yes';
+ }
+
+ } else {
+ $resultat = "no";
+ }
+ safe_query( "drop table crash_me_qf2 $drop_attr","drop table crash_me_qf $drop_attr");
+ print "$resultat\n";
+ save_config_data('foreign_key',$resultat,"foreign keys");
}
report("Create SCHEMA","create_schema",
@@ -1720,32 +1772,22 @@ if ($limits{'foreign_key'} eq 'yes')
}
}
-report("Column constraints","constraint_check",
- "create table crash_q (a int check (a>0))",
- "drop table crash_q $drop_attr");
+check_constraint("Column constraints","constraint_check",
+ "create table crash_q (a int check (a>0))",
+ "insert into crash_q values(0)",
+ "drop table crash_q $drop_attr");
-report("Ignoring column constraints","ignoring_constraint_check",
- "create table crash_q (a int check (a>0))",
- "insert into crash_q values(0)",
- "drop table crash_q $drop_attr") if ($limits{'constraint_check'} eq 'yes');
-report("Table constraints","constraint_check_table",
- "create table crash_q (a int ,b int, check (a>b))",
- "drop table crash_q $drop_attr");
-
-report("Ignoring table constraints","ignoring_constraint_check_table",
+check_constraint("Table constraints","constraint_check_table",
"create table crash_q (a int ,b int, check (a>b))",
"insert into crash_q values(0,0)",
- "drop table crash_q $drop_attr") if ($limits{'constraint_check_table'} eq 'yes');
-
-report("Named constraints","constraint_check_named",
- "create table crash_q (a int ,b int, constraint abc check (a>b))",
"drop table crash_q $drop_attr");
-report("Ignoring named constraints","ignoring_constraint_check_named",
+check_constraint("Named constraints","constraint_check_named",
"create table crash_q (a int ,b int, constraint abc check (a>b))",
"insert into crash_q values(0,0)",
- "drop table crash_q $drop_attr") if ($limits{'constraint_check_named'} eq 'yes');
+ "drop table crash_q $drop_attr");
+
report("NULL constraint (SyBase style)","constraint_null",
"create table crash_q (a int null)",
@@ -2236,6 +2278,29 @@ sub check_parenthesis {
save_config_data($param_name,$resultat,$fn);
}
+sub check_constraint {
+ my $prompt = shift;
+ my $key = shift;
+ my $create = shift;
+ my $check = shift;
+ my $drop = shift;
+ save_incomplete($key,$prompt);
+ print "$prompt=";
+ my $res = 'no';
+
+ if ( ($t=safe_query($create)) == 1)
+ {
+ $res='yes';
+ if (safe_query($check) == 1)
+ {
+ $res='syntax only';
+ }
+ }
+ safe_query($drop);
+ save_config_data($key,$res,$prompt);
+ print "$res\n";
+}
+
sub usage
{
print <<EOF;
@@ -2317,7 +2382,7 @@ $0 takes the following options:
--user='user_name'
User name to log into the SQL server.
---start-cmd='command to restart server'
+--db-start-cmd='command to restart server'
Automaticly restarts server with this command if the database server dies.
--sleep='time in seconds' (Default $opt_sleep)
diff --git a/sql-bench/server-cfg.sh b/sql-bench/server-cfg.sh
index 213ecacea6f..7f96c06ef99 100644
--- a/sql-bench/server-cfg.sh
+++ b/sql-bench/server-cfg.sh
@@ -216,6 +216,7 @@ sub version
}
$sth->finish;
$dbh->disconnect;
+ $version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $version;
}
@@ -251,7 +252,7 @@ sub create
$query="create table $table_name (";
foreach $field (@$fields)
{
- $field =~ s/ decimal/ double(10,2)/i;
+# $field =~ s/ decimal/ double(10,2)/i;
$field =~ s/ big_decimal/ double(10,2)/i;
$query.= $field . ',';
}
@@ -431,6 +432,8 @@ sub version
{ # Strip pre- and endspace
$tmp=$1;
$tmp =~ s/\s+/ /g; # Remove unnecessary spaces
+ $tmp .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
+
return $tmp;
}
}
@@ -619,6 +622,7 @@ sub new
sub version
{
my ($version,$dir);
+ $version = "PostgreSQL version ???";
foreach $dir ($ENV{'PGDATA'},"/usr/local/pgsql/data", "/usr/local/pg/data")
{
if ($dir && -e "$dir/PG_VERSION")
@@ -627,11 +631,13 @@ sub version
if ($? == 0)
{
chomp($version);
+ $version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return "PostgreSQL $version";
}
}
}
- return "PostgreSQL version ???";
+ $version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
+ return $version;
}
@@ -895,6 +901,7 @@ sub new
sub version
{
my ($version,$dir);
+ $version="Solid version ??";
foreach $dir ($ENV{'SOLIDDIR'},"/usr/local/solid", "/my/local/solid")
{
if ($dir && -e "$dir/bin/solcon")
@@ -903,11 +910,13 @@ sub version
if ($? == 0)
{
chomp($version);
+ $version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $version;
}
}
}
- return "Solid version ???";
+ $version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
+ return $version;
}
sub connect
@@ -1136,6 +1145,8 @@ sub version
{
$version="Empress version ???";
}
+
+ $version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $version;
}
@@ -1403,6 +1414,7 @@ sub version
}
$sth->finish;
$dbh->disconnect;
+ $version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $version;
}
@@ -1647,6 +1659,7 @@ sub version
}
$sth->finish;
$dbh->disconnect;
+ $version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $version;
}
@@ -1846,7 +1859,9 @@ sub new
sub version
{
my ($self)=@_;
- return "Access 2000"; #DBI/ODBC can't return the server version
+ my $version="Access 2000";
+ $version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
+ return $version; #DBI/ODBC can't return the server version
}
sub connect
@@ -2028,7 +2043,8 @@ sub new
sub version
{
my ($self)=@_;
- my($sth,@row);
+ my($sth,@row, $version);
+ $version='MS SQL server ?';
$dbh=$self->connect();
$sth = $dbh->prepare("SELECT \@\@VERSION") or die $DBI::errstr;
$sth->execute or die $DBI::errstr;
@@ -2036,10 +2052,11 @@ sub version
if ($row[0]) {
@server = split(/\n/,$row[0]);
chomp(@server);
- return "$server[0]";
- } else {
- return "Microsoft SQL server ?";
- }
+ $version= "$server[0]";
+ }
+ $sth->finish;
+ $version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
+ return $version;
}
sub connect
@@ -2232,8 +2249,8 @@ sub version
}
$sth->finish;
$dbh->disconnect;
+ $version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $version;
-
}
sub connect
@@ -2466,6 +2483,7 @@ sub version
}
$sth->finish;
$dbh->disconnect;
+ $version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $version;
}
@@ -2842,6 +2860,7 @@ sub version
#
$version = $dbh->func(18, GetInfo);
$dbh->disconnect;
+ $version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $version;
}
@@ -3041,6 +3060,7 @@ sub version
# $version =~ s/.*version \"(.*)\"$/$1/;
$dbh->disconnect;
$version = "6.0Beta";
+ $version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $version;
}
@@ -3246,6 +3266,7 @@ sub version
#$version = $dbh->func(18, GetInfo);
$version="FrontBase 3.3";
# $dbh->disconnect;
+ $version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $version;
}
@@ -3365,7 +3386,7 @@ sub fix_for_insert
# Configuration for SAPDB
#############################################################################
-package db_Sapdb;
+package db_sapdb;
sub new
{
@@ -3453,6 +3474,7 @@ sub version
}
$sth->finish;
$dbh->disconnect;
+ $version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $version;
}