X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class.git;a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FOracle%2FGeneric.pm;h=5ed31a049e61137a07a3ec91519a56bac105f391;hp=3379ffcad413bd22082c0dcd4790c4faac6751dd;hb=af0edca1cb4cc086f70fb81e9c1955230346691a;hpb=4f95e7c0757bc68b71c84a52c2430502772b873f diff --git a/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm b/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm index 3379ffc..5ed31a0 100644 --- a/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm +++ b/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm @@ -282,7 +282,8 @@ L uses L names as table aliases in queries. Unfortunately, Oracle doesn't support identifiers over 30 chars in length, so -the L name is shortened here if necessary. +the L name is shortened and appended with half of an +MD5 hash. See L. @@ -296,15 +297,17 @@ sub relname_to_table_alias { return $alias if length($alias) <= 30; - $alias =~ s/[aeiou]//ig; + # get a base64 md5 of the alias with join_count + require Digest::MD5; + my $ctx = Digest::MD5->new; + $ctx->add($alias); + my $md5 = $ctx->b64digest; - return $alias if length($alias) <= 30; - - ($alias = $relname) =~ s/[aeiou]//ig; - substr($alias, 0, 30 - length($join_count) - 1) = ''; - $alias .= "_$join_count"; + # truncate and prepend to truncated relname without vowels + (my $devoweled = $relname) =~ s/[aeiou]//g; + my $res = substr($devoweled, 0, 18) . '_' . substr($md5, 0, 11); - return $alias; + return $res; } =head1 AUTHOR