From: Fabien Wernli Date: Thu, 25 Feb 2010 09:13:29 +0000 (+0000) Subject: I'm not to be trusted with the chainsaw X-Git-Tag: v0.11008~53^2~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e19efc159c79885f5ad330a52bfb2e241e25e823;p=dbsrgits%2FSQL-Translator.git I'm not to be trusted with the chainsaw --- e19efc159c79885f5ad330a52bfb2e241e25e823 diff --cc lib/SQL/Translator/Producer/Oracle.pm index 67e672c,0844dc6..a52ee1b --- a/lib/SQL/Translator/Producer/Oracle.pm +++ b/lib/SQL/Translator/Producer/Oracle.pm @@@ -624,6 -625,6 +625,16 @@@ sub create_field undef @size; } ++ # ++ # Fixes ORA-00906: missing right parenthesis ++ # if size is 0 or undefined ++ # ++ for (qw/varchar2/) { ++ if ( $data_type =~ /^($_)$/i ) { ++ $size[0] ||= $max_size{$_}; ++ } ++ } ++ $field_def .= " $data_type"; if ( defined $size[0] && $size[0] > 0 ) { $field_def .= '(' . join( ',', @size ) . ')'; diff --cc t/51-xml-to-oracle.t index 8b5e02c,d7cff87..06776a9 --- a/t/51-xml-to-oracle.t +++ b/t/51-xml-to-oracle.t @@@ -46,11 -46,11 +46,11 @@@ my $want = 'CREATE TABLE Basic ( id number(10) NOT NULL, title varchar2(100) DEFAULT \'hello\' NOT NULL, - description varchar2(4000) DEFAULT \'\', + description clob DEFAULT \'\', email varchar2(500), -- explicitnulldef varchar2, -- explicitemptystring varchar2 DEFAULT \'\', -- emptytagdef varchar2 DEFAULT \'\', ++ explicitnulldef varchar2(4000), ++ explicitemptystring varchar2(4000) DEFAULT \'\', ++ emptytagdef varchar2(4000) DEFAULT \'\', another_id number(10) DEFAULT \'2\', timest date, PRIMARY KEY (id), @@@ -110,11 -110,11 +110,11 @@@ CREATE SEQUENCE sq_Basic_id01 CREATE TABLE Basic ( id number(10) NOT NULL, title varchar2(100) DEFAULT 'hello' NOT NULL, - description varchar2(4000) DEFAULT '', + description clob DEFAULT '', email varchar2(500), -- explicitnulldef varchar2, -- explicitemptystring varchar2 DEFAULT '', -- emptytagdef varchar2 DEFAULT '', ++ explicitnulldef varchar2(4000), ++ explicitemptystring varchar2(4000) DEFAULT '', ++ emptytagdef varchar2(4000) DEFAULT '', another_id number(10) DEFAULT '2', timest date, PRIMARY KEY (id), diff --cc t/51-xml-to-oracle_quoted.t index 2e82dd1,c5dddd7..292882d --- a/t/51-xml-to-oracle_quoted.t +++ b/t/51-xml-to-oracle_quoted.t @@@ -46,11 -46,11 +46,11 @@@ my $want = 'CREATE TABLE "Basic" ( "id" number(10) NOT NULL, "title" varchar2(100) DEFAULT \'hello\' NOT NULL, - "description" varchar2(4000) DEFAULT \'\', + "description" clob DEFAULT \'\', "email" varchar2(500), -- "explicitnulldef" varchar2, -- "explicitemptystring" varchar2 DEFAULT \'\', -- "emptytagdef" varchar2 DEFAULT \'\', ++ "explicitnulldef" varchar2(4000), ++ "explicitemptystring" varchar2(4000) DEFAULT \'\', ++ "emptytagdef" varchar2(4000) DEFAULT \'\', "another_id" number(10) DEFAULT \'2\', "timest" date, PRIMARY KEY ("id"), @@@ -110,11 -110,11 +110,11 @@@ CREATE SEQUENCE "sq_Basic_id01" CREATE TABLE "Basic" ( "id" number(10) NOT NULL, "title" varchar2(100) DEFAULT 'hello' NOT NULL, - "description" varchar2(4000) DEFAULT '', + "description" clob DEFAULT '', "email" varchar2(500), -- "explicitnulldef" varchar2, -- "explicitemptystring" varchar2 DEFAULT '', -- "emptytagdef" varchar2 DEFAULT '', ++ "explicitnulldef" varchar2(4000), ++ "explicitemptystring" varchar2(4000) DEFAULT '', ++ "emptytagdef" varchar2(4000) DEFAULT '', "another_id" number(10) DEFAULT '2', "timest" date, PRIMARY KEY ("id"), diff --cc t/data/oracle/schema_diff_a.yaml index 9b66596,9b66596..fefb46d --- a/t/data/oracle/schema_diff_a.yaml +++ b/t/data/oracle/schema_diff_a.yaml @@@ -30,7 -30,7 +30,7 @@@ schema size: - 0 name: -- data_type: varchar2(10) ++ data_type: varchar2 default_value: ~ extra: {} is_nullable: 0 @@@ -39,9 -39,9 +39,9 @@@ name: name order: 59 size: -- - 0 ++ - 10 other: -- data_type: varchar2(10) ++ data_type: varchar2 default_value: ~ extra: {} is_nullable: 1 @@@ -50,6 -50,6 +50,6 @@@ name: other order: 59 size: -- - 0 ++ - 10 name: d_operator order: 11 diff --cc t/data/oracle/schema_diff_b.yaml index 9f050c5,9f050c5..1b9c898 --- a/t/data/oracle/schema_diff_b.yaml +++ b/t/data/oracle/schema_diff_b.yaml @@@ -30,7 -30,7 +30,7 @@@ schema size: - 0 name: -- data_type: nvarchar2(10) ++ data_type: nvarchar2 default_value: ~ extra: {} is_nullable: 0 @@@ -39,9 -39,9 +39,9 @@@ name: name order: 59 size: -- - 0 ++ - 10 other: -- data_type: nvarchar2(10) ++ data_type: nvarchar2 default_value: ~ extra: {} is_nullable: 0 @@@ -50,6 -50,6 +50,6 @@@ name: other order: 59 size: -- - 0 ++ - 10 name: d_operator order: 11 diff --cc t/data/oracle/schema_diff_c.yaml index 78f2e5f,78f2e5f..f565ce3 --- a/t/data/oracle/schema_diff_c.yaml +++ b/t/data/oracle/schema_diff_c.yaml @@@ -30,7 -30,7 +30,7 @@@ schema size: - 0 name: -- data_type: nvarchar2(10) ++ data_type: nvarchar2 default_value: ~ extra: {} is_nullable: 0 @@@ -39,9 -39,9 +39,9 @@@ name: name order: 59 size: -- - 0 ++ - 10 foo: -- data_type: nvarchar2(10) ++ data_type: nvarchar2 default_value: ~ extra: {} is_nullable: 0 @@@ -50,9 -50,9 +50,9 @@@ name: foo order: 59 size: -- - 0 ++ - 10 other: -- data_type: nvarchar2(10) ++ data_type: nvarchar2 default_value: ~ extra: {} is_nullable: 0 @@@ -61,6 -61,6 +61,6 @@@ name: other order: 59 size: -- - 0 ++ - 10 name: d_operator order: 11