Commit | Line | Data |
2040ad73 |
1 | package # Hide from PAUSE |
2 | ImplicitInflate; |
3 | |
4 | # Test class for the testing of Implicit inflation |
5 | # in CDBI Classes using Compat layer |
6 | # See t/cdbi/70-implicit_inflate.t |
7 | |
8 | use strict; |
9 | use warnings; |
10 | |
11 | use base 'DBIC::Test::SQLite'; |
12 | |
13 | __PACKAGE__->set_table('Date'); |
14 | |
15 | __PACKAGE__->columns( Primary => 'id' ); |
16 | __PACKAGE__->columns( All => qw/ update_datetime text/); |
17 | |
18 | __PACKAGE__->has_a( |
19 | update_datetime => 'MyDateStamp', |
20 | ); |
21 | |
7305f6f9 |
22 | |
23 | # Disables the implicit autoinc-on-non-supplied-pk behavior |
24 | # (and the warning that goes with it) |
25 | # This is the same behavior as it was pre 0.082900 |
26 | __PACKAGE__->column_info('id')->{is_auto_increment} = 0; |
27 | |
2040ad73 |
28 | sub create_sql { |
29 | # SQLite doesn't support Datetime datatypes. |
30 | return qq{ |
31 | id INTEGER PRIMARY KEY, |
32 | update_datetime TEXT, |
33 | text VARCHAR(20) |
34 | } |
35 | } |
36 | |
37 | { |
38 | package MyDateStamp; |
39 | |
40 | use DateTime::Format::SQLite; |
41 | |
42 | sub new { |
43 | my ($self, $value) = @_; |
44 | return DateTime::Format::SQLite->parse_datetime($value); |
45 | } |
46 | } |
47 | |
48 | 1; |