In some cases, you'll have no use for any of DBIC's functionality. DBIC
might not work with your database, or perhaps you're migrating a legacy application that has well-tested database queries that you don't want to rewrite. In this sort of situation, you can write the entire database model manually.
In the next example, we'll use Catalyst::Model::DBI
to set up the basic DBI layer and the write methods (like we did above) to access the data in the model. As we have the AddressBook
application working, we'll add a DBI
model and write some queries against the AddressBook database.
First, we need to create the model. We'll call it AddressDBI:
$ perl script/addressbook_create.pl model AddressDBI DBI DBI:SQLite:database
When you open the generated AddressBook::Model::AddressDBI
file, you should see something like this:
package AddressBook::Model::AddressDBI; use strict; use base 'Catalyst::Model::DBI'; __PACKAGE__->config( dsn => 'DBI:SQLite:database...