2 |
|
|
3 |
use strict; |
use strict; |
4 |
|
|
5 |
use Test::More tests => 73; |
use Test::More tests => 94; |
6 |
|
|
7 |
BEGIN { |
BEGIN { |
8 |
use_ok('DBI'); |
use_ok('DBI'); |
31 |
my $sth = $dbh->prepare($sql) || die $dbh->errstr(); |
my $sth = $dbh->prepare($sql) || die $dbh->errstr(); |
32 |
ok($sth, "sth"); |
ok($sth, "sth"); |
33 |
|
|
34 |
|
my $sql_node = "select id from pgest('http://localhost:1978/node/trivia','admin','admin',?,?,?,?,?,array['\@id']) as (id text)"; |
35 |
|
my $sth_node = $dbh->prepare($sql_node) || die $dbh->errstr(); |
36 |
|
ok($sth_node, "sth_node"); |
37 |
|
|
38 |
sub pgest { |
sub pgest { |
39 |
$sth->execute(@_) || die $sth->errstr(); |
$sth->execute(@_) || die $sth->errstr(); |
40 |
|
$sth_node->execute(@_) || die $sth_node->errstr(); |
41 |
{ |
{ |
42 |
no warnings; |
no warnings; |
43 |
ok($sth, "execute(".join(",",@_).")"); |
ok($sth, "execute(".join(",",@_).")"); |
44 |
|
ok($sth_node, "execute on node"); |
45 |
} |
} |
46 |
|
|
47 |
my @arr; |
my @arr; |
48 |
while (my ($id) = $sth->fetchrow_array() ) { |
while (my ($id) = $sth->fetchrow_array() ) { |
49 |
push @arr, $id; |
push @arr, $id; |
50 |
} |
} |
51 |
ok(@arr, "pgest results: ".($#arr + 1)); |
my @arr_node; |
52 |
|
while (my ($id) = $sth_node->fetchrow_array() ) { |
53 |
|
push @arr_node, $id; |
54 |
|
} |
55 |
|
cmp_ok($#arr, '==', $#arr_node, "pgest direct and node results"); |
56 |
|
|
57 |
return @arr; |
return @arr; |
58 |
} |
} |