Extension to class::dbi for sqlite
package Film;
use base qw(Class::DBI::SQLite);
_\|_PACKAGE_\|_->set_db('Main', 'dbi:SQLite:dbname=dbfile', '', '');
_\|_PACKAGE_\|_->set_up_table('Movies');
package main;
my $film = Film->create({
name => 'Bad Taste',
title => 'Peter Jackson',
});
my $id = $film->id; # auto-incremented
Class::DBI::SQLite is an extension to Class::DBI for DBD::SQLite. It allows you to populate an auto-incremented row id after insert.
The \*(C`set_up_table\*(C' method automates the setup of columns and primary key(s) via the SQLite \s-1PRAGMA\s0 statement.
Tatsuhiko Miyagawa <[email protected]>
\*(C`set_up_table\*(C' implementation by Tomohiro Ikebe <[email protected]>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Class::DBI, DBD::SQLite