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
#
# This library is free software; you can redistribute it and/or
......@@ -1720,32 +1719,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");
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');
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("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 +2225,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;
......
......@@ -216,6 +216,7 @@ sub version
}
$sth->finish;
$dbh->disconnect;
$version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $version;
}
......@@ -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;
}
......@@ -3453,6 +3474,7 @@ sub version
}
$sth->finish;
$dbh->disconnect;
$version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
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