/usr/share/doc/libdbd-odbc-perl/examples/joetest7.pl is in libdbd-odbc-perl 1.50-1+b1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | #!/usr/bin/perl -w
# $Id$
use strict;
use DBI qw(:sql_types);
my $dbh=DBI->connect() or die "Can't connect";
eval {$dbh->do("DROP TABLE table1");};
eval {$dbh->do("CREATE TABLE table1 (i INTEGER)");};
eval {$dbh->do("DROP PROCEDURE proc1");};
my $proc1 = <<EOT;
CREATE PROCEDURE proc1 (\@i INT) AS
DECLARE \@result INT;
BEGIN
SET \@result = 1;
select \@result;
select \@result, \@result;
IF (\@i = 99)
BEGIN
UPDATE table1 SET i=\@i;
END;
SELECT \@result;
END
EOT
eval {$dbh->do($proc1);};
if (-e "dbitrace.log") {
unlink("dbitrace.log");
}
$dbh->trace(9,"dbitrace.log");
my $sth = $dbh->prepare ("{call proc1 (?)}");
my $success = -1;
$sth->bind_param (1, 99, SQL_INTEGER);
$sth->execute();
$success = -1;
do {
print "Num of fields: $sth->{NUM_OF_FIELDS}\n";
while (my @data = $sth->fetchrow_array()) {
($success) = @data;
print "Num of fields: $sth->{NUM_OF_FIELDS}\n"
}
} while $sth->{odbc_more_results};
print "$success Finished #1\n";
$sth->bind_param (1, 10, SQL_INTEGER);
$sth->execute();
$success = -1;
do {
while (my @data = $sth->fetchrow_array()) {($success) = @data;}
} while $sth->{odbc_more_results};
print "$success Finished #2\n";
$sth->bind_param (1, 99, SQL_INTEGER);
$sth->execute();
$success = -1;
do {
while (my @data = $sth->fetchrow_array()) {($success) = @data;}
} while $sth->{odbc_more_results};
print "$success Finished #3\n";
$sth->bind_param (1, 99, SQL_INTEGER);
$sth->execute();
$success = -1;
do {
while (my @data = $sth->fetchrow_array()) {($success) = @data;}
} while $sth->{odbc_more_results};
print "$success Finished #4\n";
$dbh->disconnect;
|