MSSQL/Storage/DateTime/Format.pm

filter: Statementstmt 100% 20 / 20 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 2 / 2 totaltotal 100% 27 / 27 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« MSSQL.pm ↑ Summary MSSQL/Storage/Sybase/DateTime/Format.pm »
1 package DBIO::MSSQL::Storage::DateTime::Format;
2 # ABSTRACT: DateTime parser for MSSQL datetime and smalldatetime columns
3  
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 our $VERSION = '0.900004';
8  
9 2 ▶use base 'DBIO::Storage::DateTimeFormat';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 # MSSQL adds a third channel beyond the base datetime/date: smalldatetime
12 # (minute precision, no fractional seconds). Core's InflateColumn::DateTime
13 # routes it to parse_smalldatetime/format_smalldatetime when the parser
14 # ->can() them, otherwise falls back to parse_datetime/format_datetime.
15 2 __PACKAGE__->mk_group_accessors('inherited' => qw/
16 smalldatetime_parse_pattern smalldatetime_format_pattern
17 /);
18  
19 2 __PACKAGE__->datetime_parse_pattern('%Y-%m-%d %H:%M:%S.%3N'); # %F %T
20 2 __PACKAGE__->datetime_format_pattern('%Y-%m-%d %H:%M:%S.%3N');
21 2 __PACKAGE__->smalldatetime_parse_pattern('%Y-%m-%d %H:%M:%S');
22 2 __PACKAGE__->smalldatetime_format_pattern('%Y-%m-%d %H:%M:%S');
23  
24  
25 1 ▶sub parse_smalldatetime {
Subroutine parse_smalldatetime: called CC=1 SCAR=0.0
Pod documented
26 1 my ($class, $value) = @_;
27  
28 1 return $class->_strptime_for(smalldatetime_parse => 'smalldatetime_parse_pattern')
29 ->parse_datetime($value);
30 }
31  
32  
33 1 ▶sub format_smalldatetime {
Subroutine format_smalldatetime: called CC=1 SCAR=0.0
Pod documented
34 1 my ($class, $dt) = @_;
35  
36 1 return $class->_strptime_for(smalldatetime_format => 'smalldatetime_format_pattern')
37 ->format_datetime($dt);
38 }
39  
40 2 1;
41  
42 __END__
« MSSQL.pm ↑ Summary MSSQL/Storage/Sybase/DateTime/Format.pm »