/usr/share/doc/libdbd-odbc-perl/examples/testproc3.pl is in libdbd-odbc-perl 1.56-1build1.
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 | #!/usr/bin/perl -w
# $Id$
use strict;
use DBI;
my $dbh = DBI->connect();
eval {$dbh->do("DROP TABLE table1");};
eval {$dbh->do("CREATE TABLE table1 (i INTEGER)");};
eval {$dbh->do("DROP TABLE table2");};
eval {$dbh->do("CREATE TABLE table2 (i INTEGER)");};
eval {$dbh->do("DROP PROCEDURE proc1");};
eval {$dbh->do("CREATE PROCEDURE proc1 \@inputval int AS ".
"INSERT INTO table1 VALUES (\@inputval); " .
" return \@inputval;");};
if ($@) { print $@, "\n"; }
unlink "dbitrace.log" if (-e "dbitrace.log");
$dbh->trace(9, "dbitrace.log");
# Insert a row into table1, either directly or indirectly:
my $direct = 0;
my $sth1;
$sth1 = $dbh->prepare ("{? = call proc1(?) }");
my $output = 0;
my $i = 0;
while ($i < 4) {
# Insert a row into table2 (this fails after an indirect insertion):
$sth1->bind_param_inout(1, \$output, 50, DBI::SQL_INTEGER);
$sth1->bind_param(2, $i, DBI::SQL_INTEGER);
$sth1->execute();
print "$output\n";
$i++;
}
my $sth = $dbh->prepare("select * from table1");
$sth->execute;
my @row;
while (@row = $sth->fetchrow_array) {
print join(', ', @row), "\n";
}
$dbh->disconnect;
|