Skip to content

Commit e52f658

Browse files
authored
Merge pull request dalibo#36 from JCallico/master
Added special handling for columns of type [date] when generating ket…
2 parents a249b24 + ba979a4 commit e52f658

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

sqlserver2pgsql.pl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ sub convert_numeric_to_int
140140
}
141141

142142
# This is a list of the types that require a cast to be imported in kettle
143-
my %types_to_cast = ('uuid' => '1',);
143+
my %types_to_cast = ('uuid' => '1','date' => '1');
144144

145145
# This sub adds a cast (if not defined already) if
146146
# - we generate for kettle
@@ -150,7 +150,7 @@ sub add_cast
150150
my ($type)=@_;
151151
if (defined $types_to_cast{$type})
152152
{
153-
$objects->{CASTS}->{uuid}=1;
153+
$objects->{CASTS}->{$type}=1;
154154
}
155155
}
156156

@@ -327,10 +327,10 @@ sub convert_type
327327
sub sql_convert_column
328328
{
329329
my ($colname,$coltype)=@_;
330-
my %functions = ( 'uuid' => 'lower');
330+
my %functions = ( 'uuid' => 'lower({colname})', 'date' => 'convert(varchar, {colname}, 120)' );
331331
if (defined ($functions{$coltype}))
332332
{
333-
return $functions{$coltype} . '([' . $colname . '])';
333+
return $functions{$coltype} =~ s/\{colname\}/[$colname]/r;
334334
}
335335
else
336336
{

0 commit comments

Comments
 (0)