Skip to content

Instantly share code, notes, and snippets.

@cjac
Created November 18, 2019 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjac/97177ebedfbbf3d6672b882f5f806aec to your computer and use it in GitHub Desktop.
Save cjac/97177ebedfbbf3d6672b882f5f806aec to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl6
use v6;
use DBIish;
my $password="password";
my $dbh = DBIish.connect('mysql', :database<grammar>, :user<grammaradm>, :$password);
say "connect completed";
my $sth = $dbh.prepare(q:to/STATEMENT/);
SELECT id, word, cat_id
FROM lexeme
ORDER by word
STATEMENT
say "prepare completed";
$sth.execute();
my @rows = $sth.allrows();
say "fetched all rows";
say "row count: " ~ @rows.elems;
$sth.finish;
$dbh.dispose;
----
connect completed
prepare completed
fetched all rows
row count: 72
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment