DBD-ODBC
view release on metacpan or search on metacpan
examples/thrtest.pl view on Meta::CPAN
if ($action == 0 && $doerr )
{
# create a syntax error
my $sth = $dbh->prepare("SELECT userID, authHandler FROM") ;
die "no error" if (!$DBI::errstr) ;
}
elsif ($action == 1 && !$cursor1)
{
$cursor1 -> finish if ($cursor1) ;
$cursor1 = $dbh->prepare("SELECT userID, authHandler, password
FROM thrtest1 WHERE login = ? and locked IS NULL
ORDER BY password");
die "db error $DBI::errstr" if (!$doerr && $DBI::errstr) ;
}
elsif ($action == 2 && !$cursor2)
{
$cursor2 -> finish if ($cursor2) ;
$cursor2 = $dbh->prepare("SELECT authMode, data FROM
thrtest2 WHERE handlerID = ?");
die "db error $DBI::errstr" if (!$doerr && $DBI::errstr) ;
}
examples/thrtest.pl view on Meta::CPAN
{
$cursor3 -> finish if ($cursor3) ;
$cursor3 = $dbh->prepare("UPDATE thrtest2 SET lastLogin =
now() WHERE userID = ?");
die "db error $DBI::errstr" if (!$doerr && $DBI::errstr) ;
}
elsif ($action == 4 && $cursor1 && $login)
{
#$cursor1 -> finish if ($cursor1) ;
#$cursor1 = $dbh->prepare("SELECT userID, authHandler, password
# FROM thrtest1 WHERE login = ? and locked IS NULL
# ORDER BY password");
#
$cursor1->execute($login) ;
$cursor1->bind_columns(\($userID, $authHandler, $passwd));
$cursor1->fetch;
die "**** user is = $userID, should = $id" if ($id ne $userID) ;
die "**** db error $DBI::errstr" if (!$doerr && $DBI::errstr) ;
}
elsif ($action == 5 && $authHandler && $cursor2)
{
examples/thrtest.pl view on Meta::CPAN
#
# create table thrtest1 & thrtest2 and put some test data in
#
my $dbh = DBI -> connect ($ENV{DBIDSN}, 'scott', 'tiger') or die "Cannot connect to $ENV{DBIDSN}" ;
eval {
$dbh -> do ('drop table thrtest1') ;
$dbh -> do ('drop table thrtest2') ;
} ;
my $c = q{ create table thrtest1 (userID varchar(80), authHandler varchar(80), password varchar(80), login varchar(80), lastLogin date, locked int) } ;
$dbh -> do ($c) ;
my $c = q{ create table thrtest2 (handlerID varchar(80), authMode varchar(80), data varchar(80)) } ;
$dbh -> do ($c) ;
$dbh -> do ("insert into thrtest1 values ('gr', 'w32', '', 'richter', NULL, NULL)") ;
$dbh -> do ("insert into thrtest1 values ('tt', 'w32', '', 'test', NULL, NULL)") ;
( run in 0.488 second using v1.01-cache-2.11-cpan-49f99fa48dc )