Commit fbbc087a authored by walrus@mysql.com's avatar walrus@mysql.com

Merge constraint tests with "ignoring constarint tests"

for column,table and named constarints. Now constraint test produces
exactly one line in report, with "yes","no" or syntax only".

add /odbc to server-version if benchmark/crash-me works over odbc
parent 0e69119f
#!@PERL@
# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB # Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
# #
# This library is free software; you can redistribute it and/or # This library is free software; you can redistribute it and/or
...@@ -1720,32 +1719,22 @@ if ($limits{'foreign_key'} eq 'yes') ...@@ -1720,32 +1719,22 @@ if ($limits{'foreign_key'} eq 'yes')
} }
} }
report("Column constraints","constraint_check", check_constraint("Column constraints","constraint_check",
"create table crash_q (a int check (a>0))", "create table crash_q (a int check (a>0))",
"drop table crash_q $drop_attr"); "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))", "create table crash_q (a int ,b int, check (a>b))",
"insert into crash_q values(0,0)", "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"); "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))", "create table crash_q (a int ,b int, constraint abc check (a>b))",
"insert into crash_q values(0,0)", "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", report("NULL constraint (SyBase style)","constraint_null",
"create table crash_q (a int null)", "create table crash_q (a int null)",
...@@ -2236,6 +2225,29 @@ sub check_parenthesis { ...@@ -2236,6 +2225,29 @@ sub check_parenthesis {
save_config_data($param_name,$resultat,$fn); 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 sub usage
{ {
print <<EOF; print <<EOF;
......
...@@ -216,6 +216,7 @@ sub version ...@@ -216,6 +216,7 @@ sub version
} }
$sth->finish; $sth->finish;
$dbh->disconnect; $dbh->disconnect;
$version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $version; return $version;
} }
...@@ -431,6 +432,8 @@ sub version ...@@ -431,6 +432,8 @@ sub version
{ # Strip pre- and endspace { # Strip pre- and endspace
$tmp=$1; $tmp=$1;
$tmp =~ s/\s+/ /g; # Remove unnecessary spaces $tmp =~ s/\s+/ /g; # Remove unnecessary spaces
$tmp .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $tmp; return $tmp;
} }
} }
...@@ -619,6 +622,7 @@ sub new ...@@ -619,6 +622,7 @@ sub new
sub version sub version
{ {
my ($version,$dir); my ($version,$dir);
$version = "PostgreSQL version ???";
foreach $dir ($ENV{'PGDATA'},"/usr/local/pgsql/data", "/usr/local/pg/data") foreach $dir ($ENV{'PGDATA'},"/usr/local/pgsql/data", "/usr/local/pg/data")
{ {
if ($dir && -e "$dir/PG_VERSION") if ($dir && -e "$dir/PG_VERSION")
...@@ -627,11 +631,13 @@ sub version ...@@ -627,11 +631,13 @@ sub version
if ($? == 0) if ($? == 0)
{ {
chomp($version); chomp($version);
$version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return "PostgreSQL $version"; return "PostgreSQL $version";
} }
} }
} }
return "PostgreSQL version ???"; $version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $version;
} }
...@@ -895,6 +901,7 @@ sub new ...@@ -895,6 +901,7 @@ sub new
sub version sub version
{ {
my ($version,$dir); my ($version,$dir);
$version="Solid version ??";
foreach $dir ($ENV{'SOLIDDIR'},"/usr/local/solid", "/my/local/solid") foreach $dir ($ENV{'SOLIDDIR'},"/usr/local/solid", "/my/local/solid")
{ {
if ($dir && -e "$dir/bin/solcon") if ($dir && -e "$dir/bin/solcon")
...@@ -903,11 +910,13 @@ sub version ...@@ -903,11 +910,13 @@ sub version
if ($? == 0) if ($? == 0)
{ {
chomp($version); chomp($version);
$version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $version; return $version;
} }
} }
} }
return "Solid version ???"; $version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $version;
} }
sub connect sub connect
...@@ -1136,6 +1145,8 @@ sub version ...@@ -1136,6 +1145,8 @@ sub version
{ {
$version="Empress version ???"; $version="Empress version ???";
} }
$version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $version; return $version;
} }
...@@ -1403,6 +1414,7 @@ sub version ...@@ -1403,6 +1414,7 @@ sub version
} }
$sth->finish; $sth->finish;
$dbh->disconnect; $dbh->disconnect;
$version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $version; return $version;
} }
...@@ -1647,6 +1659,7 @@ sub version ...@@ -1647,6 +1659,7 @@ sub version
} }
$sth->finish; $sth->finish;
$dbh->disconnect; $dbh->disconnect;
$version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $version; return $version;
} }
...@@ -1846,7 +1859,9 @@ sub new ...@@ -1846,7 +1859,9 @@ sub new
sub version sub version
{ {
my ($self)=@_; 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 sub connect
...@@ -2028,7 +2043,8 @@ sub new ...@@ -2028,7 +2043,8 @@ sub new
sub version sub version
{ {
my ($self)=@_; my ($self)=@_;
my($sth,@row); my($sth,@row, $version);
$version='MS SQL server ?';
$dbh=$self->connect(); $dbh=$self->connect();
$sth = $dbh->prepare("SELECT \@\@VERSION") or die $DBI::errstr; $sth = $dbh->prepare("SELECT \@\@VERSION") or die $DBI::errstr;
$sth->execute or die $DBI::errstr; $sth->execute or die $DBI::errstr;
...@@ -2036,10 +2052,11 @@ sub version ...@@ -2036,10 +2052,11 @@ sub version
if ($row[0]) { if ($row[0]) {
@server = split(/\n/,$row[0]); @server = split(/\n/,$row[0]);
chomp(@server); chomp(@server);
return "$server[0]"; $version= "$server[0]";
} else { }
return "Microsoft SQL server ?"; $sth->finish;
} $version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $version;
} }
sub connect sub connect
...@@ -2232,8 +2249,8 @@ sub version ...@@ -2232,8 +2249,8 @@ sub version
} }
$sth->finish; $sth->finish;
$dbh->disconnect; $dbh->disconnect;
$version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $version; return $version;
} }
sub connect sub connect
...@@ -2466,6 +2483,7 @@ sub version ...@@ -2466,6 +2483,7 @@ sub version
} }
$sth->finish; $sth->finish;
$dbh->disconnect; $dbh->disconnect;
$version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $version; return $version;
} }
...@@ -2842,6 +2860,7 @@ sub version ...@@ -2842,6 +2860,7 @@ sub version
# #
$version = $dbh->func(18, GetInfo); $version = $dbh->func(18, GetInfo);
$dbh->disconnect; $dbh->disconnect;
$version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $version; return $version;
} }
...@@ -3041,6 +3060,7 @@ sub version ...@@ -3041,6 +3060,7 @@ sub version
# $version =~ s/.*version \"(.*)\"$/$1/; # $version =~ s/.*version \"(.*)\"$/$1/;
$dbh->disconnect; $dbh->disconnect;
$version = "6.0Beta"; $version = "6.0Beta";
$version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $version; return $version;
} }
...@@ -3246,6 +3266,7 @@ sub version ...@@ -3246,6 +3266,7 @@ sub version
#$version = $dbh->func(18, GetInfo); #$version = $dbh->func(18, GetInfo);
$version="FrontBase 3.3"; $version="FrontBase 3.3";
# $dbh->disconnect; # $dbh->disconnect;
$version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $version; return $version;
} }
...@@ -3453,6 +3474,7 @@ sub version ...@@ -3453,6 +3474,7 @@ sub version
} }
$sth->finish; $sth->finish;
$dbh->disconnect; $dbh->disconnect;
$version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $version; return $version;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment