From ed7dea412c4ace135b2145746524d6b12795ef17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tina=20M=C3=BCller?= Date: Sun, 23 Aug 2015 19:54:15 +0200 Subject: [PATCH] datatype mapping; IDENTITY datatype mapping must also be done for identity fields IDENTITY comes after the datatype, not before --- AUTHORS | 2 +- lib/SQL/Translator/Producer/Sybase.pm | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/AUTHORS b/AUTHORS index 26d2c5e1b..60165b4b1 100644 --- a/AUTHORS +++ b/AUTHORS @@ -56,7 +56,7 @@ The following people have contributed to the SQLFairy project: - Stephen Bennett - Stephen Clouse - SymKat -- Tina Müller +- Tina Müller - Vincent Bachelier - Wallace Reis - William Wolf diff --git a/lib/SQL/Translator/Producer/Sybase.pm b/lib/SQL/Translator/Producer/Sybase.pm index fec655a64..3777c8ca6 100644 --- a/lib/SQL/Translator/Producer/Sybase.pm +++ b/lib/SQL/Translator/Producer/Sybase.pm @@ -163,6 +163,8 @@ sub produce { my $commalist = join( ', ', map { qq['$_'] } @$list ); my $seq_name; + my $identity = ''; + if ( $data_type eq 'enum' ) { my $check_name = mk_name( $table_name.'_'.$field_name, 'chk' ,undef, 1 @@ -174,10 +176,10 @@ sub produce { elsif ( $data_type eq 'set' ) { $data_type .= 'character varying'; } - elsif ( $field->is_auto_increment ) { - $field_def .= ' IDENTITY'; - } else { + if ( $field->is_auto_increment ) { + $identity = 'IDENTITY'; + } if ( defined $translate{ $data_type } ) { $data_type = $translate{ $data_type }; } @@ -209,6 +211,7 @@ sub produce { $field_def .= " $data_type"; $field_def .= "($size)" if $size; + $field_def .= " $identity" if $identity; # # Default value