line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
64678
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
72
|
|
2
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
128
|
|
3
|
|
|
|
|
|
|
package Time::Piece::MSSQL; |
4
|
|
|
|
|
|
|
{ |
5
|
|
|
|
|
|
|
$Time::Piece::MSSQL::VERSION = '0.022'; |
6
|
|
|
|
|
|
|
} |
7
|
2
|
|
|
2
|
|
2073
|
use Time::Piece 1.17; |
|
2
|
|
|
|
|
32327
|
|
|
2
|
|
|
|
|
15
|
|
8
|
|
|
|
|
|
|
# ABSTRACT: MSSQL-specific methods for Time::Piece |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# stolen from timepiece-mysql |
11
|
|
|
|
|
|
|
sub import { |
12
|
2
|
|
|
2
|
|
21
|
splice @_, 0, 1, 'Time::Piece'; |
13
|
2
|
|
|
|
|
11
|
goto &Time::Piece::import |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub mssql_datetime { |
18
|
1
|
|
|
1
|
1
|
852
|
my $self = shift; |
19
|
1
|
|
|
|
|
7
|
$self->strftime('%Y-%m-%d %H:%M:%S.000'); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub mssql_smalldatetime { |
23
|
1
|
|
|
1
|
1
|
1161
|
my $self = shift; |
24
|
1
|
|
|
|
|
5
|
$self->strftime('%Y-%m-%d %H:%M:%S'); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub from_mssql_datetime { |
29
|
6
|
|
|
6
|
1
|
6971
|
my ($class, $timestring) = @_; |
30
|
6
|
100
|
100
|
|
|
48
|
return unless $timestring and ($timestring =~ s/\.\d{3}$//); |
31
|
4
|
|
|
|
|
5
|
my $time = eval { $class->strptime($timestring, '%Y-%m-%d %H:%M:%S') }; |
|
4
|
|
|
|
|
15
|
|
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub from_mssql_smalldatetime { |
35
|
6
|
|
|
6
|
1
|
8542
|
my ($class, $timestring) = @_; |
36
|
6
|
100
|
|
|
|
18
|
return unless $timestring; |
37
|
5
|
|
|
|
|
5
|
my $time = eval { $class->strptime($timestring, '%Y-%m-%d %H:%M:%S') }; |
|
5
|
|
|
|
|
13
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
BEGIN { |
41
|
2
|
|
|
2
|
|
12
|
for (qw( |
42
|
|
|
|
|
|
|
mssql_datetime mssql_smalldatetime |
43
|
|
|
|
|
|
|
from_mssql_datetime from_mssql_smalldatetime |
44
|
|
|
|
|
|
|
)) { |
45
|
2
|
|
|
2
|
|
665
|
no strict 'refs'; ## no critic ProhibitNoStrict |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
130
|
|
46
|
8
|
|
|
|
|
50
|
*{"Time::Piece::$_"} = __PACKAGE__->can($_); |
|
8
|
|
|
|
|
99
|
|
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__END__ |