Skip to content

Commit

Permalink
Two examples for DBI (p5 vs p6)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
H.Merijn Brand committed Feb 6, 2015
1 parent 63b911d commit 720dc26
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
14 changes: 14 additions & 0 deletions dbi5.pl
@@ -0,0 +1,14 @@
#!/pro/bin/perl

use 5.20.0;
use warnings;

use DBI;

my $dbh = DBI->connect ("dbi:Pg:");

my $sth = $dbh->prepare ("select count (*) from url");
$sth->execute;
$sth->bind_columns (\my $count);
$sth->fetch;
say $count;
17 changes: 17 additions & 0 deletions dbi6.pl
@@ -0,0 +1,17 @@
#!perl6

use v6;
use Slang::Tuxic;
use Inline::Perl5;

my $p5 = Inline::Perl5.new;

$p5.use ("DBI");

my $dbh = $p5.invoke ("DBI", "connect", "dbi:Pg:");

my $sth = $dbh.prepare ("select count (*) from url");
$sth.execute;
$sth.bind_columns (\my $count);
my @count = $sth.fetchrow_array;
@count[0].say;

0 comments on commit 720dc26

Please sign in to comment.