Home > esquel

esquel

Esquel is a project mainly written in PERL and SHELL, it's free.

SQL made Easy in Perl 6 (abandoned and broken.)

Esquel -- An Object-Oriented SQL Library for Perl 6

NOTE: This is a work in progress, not everything is completed or tested yet. The Esquel::DBI module hasn't even been started. When it's done, I'll be moving onto Oharem (see doc/oharem.txt) Oh, and until Rakudo "nom" is fixed, and MiniDBI is ported to it, the Esquel::DBI library will only work on the "ng" branch of Rakudo.

A simple way to generate SQL statements using native Perl 6 calls. Inspired by SQL::Abstract from Perl 5.

For example (using the MiniDBI interface):

my $sql = Esquel.new; my ($stmt, @bind) = $sql.bind.from($table).where(:$id).select('name', 'job');

SELECT name, job FROM $table WHERE id = $id;

my $sth = $dbh.prepare($stmt); $sth.execute(|@bind); my $result = $sth.fetchrow_hashref; say "{$result} is a {$result}";

For an even simpler interface (but assuming a DBI-compatible library) you can use the Esquel::DBI wrapper, which turns the above into:

Pass it the DBH object returned from a connect() call.

my $db = Esquel::DBI.new($dbh); my $result = $db.where(:$id).select('name', 'job').row; say "{$result} is a {$result}";

Author: Timothy Totten License: Artistic License 2.0

Previous:ClaudioTeste2