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
26 create_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 __PACKAGE__->set_table('test');
33
34 This combines creating the table with the normal Class::DBI table()
35 call.
36
37 create_sql (abstract)
38 sub create_sql {
39 return q{
40 id INTEGER PRIMARY KEY,
41 name CHAR(40),
42 film VARCHAR(255),
43 salary INT
44 }
45 }
46
47 This should return, as a text string, the schema for the table
48 represented by this class.
49
50
51
52perl v5.32.0 2020-07-28 Class::DBI::Test::SQLite(3)