From: Rafael Kitover Date: Tue, 5 Jan 2010 14:27:40 +0000 (+0000) Subject: minor change: use more of the hash if possible for oracle table alias shortening X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=909668fe858a86f00b0a4042e04163bc2f480277;p=dbsrgits%2FDBIx-Class-Historic.git minor change: use more of the hash if possible for oracle table alias shortening --- diff --git a/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm b/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm index 5ed31a0..c578cc9 100644 --- a/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm +++ b/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm @@ -305,9 +305,12 @@ sub relname_to_table_alias { # truncate and prepend to truncated relname without vowels (my $devoweled = $relname) =~ s/[aeiou]//g; - my $res = substr($devoweled, 0, 18) . '_' . substr($md5, 0, 11); + my $shortened = substr($devoweled, 0, 18); - return $res; + my $new_alias = + $shortened . '_' . substr($md5, 0, 30 - length($shortened) - 1); + + return $new_alias; } =head1 AUTHOR