DBD-MaxDB
view release on metacpan or search on metacpan
t/056stmtproperties.t view on Meta::CPAN
exit;
}
}
print "1..$tests\n";
my $dbh = DBI->connect() or die "Can't connect $DBI::err $DBI::errstr\n";
MaxDBTest::Test(1);
print " Test 2: check prepare statement\n";
$sth = $dbh->prepare("Select 'Homer' as father, 'Bart' as sun from dual") or die "Can't prepare statement $DBI::err $DBI::errstr\n";
MaxDBTest::Test(1);
print " Test 3: check CURSORNAME option\n";
$cname = $sth->{"CURSORNAME"};
print "$cname\n";
MaxDBTest::Test($cname);
print " Test 4: check MAXDB_FETCHSIZE option\n";
$res = $sth->{"MAXDB_FETCHSIZE"};
if (! defined $res){
MaxDBTest::Test(1);
} else {
MaxDBTest::Test($sth->{"MAXDB_FETCHSIZE"});
}
print " Test 5: check MAXDB_MAXROWS option\n";
MaxDBTest::Test(($sth->{"MAXDB_MAXROWS"}==0)?1:$sth->{"MAXDB_MAXROWS"});
print " Test 6: check MAXDB_RESULTSETCONCURRENCY option\n";
MaxDBTest::Test($sth->{"MAXDB_RESULTSETCONCURRENCY"});
print " Test 7: check MAXDB_RESULTSETTYPE option\n";
MaxDBTest::Test($sth->{"MAXDB_RESULTSETTYPE"});
print " Test 8: check MAXDB_ROWSAFFECTED option\n";
MaxDBTest::Test($sth->{"MAXDB_ROWSAFFECTED"});
print " Test 9: check MAXDB_ROWSETSIZE option\n";
if (! defined $sth->{"MAXDB_ROWSETSIZE"}){
MaxDBTest::Test(1);
} else {
MaxDBTest::Test($sth->{"MAXDB_ROWSETSIZE"});
}
print " Test 10: check MAXDB_TABLENAME option\n";
if (! defined $sth->{"MAXDB_TABLENAME"}){
MaxDBTest::Test(1);
} else {
MaxDBTest::Test($sth->{"MAXDB_TABLENAME"});
}
print " Test 11: check set CURSORNAME option\n";
$sth->{"CURSORNAME"}="SIMPSON";
MaxDBTest::Test(1);
print " Test 12: check modified CURSORNAME option\n";
$cname = $sth->{"CURSORNAME"};
print "$cname\n";
if ($cname eq "SIMPSON"){
MaxDBTest::Test(1);
} else {
MaxDBTest::Test(0, "Wrong cursor name $cname\n");
}
print " Test 13: check MAXDB_FETCHSIZE option\n";
$sth->{"MAXDB_FETCHSIZE"}=10;
MaxDBTest::Test(1);
print " Test 14: check modified MAXDB_FETCHSIZE option\n";
if ($sth->{"MAXDB_FETCHSIZE"}==10){
MaxDBTest::Test(1);
} else {
MaxDBTest::Test(0, "Wrong fetchsize $sth->{'MAXDB_FETCHSIZE'}\n");
}
print " Test 15: check MAXDB_MAXROWS option\n";
$sth->{"MAXDB_MAXROWS"}=10;
MaxDBTest::Test(1);
print " Test 16: check modified MAXDB_MAXROWS option\n";
if ($sth->{"MAXDB_MAXROWS"}==10){
MaxDBTest::Test(1);
} else {
MaxDBTest::Test(0, "Wrong fetchsize $sth->{'MAXDB_MAXROWS'}\n");
}
print " Test 17: check MAXDB_ROWSAFFECTED option\n";
$sth = $dbh->prepare("create table TEMP.HOMER (a int)");
$sth->execute();
MaxDBTest::Test(1);
print " Test 18: check modified MAXDB_ROWSAFFECTED option\n";
if ($sth->{"MAXDB_ROWSAFFECTED"}==0){
MaxDBTest::Test(1);
} else {
MaxDBTest::Test(0, "Wrong rowcount $sth->{'MAXDB_ROWSAFFECTED'}\n");
}
print " Test 19: check MAXDB_ROWSETSIZE option\n";
$sth->{"MAXDB_ROWSETSIZE"}=10;
MaxDBTest::Test(1);
print " Test 20: check modified MAXDB_ROWSETSIZE option\n";
if ($sth->{"MAXDB_ROWSETSIZE"}==10){
MaxDBTest::Test(1);
} else {
MaxDBTest::Test(0, "Wrong MAXDB_ROWSETSIZE $sth->{'ROWSETSIZE'}\n");
}
print " Test 21: check MAXDB_TABLENAME option\n";
$sth = $dbh->prepare("select * from TEMP.HOMER for update of a\n");
$sth->execute() or die "Can't execute statement $DBI::err $DBI::errstr\n";
MaxDBTest::Test(1);
print " Test 22: check MAXDB_TABLENAME option\n";
print "tablename $sth->{'MAXDB_TABLENAME'}\n";
if ($sth->{"MAXDB_TABLENAME"}eq '"TEMP"."HOMER"'){
MaxDBTest::Test(1);
} else {
MaxDBTest::Test(0, "Wrong tablename $sth->{'MAXDB_TABLENAME'}\n");
}
print " Test 23: check MAXDB_RESULTSETCONCURRENCY option\n";
$sth = $dbh->prepare("select * from dual\n");
print "$sth->{'MAXDB_RESULTSETCONCURRENCY'}\n";
if ($sth->{"MAXDB_RESULTSETCONCURRENCY"}eq 'CONCUR_READ_ONLY'){
MaxDBTest::Test(1);
( run in 1.626 second using v1.01-cache-2.11-cpan-39bf76dae61 )