... | ... |
@@ -11,21 +11,19 @@ use DBIx::Custom; |
11 | 11 |
package DBIx::Custom; |
12 | 12 |
|
13 | 13 |
my $date_typename = 'Date'; |
14 |
- my $time_typename = 'Time'; |
|
15 | 14 |
my $datetime_typename = 'Datetime'; |
16 | 15 |
|
17 | 16 |
sub date_typename { lc $date_typename } |
18 |
- sub time_typename { lc $time_typename } |
|
19 | 17 |
sub datetime_typename { lc $datetime_typename } |
20 | 18 |
|
21 | 19 |
my $date_datatype = 9; |
22 |
- my $time_datatype = 'Time'; |
|
23 | 20 |
my $datetime_datatype = 11; |
24 | 21 |
|
25 | 22 |
sub date_datatype { lc $date_datatype } |
26 |
- sub time_datatype { lc $time_datatype } |
|
27 | 23 |
sub datetime_datatype { lc $datetime_datatype } |
28 | 24 |
|
25 |
+ has datetime_suffix => ''; |
|
26 |
+ |
|
29 | 27 |
no warnings 'redefine'; |
30 | 28 |
has dsn => "dbi:mysql:database=dbix_custom"; |
31 | 29 |
has user => 'dbix_custom'; |
... | ... |
@@ -12,20 +12,18 @@ use DBIx::Custom; |
12 | 12 |
no warnings 'redefine'; |
13 | 13 |
|
14 | 14 |
my $date_typename = 'Date'; |
15 |
- my $time_typename = 'Time'; |
|
16 | 15 |
my $datetime_typename = 'Timestamp'; |
17 | 16 |
|
18 | 17 |
sub date_typename { lc $date_typename } |
19 |
- sub time_typename { lc $time_typename } |
|
20 | 18 |
sub datetime_typename { 'timestamp without time zone' } |
21 | 19 |
|
22 | 20 |
my $date_datatype = 91; |
23 |
- my $time_datatype = 'Time'; |
|
24 | 21 |
my $datetime_datatype = 11; |
25 | 22 |
|
26 | 23 |
sub date_datatype { lc $date_datatype } |
27 |
- sub time_datatype { lc $time_datatype } |
|
28 | 24 |
sub datetime_datatype { lc $datetime_datatype } |
25 |
+ |
|
26 |
+ has datetime_suffix => ''; |
|
29 | 27 |
|
30 | 28 |
has dsn => "dbi:Pg:dbname=dbix_custom"; |
31 | 29 |
has user => 'dbix_custom'; |
... | ... |
@@ -10,21 +10,19 @@ use DBIx::Custom; |
10 | 10 |
no warnings 'redefine'; |
11 | 11 |
|
12 | 12 |
my $date_typename = 'Date'; |
13 |
- my $time_typename = 'Time'; |
|
14 | 13 |
my $datetime_typename = 'Datetime'; |
15 | 14 |
|
16 | 15 |
sub date_typename { lc $date_typename } |
17 |
- sub time_typename { lc $time_typename } |
|
18 | 16 |
sub datetime_typename { lc $datetime_typename } |
19 | 17 |
|
20 | 18 |
my $date_datatype = 'Date'; |
21 |
- my $time_datatype = 'Time'; |
|
22 | 19 |
my $datetime_datatype = 'Datetime'; |
23 | 20 |
|
24 | 21 |
sub date_datatype { lc $date_datatype } |
25 |
- sub time_datatype { lc $time_datatype } |
|
26 | 22 |
sub datetime_datatype { lc $datetime_datatype } |
27 | 23 |
|
24 |
+ has datetime_suffix => ''; |
|
25 |
+ |
|
28 | 26 |
has dsn => 'dbi:SQLite:dbname=:memory:'; |
29 | 27 |
sub quote { '""' } |
30 | 28 |
sub create_table1 { 'create table table1 (key1 varchar, key2 varchar);' } |
... | ... |
@@ -10,20 +10,18 @@ use DBIx::Custom; |
10 | 10 |
no warnings 'redefine'; |
11 | 11 |
|
12 | 12 |
my $date_typename = 'Date'; |
13 |
- my $time_typename = 'Time'; |
|
14 | 13 |
my $datetime_typename = 'Datetime'; |
15 | 14 |
|
16 | 15 |
sub date_typename { lc $date_typename } |
17 |
- sub time_typename { lc $time_typename } |
|
18 | 16 |
sub datetime_typename { lc $datetime_typename } |
19 | 17 |
|
20 | 18 |
my $date_datatype = 'Date'; |
21 |
- my $time_datatype = 'Time'; |
|
22 | 19 |
my $datetime_datatype = 'Datetime'; |
23 | 20 |
|
24 | 21 |
sub date_datatype { lc $date_datatype } |
25 |
- sub time_datatype { lc $time_datatype } |
|
26 | 22 |
sub datetime_datatype { lc $datetime_datatype } |
23 |
+ |
|
24 |
+ has datetime_suffix => ''; |
|
27 | 25 |
|
28 | 26 |
has dsn => 'dbi:SQLite:dbname=:memory:'; |
29 | 27 |
sub create_table1 { 'create table table1 (key1 varchar, key2 varchar);' } |
... | ... |
@@ -22,9 +22,12 @@ use DBIx::Custom; |
22 | 22 |
|
23 | 23 |
sub date_datatype { lc $date_datatype } |
24 | 24 |
sub datetime_datatype { lc $datetime_datatype } |
25 |
+ |
|
26 |
+ has datetime_suffix => '.000'; |
|
25 | 27 |
|
26 | 28 |
my $dsn = "dbi:ODBC:driver={SQL Server};Server={localhost\\SQLEXPRESS};" |
27 | 29 |
. "Trusted_Connection=No;AutoTranslate=No;Database=dbix_custom;"; |
30 |
+ |
|
28 | 31 |
has dsn => $dsn; |
29 | 32 |
has user => 'dbix_custom'; |
30 | 33 |
has password => 'dbix_custom'; |
... | ... |
@@ -158,6 +158,7 @@ my $date_typename = $dbi->date_typename; |
158 | 158 |
my $datetime_typename = $dbi->datetime_typename; |
159 | 159 |
my $date_datatype = $dbi->date_datatype; |
160 | 160 |
my $datetime_datatype = $dbi->datetime_datatype; |
161 |
+my $datetime_suffix = $dbi->datetime_suffix; |
|
161 | 162 |
|
162 | 163 |
# Variable |
163 | 164 |
# Variables |
... | ... |
@@ -226,7 +227,7 @@ $dbi->insert({key1 => '2010-01-02', key2 => '2010-01-01 01:01:02'}, table => 'ta |
226 | 227 |
$result = $dbi->select(table => 'table1'); |
227 | 228 |
$row = $result->one; |
228 | 229 |
is($row->{key1}, '2010-01-03'); |
229 |
-is($row->{key2}, '2010-01-01 01:01:03'); |
|
230 |
+is($row->{key2}, '2010-01-01 01:01:03' . $datetime_suffix); |
|
230 | 231 |
|
231 | 232 |
$dbi = DBIx::Custom->connect; |
232 | 233 |
eval { $dbi->execute('drop table table1') }; |
... | ... |
@@ -247,7 +248,7 @@ $result = $dbi->execute( |
247 | 248 |
); |
248 | 249 |
$row = $result->one; |
249 | 250 |
is($row->{key1}, '2010-01-03'); |
250 |
-is($row->{key2}, '2010-01-01 01:01:03'); |
|
251 |
+is($row->{key2}, '2010-01-01 01:01:03' . $datetime_suffix); |
|
251 | 252 |
|
252 | 253 |
$dbi = DBIx::Custom->connect; |
253 | 254 |
eval { $dbi->execute('drop table table1') }; |
... | ... |
@@ -269,7 +270,7 @@ $result = $dbi->execute( |
269 | 270 |
); |
270 | 271 |
$row = $result->one; |
271 | 272 |
is($row->{key1}, '2010-01-03'); |
272 |
-is($row->{key2}, '2010-01-01 01:01:03'); |
|
273 |
+is($row->{key2}, '2010-01-01 01:01:03' . $datetime_suffix); |
|
273 | 274 |
|
274 | 275 |
$dbi = DBIx::Custom->connect; |
275 | 276 |
eval { $dbi->execute('drop table table1') }; |
... | ... |
@@ -485,7 +486,7 @@ $result->type_rule( |
485 | 486 |
); |
486 | 487 |
$row = $result->one; |
487 | 488 |
is($row->{key1}, '2010-01-05'); |
488 |
-is($row->{key2}, '2010-01-01 01:01:03'); |
|
489 |
+is($row->{key2}, '2010-01-01 01:01:03' . $datetime_suffix); |
|
489 | 490 |
|
490 | 491 |
$result = $dbi->select(table => 'table1'); |
491 | 492 |
$result->type_rule( |
... | ... |
@@ -495,7 +496,7 @@ $result->type_rule( |
495 | 496 |
); |
496 | 497 |
$row = $result->one; |
497 | 498 |
is($row->{key1}, '2010-01-05'); |
498 |
-is($row->{key2}, '2010-01-01 01:01:03'); |
|
499 |
+is($row->{key2}, '2010-01-01 01:01:03' . $datetime_suffix); |
|
499 | 500 |
|
500 | 501 |
$result = $dbi->select(table => 'table1'); |
501 | 502 |
$result->type_rule( |
... | ... |
@@ -505,7 +506,7 @@ $result->type_rule( |
505 | 506 |
); |
506 | 507 |
$row = $result->one; |
507 | 508 |
is($row->{key1}, '2010-01-05'); |
508 |
-is($row->{key2}, '2010-01-01 01:01:03'); |
|
509 |
+is($row->{key2}, '2010-01-01 01:01:03' . $datetime_suffix); |
|
509 | 510 |
|
510 | 511 |
$result = $dbi->select(table => 'table1'); |
511 | 512 |
$result->type_rule( |
... | ... |
@@ -513,7 +514,7 @@ $result->type_rule( |
513 | 514 |
); |
514 | 515 |
$row = $result->one; |
515 | 516 |
is($row->{key1}, '2010-01-05'); |
516 |
-is($row->{key2}, '2010-01-01 01:01:03'); |
|
517 |
+is($row->{key2}, '2010-01-01 01:01:03' . $datetime_suffix); |
|
517 | 518 |
|
518 | 519 |
$dbi->register_filter(five => sub { my $v = shift; $v =~ s/3/5/; return $v }); |
519 | 520 |
$result = $dbi->select(table => 'table1'); |
... | ... |
@@ -522,7 +523,7 @@ $result->type_rule( |
522 | 523 |
); |
523 | 524 |
$row = $result->one; |
524 | 525 |
is($row->{key1}, '2010-01-05'); |
525 |
-is($row->{key2}, '2010-01-01 01:01:03'); |
|
526 |
+is($row->{key2}, '2010-01-01 01:01:03' . $datetime_suffix); |
|
526 | 527 |
|
527 | 528 |
$result = $dbi->select(table => 'table1'); |
528 | 529 |
$result->type_rule( |
... | ... |
@@ -530,7 +531,7 @@ $result->type_rule( |
530 | 531 |
); |
531 | 532 |
$row = $result->one; |
532 | 533 |
is($row->{key1}, '2010-01-03'); |
533 |
-is($row->{key2}, '2010-01-01 01:01:03'); |
|
534 |
+is($row->{key2}, '2010-01-01 01:01:03' . $datetime_suffix); |
|
534 | 535 |
|
535 | 536 |
$dbi = DBIx::Custom->connect; |
536 | 537 |
eval { $dbi->execute('drop table table1') }; |
... | ... |
@@ -804,7 +805,7 @@ $result = $dbi->execute( |
804 | 805 |
); |
805 | 806 |
|
806 | 807 |
$rows = $result->all; |
807 |
-is_deeply($rows, [{key1 => '2011-10-14 12:19:18', key2 => 2}]); |
|
808 |
+is_deeply($rows, [{key1 => '2011-10-14 12:19:18' . $datetime_suffix, key2 => 2}]); |
|
808 | 809 |
|
809 | 810 |
$dbi->delete_all(table => 'table1'); |
810 | 811 |
$dbi->insert(table => 'table1', param => {key1 => 'a:b c:d', key2 => 2}); |