line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Eve::PgSqlType::Timestamp; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
159528
|
use parent qw(Eve::PgSqlType); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use strict; |
6
|
|
|
|
|
|
|
use warnings; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use DateTime::Format::Pg; |
9
|
|
|
|
|
|
|
use DBD::Pg (); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
B - a PostgreSQL timestamp without timezone type. |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my $bigint = Eve::PgSqlType::Timestamp->new(); |
18
|
|
|
|
|
|
|
$bigint->serialize(value => $datetime); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 DESCRIPTION |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
B is a PostgreSQL timestamp |
23
|
|
|
|
|
|
|
without time zone type adapter class. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 METHODS |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head2 B |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head3 Returns |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
The PG_TIMESTAMP type. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub get_type { |
36
|
|
|
|
|
|
|
return DBD::Pg::PG_TIMESTAMP; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 B |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Wraps an expression with CAST statement. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head3 Arguments |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=over 4 |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=item C |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=back |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head3 Returns |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
CAST (C AS timestamp without time zone) |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub wrap { |
58
|
|
|
|
|
|
|
my ($self, %arg_hash) = @_; |
59
|
|
|
|
|
|
|
Eve::Support::arguments(\%arg_hash, my $expression); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
return 'CAST ('.$expression.' AS timestamp without time zone)'; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 B |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Formats a B object into the appropriate string timestamp |
67
|
|
|
|
|
|
|
without timezone representation with the B module. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head3 Arguments |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=over 4 |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=item C |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=back |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head3 Returns |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
The string like '2011-03-21 20:41:34.123456'. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub serialize { |
84
|
|
|
|
|
|
|
my ($self, %arg_hash) = @_; |
85
|
|
|
|
|
|
|
Eve::Support::arguments(\%arg_hash, my $value); |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
return DateTime::Format::Pg->format_timestamp_without_time_zone($value); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 B |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Parses a timestamp without time zone string representation into the |
93
|
|
|
|
|
|
|
appropriate B object with the B |
94
|
|
|
|
|
|
|
module. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head3 Arguments |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=over 4 |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item C |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=back |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head3 Returns |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
A B object. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=cut |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub deserialize { |
111
|
|
|
|
|
|
|
my ($self, %arg_hash) = @_; |
112
|
|
|
|
|
|
|
Eve::Support::arguments(\%arg_hash, my $value); |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
my $result; |
115
|
|
|
|
|
|
|
if (defined $value) { |
116
|
|
|
|
|
|
|
$result = DateTime::Format::Pg->parse_timestamp_without_time_zone( |
117
|
|
|
|
|
|
|
$value); |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
return $result; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 SEE ALSO |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=over 4 |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=item L |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=item L |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=item L |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=item L |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=back |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Copyright 2012 Igor Zinovyev. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
142
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
143
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head1 AUTHOR |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=over 4 |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=item L |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=item L |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=back |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=cut |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
1; |