From: Tina Müller Date: Sun, 23 Aug 2015 17:54:15 +0000 (+0200) Subject: datatype mapping; IDENTITY X-Git-Tag: v1.61~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bde41930d3824f9a9ee97e7d15ea42786364f2ee;p=dbsrgits%2FSQL-Translator.git datatype mapping; IDENTITY datatype mapping must also be done for identity fields IDENTITY comes after the datatype, not before --- diff --git a/AUTHORS b/AUTHORS index e459bab..279ca48 100644 --- a/AUTHORS +++ b/AUTHORS @@ -57,7 +57,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 7d5f10b..b11cb2a 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