-
Notifications
You must be signed in to change notification settings - Fork 14
/
proctest3.pl
executable file
·57 lines (40 loc) · 1006 Bytes
/
proctest3.pl
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
#!perl -w
# $Id$
use DBI;
use strict;
my $dbh = DBI->connect();
$dbh->{LongReadLen} = 8000;
eval {
local $dbh->{PrintError} = 0;
$dbh->do("drop procedure PERL_DBD_TESTPRC");
};
$dbh->do("CREATE PROCEDURE PERL_DBD_TESTPRC
\@parameter1 int = 0
AS
if (\@parameter1 >= 0)
select * from systypes
RETURN(\@parameter1)
");
sub test()
{
my $sth = $dbh->prepare("{call PERL_DBD_TESTPRC(?)}");
$sth->bind_param(1, -1, { TYPE => 4 });
$sth->execute();
print '$sth->{NUM_OF_FIELDS}: ', $sth->{NUM_OF_FIELDS}, " expected: 0\n";
if($sth->{NUM_OF_FIELDS}) {
my @row;
while (@row = $sth->fetchrow_array()) {
print join(', ', @row), "\n";
}
}
}
##########################################
### Test
##########################################
unlink("dbitrace.log") if (-e "dbitrace.log");
$dbh->trace(9, "dbitrace.log");
test();
##########################################
### Cleanup...
##########################################
$dbh->disconnect;