File Coverage

blib/lib/DBIx/Class/ResultDDL/V0.pm
Criterion Covered Total %
statement 23 38 60.5
branch 11 30 36.6
condition n/a
subroutine 18 33 54.5
pod 31 31 100.0
total 83 132 62.8


line stmt bran cond sub pod time code
1             package DBIx::Class::ResultDDL::V0;
2 3     3   2874 use DBIx::Class::ResultDDL::V1 -exporter_setup => 1;
  3         10  
  3         30  
3 3     3   695 use Carp;
  3         9  
  3         2657  
4              
5             # ABSTRACT: Back-compat for version 0 of this module
6              
7              
8             my @V0= qw(
9             table
10             col
11             null default auto_inc fk
12             integer unsigned tinyint smallint bigint decimal numeric
13             char varchar nchar nvarchar binary varbinary blob text ntext
14             date datetime timestamp enum bool boolean
15             inflate_json
16             primary_key
17             rel_one rel_many has_one might_have has_many belongs_to many_to_many
18             ddl_cascade dbic_cascade
19             );
20             our %EXPORT_TAGS;
21             $EXPORT_TAGS{V0}= \@V0;
22             export @V0;
23              
24              
25 5     5 1 22 sub null { is_nullable => 1 }
26 2     2 1 15 sub auto_inc { is_auto_increment => 1 }
27 0     0 1 0 sub fk { is_foreign_key => 1 }
28              
29              
30 6 50   6 1 3814 sub integer { data_type => 'integer', size => (defined $_[0]? $_[0] : 11) }
31 1     1 1 5 sub unsigned { 'extra.unsigned' => 1 }
32 1     1 1 5 sub tinyint { data_type => 'tinyint', size => 4 }
33 1     1 1 5 sub smallint { data_type => 'smallint', size => 6 }
34 1     1 1 6 sub bigint { data_type => 'bigint', size => 22 }
35             sub decimal {
36 1 50   1 1 4 croak "2 size parameters are required" unless scalar(@_) == 2;
37 1         6 return data_type => 'decimal', size => [ @_ ];
38             }
39 1     1 1 4 sub numeric { &decimal, data_type => 'numeric' }
40              
41              
42 3 100   3 1 468 sub char { data_type => 'char', size => (defined $_[0]? $_[0] : 1) }
43 2 100   2 1 21 sub nchar { data_type => 'nchar', size => (defined $_[0]? $_[0] : 1) }
44 4 50   4 1 32 sub varchar { data_type => 'varchar', size => (defined $_[0]? $_[0] : 255) }
45 1 50   1 1 9 sub nvarchar { data_type => 'nvarchar', size => (defined $_[0]? $_[0] : 255) }
46 0 0   0 1 0 sub binary { data_type => 'binary', size => (defined $_[0]? $_[0] : 255) }
47 0 0   0 1 0 sub varbinary { data_type => 'varbinary', size => (defined $_[0]? $_[0] : 255) }
48              
49 0 0   0 1 0 sub blob { data_type => 'blob', (defined $_[0]? (size => $_[0]) : ()) }
50 0     0 1 0 sub tinyblob { data_type => 'tinyblob', size => 0xFF }
51 0     0 1 0 sub mediumblob { data_type => 'mediumblob',size => 0xFFFFFF }
52 0     0 1 0 sub longblob { data_type => 'longblob', size => 0xFFFFFFFF }
53              
54 2 50   2 1 952 sub text { data_type => 'text', (defined $_[0]? (size => $_[0]) : ()) }
55 0 0   0 1 0 sub ntext { data_type => 'ntext', size => (defined $_[0]? $_[0] : 0x3FFFFFFF) }
56 0     0 1 0 sub tinytext { data_type => 'tinytext', size => 0xFF }
57 0     0 1 0 sub mediumtext { data_type => 'mediumtext',size => 0xFFFFFF }
58 0     0 1 0 sub longtext { data_type => 'longtext', size => 0xFFFFFFFF }
59              
60              
61 0     0 1 0 sub boolean { data_type => 'boolean' }
62 0     0 1 0 sub bool { data_type => 'boolean' }
63 0 0   0 1 0 sub bit { data_type => 'bit', size => (defined $_[0]? $_[0] : 1) }
64              
65              
66 1 50   1 1 483 sub date { data_type => 'date', (@_? (time_zone => $_[0]) : ()) }
67 2 50   2 1 17 sub datetime { data_type => 'datetime', (@_? (time_zone => $_[0]) : ()) }
68 0 0   0 1   sub timestamp { data_type => 'timestamp',(@_? (time_zone => $_[0]) : ()) }
69              
70              
71             1;
72              
73             __END__