From: Ken Youens-Clark Date: Thu, 5 Aug 2004 18:15:12 +0000 (+0000) Subject: Make sure there's some size value for a character-based field. X-Git-Tag: v0.06~18 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4167a803e2b4ba6f72d661b7204e2a2926decceb;p=dbsrgits%2FSQL-Translator.git Make sure there's some size value for a character-based field. --- diff --git a/lib/SQL/Translator/Producer/MySQL.pm b/lib/SQL/Translator/Producer/MySQL.pm index 8b2c45d..a5f9cf6 100644 --- a/lib/SQL/Translator/Producer/MySQL.pm +++ b/lib/SQL/Translator/Producer/MySQL.pm @@ -1,7 +1,7 @@ package SQL::Translator::Producer::MySQL; # ------------------------------------------------------------------- -# $Id: MySQL.pm,v 1.34 2004-08-05 15:41:46 kycl4rk Exp $ +# $Id: MySQL.pm,v 1.35 2004-08-05 18:15:12 kycl4rk Exp $ # ------------------------------------------------------------------- # Copyright (C) 2002-4 SQLFairy Authors # @@ -44,7 +44,7 @@ for fields, etc.). use strict; use vars qw[ $VERSION $DEBUG ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.34 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.35 $ =~ /(\d+)\.(\d+)/; $DEBUG = 0 unless defined $DEBUG; use Data::Dumper; @@ -142,10 +142,13 @@ sub produce { # # Convert a large Oracle varchar to "text" # - elsif ( lc $data_type eq 'varchar2' && $size[0] > 255 ) { + elsif ( $data_type =~ /varchar/i && $size[0] > 255 ) { $data_type = 'text'; @size = (); } + elsif ( $data_type =~ /char/i && ! $size[0] ) { + @size = (255); + } elsif ( exists $translate{ lc $data_type } ) { $data_type = $translate{ lc $data_type }; }