Base class for class::dbi tests
use base 'Class::DBI::Test::SQLite'; _\|_PACKAGE_\|_->set_table('test'); _\|_PACKAGE_\|_->columns(All => qw/id name film salary/); sub create_sql { return q{ id INTEGER PRIMARY KEY, name CHAR(40), film VARCHAR(255), salary INT } }
This provides a simple base class for Class::DBI tests using SQLite. Each class for the test should inherit from this, provide a create_sql() method which returns a string representing the \s-1SQL\s0 used to create the table for the class, and then call set_table() to create the table, and tie it to the class.
_\|_PACKAGE_\|_->set_table('test');
This combines creating the table with the normal Class::DBI table() call.
sub create_sql { return q{ id INTEGER PRIMARY KEY, name CHAR(40), film VARCHAR(255), salary INT } }
This should return, as a text string, the schema for the table represented by this class.