Added handling for implicit inflate/deflate of CDBI has_a relationships
[dbsrgits/DBIx-Class.git] / t / cdbi / testlib / ImplicitInflate.pm
CommitLineData
2040ad73 1package # 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
8use strict;
9use warnings;
10
11use 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
22sub create_sql {
23 # SQLite doesn't support Datetime datatypes.
24 return qq{
25 id INTEGER PRIMARY KEY,
26 update_datetime TEXT,
27 text VARCHAR(20)
28 }
29}
30
31{
32 package MyDateStamp;
33
34 use DateTime::Format::SQLite;
35
36 sub new {
37 my ($self, $value) = @_;
38 return DateTime::Format::SQLite->parse_datetime($value);
39 }
40}
41
421;