1Class::DBI::Test::SQLitUes(e3r)Contributed Perl DocumentCaltaisosn::DBI::Test::SQLite(3)
2
3
4
6 Class::DBI::Test::SQLite - Base class for Class::DBI tests
7
9 use base 'Class::DBI::Test::SQLite';
10
11 __PACKAGE__->set_table('test');
12 __PACKAGE__->columns(All => qw/id name film salary/);
13
14 sub create_sql {
15 return q{
16 id INTEGER PRIMARY KEY,
17 name CHAR(40),
18 film VARCHAR(255),
19 salary INT
20 }
21 }
22
24 This provides a simple base class for Class::DBI tests using SQLite.
25 Each class for the test should inherit from this, provide a cre‐
26 ate_sql() method which returns a string representing the SQL used to
27 create the table for the class, and then call set_table() to create the
28 table, and tie it to the class.
29
31 set_table
32
33 __PACKAGE__->set_table('test');
34
35 This combines creating the table with the normal Class::DBI table()
36 call.
37
38 create_sql (abstract)
39
40 sub create_sql {
41 return q{
42 id INTEGER PRIMARY KEY,
43 name CHAR(40),
44 film VARCHAR(255),
45 salary INT
46 }
47 }
48
49 This should return, as a text string, the schema for the table repre‐
50 sented by this class.
51
52
53
54perl v5.8.8 2006-11-05 Class::DBI::Test::SQLite(3)