line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Alzabo::Column; |
2
|
|
|
|
|
|
|
|
3
|
11
|
|
|
11
|
|
98
|
use strict; |
|
11
|
|
|
|
|
23
|
|
|
11
|
|
|
|
|
508
|
|
4
|
11
|
|
|
11
|
|
59
|
use vars qw($VERSION); |
|
11
|
|
|
|
|
24
|
|
|
11
|
|
|
|
|
568
|
|
5
|
|
|
|
|
|
|
|
6
|
11
|
|
|
11
|
|
59
|
use Alzabo; |
|
11
|
|
|
|
|
19
|
|
|
11
|
|
|
|
|
305
|
|
7
|
|
|
|
|
|
|
|
8
|
11
|
|
|
11
|
|
10223
|
use Tie::IxHash; |
|
11
|
|
|
|
|
74296
|
|
|
11
|
|
|
|
|
393
|
|
9
|
|
|
|
|
|
|
|
10
|
11
|
|
|
11
|
|
7433
|
use Params::Validate qw( :all ); |
|
11
|
|
|
|
|
126920
|
|
|
11
|
|
|
|
|
16199
|
|
11
|
|
|
|
|
|
|
Params::Validate::validation_options( on_fail => sub { Alzabo::Exception::Params->throw( error => join '', @_ ) } ); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
$VERSION = 2.0; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
1; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub table |
18
|
|
|
|
|
|
|
{ |
19
|
0
|
|
|
0
|
1
|
|
$_[0]->{table}; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub name |
23
|
|
|
|
|
|
|
{ |
24
|
0
|
|
|
0
|
1
|
|
$_[0]->{name}; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub nullable |
28
|
|
|
|
|
|
|
{ |
29
|
0
|
|
|
0
|
1
|
|
$_[0]->{nullable}; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub attributes |
33
|
|
|
|
|
|
|
{ |
34
|
0
|
|
|
0
|
1
|
|
return keys %{ $_[0]->{attributes} }; |
|
0
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub has_attribute |
38
|
|
|
|
|
|
|
{ |
39
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
40
|
0
|
|
|
|
|
|
my %p = validate( @_, { attribute => { type => SCALAR }, |
41
|
|
|
|
|
|
|
case_sensitive => { type => SCALAR, |
42
|
|
|
|
|
|
|
default => 0 } } ); |
43
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
if ( $p{case_sensitive} ) |
45
|
|
|
|
|
|
|
{ |
46
|
0
|
|
|
|
|
|
return exists $self->{attributes}{ $p{attribute} }; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
else |
49
|
|
|
|
|
|
|
{ |
50
|
0
|
0
|
|
|
|
|
return 1 if grep { lc $p{attribute} eq lc $_ } keys %{ $self->{attributes} }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub type |
55
|
|
|
|
|
|
|
{ |
56
|
0
|
|
|
0
|
1
|
|
$_[0]->definition->type; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub sequenced |
60
|
|
|
|
|
|
|
{ |
61
|
0
|
|
|
0
|
1
|
|
$_[0]->{sequenced}; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub default |
65
|
|
|
|
|
|
|
{ |
66
|
0
|
|
|
0
|
1
|
|
$_[0]->{default}; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub default_is_raw |
70
|
|
|
|
|
|
|
{ |
71
|
0
|
|
|
0
|
1
|
|
$_[0]->{default_is_raw}; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub length |
75
|
|
|
|
|
|
|
{ |
76
|
0
|
|
|
0
|
1
|
|
$_[0]->definition->length; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub precision |
80
|
|
|
|
|
|
|
{ |
81
|
0
|
|
|
0
|
1
|
|
$_[0]->definition->precision; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub definition |
85
|
|
|
|
|
|
|
{ |
86
|
0
|
|
|
0
|
1
|
|
$_[0]->{definition}; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub is_primary_key |
90
|
|
|
|
|
|
|
{ |
91
|
0
|
|
|
0
|
1
|
|
$_[0]->table->column_is_primary_key($_[0]); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub is_numeric |
95
|
|
|
|
|
|
|
{ |
96
|
0
|
|
|
0
|
1
|
|
$_[0]->table->schema->rules->type_is_numeric($_[0]); |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub is_integer |
100
|
|
|
|
|
|
|
{ |
101
|
0
|
|
|
0
|
1
|
|
$_[0]->table->schema->rules->type_is_integer($_[0]); |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub is_floating_point |
105
|
|
|
|
|
|
|
{ |
106
|
0
|
|
|
0
|
1
|
|
$_[0]->table->schema->rules->type_is_floating_point($_[0]); |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub is_character |
110
|
|
|
|
|
|
|
{ |
111
|
0
|
|
|
0
|
1
|
|
$_[0]->table->schema->rules->type_is_char($_[0]); |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub is_date |
115
|
|
|
|
|
|
|
{ |
116
|
0
|
|
|
0
|
1
|
|
$_[0]->table->schema->rules->type_is_date($_[0]); |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub is_datetime |
120
|
|
|
|
|
|
|
{ |
121
|
0
|
|
|
0
|
1
|
|
$_[0]->table->schema->rules->type_is_datetime($_[0]); |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub is_time |
125
|
|
|
|
|
|
|
{ |
126
|
0
|
|
|
0
|
1
|
|
$_[0]->table->schema->rules->type_is_time($_[0]); |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
sub is_time_interval |
130
|
|
|
|
|
|
|
{ |
131
|
0
|
|
|
0
|
1
|
|
$_[0]->table->schema->rules->type_is_time_interval($_[0]); |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub is_blob |
135
|
|
|
|
|
|
|
{ |
136
|
0
|
|
|
0
|
1
|
|
$_[0]->table->schema->rules->type_is_blob($_[0]); |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
sub generic_type |
140
|
|
|
|
|
|
|
{ |
141
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
142
|
|
|
|
|
|
|
|
143
|
0
|
|
|
|
|
|
foreach my $type ( qw( integer floating_point character date datetime time blob ) ) |
144
|
|
|
|
|
|
|
{ |
145
|
0
|
|
|
|
|
|
my $method = "is_$type"; |
146
|
0
|
0
|
|
|
|
|
return $type if $self->$method(); |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
|
149
|
0
|
|
|
|
|
|
return 'unknown'; |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
0
|
|
|
0
|
1
|
|
sub comment { $_[0]->{comment} } |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
__END__ |