NAME
SQLx::Lite - Modernish interface to the DBI module
DESCRIPTION
This module is an attempt at a friendly interface to the DBI module. While DBI is fantastic, it can be a little daunting to use if you've never used it before. SQLx::Lite attempts to make using it easy, and a little more modern. This module is still under _heavy_ development and currently only allows you to search for results and update them
SYNOPSIS
use SQLx::Lite;
my $dbh = SQLx::Lite->new(
dbi => 'Pg:host=localhost;dbname=test',
user => 'username',
pass => 'password',
)->connect;
my $res = $dbh->resultset('users')->search([], { user => 'foo', pass => 'bar' });
if ($res->count > 0) {
print "Found " . $res->count . " row(s)\n";
for my $row (@{$res->result}) {
print "Username: $row->{user}\n";
}
}
new
Sets the needed parameters to connect to DBI. Currently, there is dbi, user and pass. Obviously if you're using SQLite then you can ommit the username and password.
my $s = SQLx::Lite->new(
dbi => 'SQLite:/var/db/test.db',
);
my $s = SQLx::Lite->new(
dbi => 'Pg:host=myhost;dbname=dbname',
user => 'username',
pass => 'password',
);
connect
Blesses the DBI connection, if it succeeds as SQLx::Lite::DBH so you can use it in resultsets (Tables).
$dbh = $sqlobj->connect;
The best way to do this is read the SYNOPSIS.
last_error
Set or returns the last error
AUTHOR
Brad Haywood <brad@geeksware.net>
LICENSE
Same License as Perl