Skip to content

Commit 720dc26

Browse files
author
H.Merijn Brand
committedFeb 6, 2015
Two examples for DBI (p5 vs p6)
It does not yet support scalarIO or bind by reference it is now a known issue with the Inline::Perl5 folk, to whom I was able to explain its use and that the purpose was not just for speed
1 parent 63b911d commit 720dc26

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
 

‎dbi5.pl

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/pro/bin/perl
2+
3+
use 5.20.0;
4+
use warnings;
5+
6+
use DBI;
7+
8+
my $dbh = DBI->connect ("dbi:Pg:");
9+
10+
my $sth = $dbh->prepare ("select count (*) from url");
11+
$sth->execute;
12+
$sth->bind_columns (\my $count);
13+
$sth->fetch;
14+
say $count;

‎dbi6.pl

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!perl6
2+
3+
use v6;
4+
use Slang::Tuxic;
5+
use Inline::Perl5;
6+
7+
my $p5 = Inline::Perl5.new;
8+
9+
$p5.use ("DBI");
10+
11+
my $dbh = $p5.invoke ("DBI", "connect", "dbi:Pg:");
12+
13+
my $sth = $dbh.prepare ("select count (*) from url");
14+
$sth.execute;
15+
$sth.bind_columns (\my $count);
16+
my @count = $sth.fetchrow_array;
17+
@count[0].say;

0 commit comments

Comments
 (0)