Showing 5 changed files with 33 additions and 1 deletions
+4
t/common-mysql.t
... ...
@@ -9,6 +9,10 @@ $ENV{DBIX_CUSTOM_SKIP_MESSAGE} = 'mysql private test';
9 9
 use DBIx::Custom;
10 10
 {
11 11
     package DBIx::Custom;
12
+
13
+    my $date = 'Date';
14
+    my $time = 'Time';
15
+    my $datetime = 'Datetime';
12 16
     
13 17
     no warnings 'redefine';
14 18
     has dsn => "dbi:mysql:database=dbix_custom";
+5
t/common-postgresql.t
... ...
@@ -10,6 +10,11 @@ use DBIx::Custom;
10 10
 {
11 11
     package DBIx::Custom;
12 12
     no warnings 'redefine';
13
+
14
+    my $date = 'Date';
15
+    my $time = 'Time';
16
+    my $datetime = 'Timestamp';
17
+
13 18
     has dsn => "dbi:Pg:dbname=dbix_custom";
14 19
     has user  => 'dbix_custom';
15 20
     has password => 'dbix_custom';
+5
t/common-sqlite-quote.t
... ...
@@ -8,6 +8,11 @@ use DBIx::Custom;
8 8
 {
9 9
     package DBIx::Custom;
10 10
     no warnings 'redefine';
11
+
12
+    my $date = 'Date';
13
+    my $time = 'Time';
14
+    my $datetime = 'Datetime';
15
+
11 16
     has dsn => 'dbi:SQLite:dbname=:memory:';
12 17
     sub quote { '""' }
13 18
     sub create_table1 { 'create table table1 (key1 varchar, key2 varchar);' }
+6 -1
t/common-sqlite.t
... ...
@@ -8,10 +8,15 @@ use DBIx::Custom;
8 8
 {
9 9
     package DBIx::Custom;
10 10
     no warnings 'redefine';
11
+    
12
+    my $date = 'Date';
13
+    my $time = 'Time';
14
+    my $datetime = 'Datetime';
15
+    
11 16
     has dsn => 'dbi:SQLite:dbname=:memory:';
12 17
     sub create_table1 { 'create table table1 (key1 varchar, key2 varchar);' }
13 18
     sub create_table1_2 {'create table table1 (key1 varchar, key2 varchar, key3 varchar, key4 varchar, key5 varchar);' }
14
-    sub create_table1_type { 'create table table1 (key1 Date, key2 datetime);' }
19
+    sub create_table1_type { "create table table1 (key1 $date, key2 $time);" }
15 20
     
16 21
     sub create_table1_highperformance { "create table table1 (ab varchar, bc varchar, ik varchar, hi varchar, ui varchar, pq varchar, dc varchar);" }
17 22
     
+13
t/common.t
... ...
@@ -3346,6 +3346,19 @@ $result = $dbi->select(
3346 3346
 );
3347 3347
 is_deeply($result->all, [{'table2.key3' => 4}]);
3348 3348
 
3349
+test 'table_alias';
3350
+$dbi = DBIx::Custom->connect;
3351
+eval { $dbi->execute('drop table table1') };
3352
+$dbi->execute($create_table1_type);
3353
+$dbi->type_rule(
3354
+    into1 => {
3355
+        date => sub { '2010-' . $_[0] }
3356
+    }
3357
+);
3358
+$dbi->execute("insert into table1 (key1) values (:table2.key1)", {'table2.key1' => '01-01'},
3359
+  table_alias => {table2 => 'table1'});
3360
+$result = $dbi->select(table => 'table1');
3361
+is($result->one->{key1}, '2010-01-01');
3349 3362
 
3350 3363
 
3351 3364