From: Ken Youens-Clark Date: Wed, 11 Dec 2002 01:44:54 +0000 (+0000) Subject: Fixed problem with truncating an identifier when it was exactly the X-Git-Tag: v0.01~31 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f50875529306043d074770cf077ff964abc2a56b;p=dbsrgits%2FSQL-Translator.git Fixed problem with truncating an identifier when it was exactly the $max_id_length and no "type" was supplied to "mk_name." --- diff --git a/lib/SQL/Translator/Producer/Oracle.pm b/lib/SQL/Translator/Producer/Oracle.pm index aea2153..84dfc31 100644 --- a/lib/SQL/Translator/Producer/Oracle.pm +++ b/lib/SQL/Translator/Producer/Oracle.pm @@ -1,7 +1,7 @@ package SQL::Translator::Producer::Oracle; # ------------------------------------------------------------------- -# $Id: Oracle.pm,v 1.7 2002-12-04 01:53:51 kycl4rk Exp $ +# $Id: Oracle.pm,v 1.8 2002-12-11 01:44:54 kycl4rk Exp $ # ------------------------------------------------------------------- # Copyright (C) 2002 Ken Y. Clark , # darren chamberlain @@ -23,7 +23,7 @@ package SQL::Translator::Producer::Oracle; use strict; use vars qw[ $VERSION $DEBUG $WARN ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.7 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.8 $ =~ /(\d+)\.(\d+)/; $DEBUG = 0 unless defined $DEBUG; my %translate = ( @@ -344,7 +344,9 @@ sub produce { sub mk_name { my ($basename, $type, $scope, $critical) = @_; my $basename_orig = $basename; - my $max_name = $max_id_length - (length($type) + 1); + my $max_name = $type + ? $max_id_length - (length($type) + 1) + : $max_id_length; $basename = substr( $basename, 0, $max_name ) if length( $basename ) > $max_name; my $name = $type ? "${type}_$basename" : $basename;