From: Ken Youens-Clark Date: Mon, 18 Aug 2003 15:41:53 +0000 (+0000) Subject: Use of "map," emit warning when changing PK from CLOB to VARCHAR2. X-Git-Tag: v0.04~310 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e6f063bd72cee66053898db0a18261180ab6ecc7;p=dbsrgits%2FSQL-Translator.git Use of "map," emit warning when changing PK from CLOB to VARCHAR2. --- diff --git a/lib/SQL/Translator/Producer/Oracle.pm b/lib/SQL/Translator/Producer/Oracle.pm index d8cd032..f44cb6b 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.19 2003-08-17 07:51:33 rossta Exp $ +# $Id: Oracle.pm,v 1.20 2003-08-18 15:41:53 kycl4rk Exp $ # ------------------------------------------------------------------- # Copyright (C) 2003 Ken Y. Clark , # darren chamberlain , @@ -24,7 +24,7 @@ package SQL::Translator::Producer::Oracle; use strict; use vars qw[ $VERSION $DEBUG $WARN ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.19 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.20 $ =~ /(\d+)\.(\d+)/; $DEBUG = 0 unless defined $DEBUG; use SQL::Translator::Schema::Constants; @@ -175,7 +175,7 @@ sub produce { my %extra = $field->extra; my $list = $extra{'list'} || []; # \todo deal with embedded quotes - my $commalist = "'" . (join "', '", @$list) . "'"; + my $commalist = join( ', ', map { qq['$_'] } @$list ); if ( $data_type eq 'enum' ) { $check = "CHECK ($field_name_ur IN ($commalist))"; @@ -192,10 +192,15 @@ sub produce { die "Unknown datatype: $data_type\n"; } - # Fixes ORA-02329: column of datatype LOB cannot be unique or a primary key + # + # Fixes ORA-02329: column of datatype LOB cannot be + # unique or a primary key + # if ( $data_type eq 'clob' && $field->is_primary_key ) { $data_type = 'varchar2'; $size[0] = 4000; + warn "CLOB cannot be a primary key, changing to VARCHAR2\n" + if $WARN; } # Fixes ORA-00907: missing right parenthesis