From 2ae96995f99f68929631b49984e2e109be2ad01c Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Sat, 4 Feb 2012 17:55:48 +0000 Subject: [PATCH] [#1114] Syntax error when unnesting TABLE of OBJECT in Oracle. The unnested table contains several columns but jOOQ only unnests "COLUMN_VALUE" - Updated test schema --- jOOQ-test/src/org/jooq/test/oracle/create.sql | 40 +++++++ .../oracle/generatedclasses/Routines.java | 106 ++++++++++++++++++ .../generatedclasses/routines/FArrays4.java | 49 ++++++++ .../generatedclasses/routines/FTables4.java | 49 ++++++++ .../generatedclasses/routines/PArrays4.java | 44 ++++++++ .../generatedclasses/routines/PTables4.java | 44 ++++++++ 6 files changed, 332 insertions(+) create mode 100644 jOOQ-test/src/org/jooq/test/oracle/generatedclasses/routines/FArrays4.java create mode 100644 jOOQ-test/src/org/jooq/test/oracle/generatedclasses/routines/FTables4.java create mode 100644 jOOQ-test/src/org/jooq/test/oracle/generatedclasses/routines/PArrays4.java create mode 100644 jOOQ-test/src/org/jooq/test/oracle/generatedclasses/routines/PTables4.java diff --git a/jOOQ-test/src/org/jooq/test/oracle/create.sql b/jOOQ-test/src/org/jooq/test/oracle/create.sql index 8d79e2f320..574c52d24d 100644 --- a/jOOQ-test/src/org/jooq/test/oracle/create.sql +++ b/jOOQ-test/src/org/jooq/test/oracle/create.sql @@ -40,10 +40,20 @@ DROP TABLE t_booleans/ DROP PROCEDURE p_arrays1/ DROP PROCEDURE p_arrays2/ DROP PROCEDURE p_arrays3/ +DROP PROCEDURE p_arrays4/ +DROP PROCEDURE p_tables1/ +DROP PROCEDURE p_tables2/ +DROP PROCEDURE p_tables3/ +DROP PROCEDURE p_tables4/ DROP PROCEDURE p_many_parameters/ DROP FUNCTION f_arrays1/ DROP FUNCTION f_arrays2/ DROP FUNCTION f_arrays3/ +DROP FUNCTION f_arrays4/ +DROP FUNCTION f_tables1/ +DROP FUNCTION f_tables2/ +DROP FUNCTION f_tables3/ +DROP FUNCTION f_tables4/ DROP PROCEDURE p_enhance_address1/ DROP PROCEDURE p_enhance_address2/ DROP PROCEDURE p_enhance_address3/ @@ -622,6 +632,13 @@ BEGIN END p_arrays3; / +CREATE OR REPLACE PROCEDURE p_arrays4 (in_array u_book_array, out_array OUT u_book_array) +IS +BEGIN + out_array := in_array; +END p_arrays4; +/ + CREATE OR REPLACE PROCEDURE p_tables1 (in_table u_number_table, out_table OUT u_number_table) IS BEGIN @@ -643,6 +660,13 @@ BEGIN END p_tables3; / +CREATE OR REPLACE PROCEDURE p_tables4 (in_table u_book_table, out_table OUT u_book_table) +IS +BEGIN + out_table := in_table; +END p_tables4; +/ + CREATE OR REPLACE PROCEDURE p_many_parameters ( f000 number, f001 number, f002 number, f003 number, f004 number, @@ -851,6 +875,14 @@ BEGIN END f_arrays3; / +CREATE OR REPLACE FUNCTION f_arrays4 (in_array u_book_array) +RETURN u_book_array +IS +BEGIN + return in_array; +END f_arrays4; +/ + CREATE OR REPLACE FUNCTION f_tables1 (in_table u_number_table) RETURN u_number_table IS @@ -875,6 +907,14 @@ BEGIN END f_tables3; / +CREATE OR REPLACE FUNCTION f_tables4 (in_table u_book_table) +RETURN u_book_table +IS +BEGIN + return in_table; +END f_tables4; +/ + CREATE OR REPLACE PROCEDURE p_author_exists (author_name VARCHAR2, result OUT NUMBER) IS v_result NUMBER(1); diff --git a/jOOQ-test/src/org/jooq/test/oracle/generatedclasses/Routines.java b/jOOQ-test/src/org/jooq/test/oracle/generatedclasses/Routines.java index c7570cfbd2..14fbb5f573 100644 --- a/jOOQ-test/src/org/jooq/test/oracle/generatedclasses/Routines.java +++ b/jOOQ-test/src/org/jooq/test/oracle/generatedclasses/Routines.java @@ -124,6 +124,44 @@ public final class Routines { return f.asField(); } + /** + * Invoke F_ARRAYS4 + * + * @param inArray + * @throws org.jooq.exception.DataAccessException if something went wrong executing the query + */ + public static org.jooq.test.oracle.generatedclasses.udt.records.UBookArrayRecord fArrays4(org.jooq.Configuration configuration, org.jooq.test.oracle.generatedclasses.udt.records.UBookArrayRecord inArray) { + org.jooq.test.oracle.generatedclasses.routines.FArrays4 f = new org.jooq.test.oracle.generatedclasses.routines.FArrays4(); + f.setInArray(inArray); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get F_ARRAYS4 as a field + * + * @param inArray + */ + public static org.jooq.Field fArrays4(org.jooq.test.oracle.generatedclasses.udt.records.UBookArrayRecord inArray) { + org.jooq.test.oracle.generatedclasses.routines.FArrays4 f = new org.jooq.test.oracle.generatedclasses.routines.FArrays4(); + f.setInArray(inArray); + + return f.asField(); + } + + /** + * Get F_ARRAYS4 as a field + * + * @param inArray + */ + public static org.jooq.Field fArrays4(org.jooq.Field inArray) { + org.jooq.test.oracle.generatedclasses.routines.FArrays4 f = new org.jooq.test.oracle.generatedclasses.routines.FArrays4(); + f.setInArray(inArray); + + return f.asField(); + } + /** * Invoke F_AUTHOR_EXISTS * @@ -374,6 +412,44 @@ public final class Routines { return f.asField(); } + /** + * Invoke F_TABLES4 + * + * @param inTable + * @throws org.jooq.exception.DataAccessException if something went wrong executing the query + */ + public static org.jooq.test.oracle.generatedclasses.udt.records.UBookTableRecord fTables4(org.jooq.Configuration configuration, org.jooq.test.oracle.generatedclasses.udt.records.UBookTableRecord inTable) { + org.jooq.test.oracle.generatedclasses.routines.FTables4 f = new org.jooq.test.oracle.generatedclasses.routines.FTables4(); + f.setInTable(inTable); + + f.execute(configuration); + return f.getReturnValue(); + } + + /** + * Get F_TABLES4 as a field + * + * @param inTable + */ + public static org.jooq.Field fTables4(org.jooq.test.oracle.generatedclasses.udt.records.UBookTableRecord inTable) { + org.jooq.test.oracle.generatedclasses.routines.FTables4 f = new org.jooq.test.oracle.generatedclasses.routines.FTables4(); + f.setInTable(inTable); + + return f.asField(); + } + + /** + * Get F_TABLES4 as a field + * + * @param inTable + */ + public static org.jooq.Field fTables4(org.jooq.Field inTable) { + org.jooq.test.oracle.generatedclasses.routines.FTables4 f = new org.jooq.test.oracle.generatedclasses.routines.FTables4(); + f.setInTable(inTable); + + return f.asField(); + } + /** * Invoke F317 * @@ -564,6 +640,21 @@ public final class Routines { return p.getOutArray(); } + /** + * Invoke P_ARRAYS4 + * + * @param inArray IN parameter + * @param outArray OUT parameter + * @throws org.jooq.exception.DataAccessException if something went wrong executing the query + */ + public static org.jooq.test.oracle.generatedclasses.udt.records.UBookArrayRecord pArrays4(org.jooq.Configuration configuration, org.jooq.test.oracle.generatedclasses.udt.records.UBookArrayRecord inArray) { + org.jooq.test.oracle.generatedclasses.routines.PArrays4 p = new org.jooq.test.oracle.generatedclasses.routines.PArrays4(); + p.setInArray(inArray); + + p.execute(configuration); + return p.getOutArray(); + } + /** * Invoke P_AUTHOR_EXISTS * @@ -722,6 +813,21 @@ public final class Routines { return p.getOutTable(); } + /** + * Invoke P_TABLES4 + * + * @param inTable IN parameter + * @param outTable OUT parameter + * @throws org.jooq.exception.DataAccessException if something went wrong executing the query + */ + public static org.jooq.test.oracle.generatedclasses.udt.records.UBookTableRecord pTables4(org.jooq.Configuration configuration, org.jooq.test.oracle.generatedclasses.udt.records.UBookTableRecord inTable) { + org.jooq.test.oracle.generatedclasses.routines.PTables4 p = new org.jooq.test.oracle.generatedclasses.routines.PTables4(); + p.setInTable(inTable); + + p.execute(configuration); + return p.getOutTable(); + } + /** * Invoke P_UNUSED * diff --git a/jOOQ-test/src/org/jooq/test/oracle/generatedclasses/routines/FArrays4.java b/jOOQ-test/src/org/jooq/test/oracle/generatedclasses/routines/FArrays4.java new file mode 100644 index 0000000000..97a5db177c --- /dev/null +++ b/jOOQ-test/src/org/jooq/test/oracle/generatedclasses/routines/FArrays4.java @@ -0,0 +1,49 @@ +/** + * This class is generated by jOOQ + */ +package org.jooq.test.oracle.generatedclasses.routines; + +/** + * This class is generated by jOOQ. + */ +public class FArrays4 extends org.jooq.impl.AbstractRoutine { + + private static final long serialVersionUID = 1222197254; + + + /** + * An uncommented item + */ + public static final org.jooq.Parameter RETURN_VALUE = createParameter("RETURN_VALUE", org.jooq.test.oracle.generatedclasses.udt.UBookType.U_BOOK_TYPE.getDataType().asArrayDataType(org.jooq.test.oracle.generatedclasses.udt.records.UBookArrayRecord.class)); + + /** + * An uncommented item + */ + public static final org.jooq.Parameter IN_ARRAY = createParameter("IN_ARRAY", org.jooq.test.oracle.generatedclasses.udt.UBookType.U_BOOK_TYPE.getDataType().asArrayDataType(org.jooq.test.oracle.generatedclasses.udt.records.UBookArrayRecord.class)); + + /** + * Create a new routine call instance + */ + public FArrays4() { + super(org.jooq.SQLDialect.ORACLE, "F_ARRAYS4", org.jooq.test.oracle.generatedclasses.Test.TEST, org.jooq.test.oracle.generatedclasses.udt.UBookType.U_BOOK_TYPE.getDataType().asArrayDataType(org.jooq.test.oracle.generatedclasses.udt.records.UBookArrayRecord.class)); + + setReturnParameter(RETURN_VALUE); + addInParameter(IN_ARRAY); + } + + /** + * Set the IN_ARRAY parameter to the routine + */ + public void setInArray(org.jooq.test.oracle.generatedclasses.udt.records.UBookArrayRecord value) { + setValue(IN_ARRAY, value); + } + + /** + * Set the IN_ARRAY parameter to the function + *

+ * Use this method only, if the function is called as a {@link org.jooq.Field} in a {@link org.jooq.Select} statement! + */ + public void setInArray(org.jooq.Field field) { + setField(IN_ARRAY, field); + } +} diff --git a/jOOQ-test/src/org/jooq/test/oracle/generatedclasses/routines/FTables4.java b/jOOQ-test/src/org/jooq/test/oracle/generatedclasses/routines/FTables4.java new file mode 100644 index 0000000000..b4f0b98193 --- /dev/null +++ b/jOOQ-test/src/org/jooq/test/oracle/generatedclasses/routines/FTables4.java @@ -0,0 +1,49 @@ +/** + * This class is generated by jOOQ + */ +package org.jooq.test.oracle.generatedclasses.routines; + +/** + * This class is generated by jOOQ. + */ +public class FTables4 extends org.jooq.impl.AbstractRoutine { + + private static final long serialVersionUID = 764539614; + + + /** + * An uncommented item + */ + public static final org.jooq.Parameter RETURN_VALUE = createParameter("RETURN_VALUE", org.jooq.test.oracle.generatedclasses.udt.UBookType.U_BOOK_TYPE.getDataType().asArrayDataType(org.jooq.test.oracle.generatedclasses.udt.records.UBookTableRecord.class)); + + /** + * An uncommented item + */ + public static final org.jooq.Parameter IN_TABLE = createParameter("IN_TABLE", org.jooq.test.oracle.generatedclasses.udt.UBookType.U_BOOK_TYPE.getDataType().asArrayDataType(org.jooq.test.oracle.generatedclasses.udt.records.UBookTableRecord.class)); + + /** + * Create a new routine call instance + */ + public FTables4() { + super(org.jooq.SQLDialect.ORACLE, "F_TABLES4", org.jooq.test.oracle.generatedclasses.Test.TEST, org.jooq.test.oracle.generatedclasses.udt.UBookType.U_BOOK_TYPE.getDataType().asArrayDataType(org.jooq.test.oracle.generatedclasses.udt.records.UBookTableRecord.class)); + + setReturnParameter(RETURN_VALUE); + addInParameter(IN_TABLE); + } + + /** + * Set the IN_TABLE parameter to the routine + */ + public void setInTable(org.jooq.test.oracle.generatedclasses.udt.records.UBookTableRecord value) { + setValue(IN_TABLE, value); + } + + /** + * Set the IN_TABLE parameter to the function + *

+ * Use this method only, if the function is called as a {@link org.jooq.Field} in a {@link org.jooq.Select} statement! + */ + public void setInTable(org.jooq.Field field) { + setField(IN_TABLE, field); + } +} diff --git a/jOOQ-test/src/org/jooq/test/oracle/generatedclasses/routines/PArrays4.java b/jOOQ-test/src/org/jooq/test/oracle/generatedclasses/routines/PArrays4.java new file mode 100644 index 0000000000..d3953d3a6c --- /dev/null +++ b/jOOQ-test/src/org/jooq/test/oracle/generatedclasses/routines/PArrays4.java @@ -0,0 +1,44 @@ +/** + * This class is generated by jOOQ + */ +package org.jooq.test.oracle.generatedclasses.routines; + +/** + * This class is generated by jOOQ. + */ +public class PArrays4 extends org.jooq.impl.AbstractRoutine { + + private static final long serialVersionUID = -564071678; + + + /** + * An uncommented item + */ + public static final org.jooq.Parameter IN_ARRAY = createParameter("IN_ARRAY", org.jooq.test.oracle.generatedclasses.udt.UBookType.U_BOOK_TYPE.getDataType().asArrayDataType(org.jooq.test.oracle.generatedclasses.udt.records.UBookArrayRecord.class)); + + /** + * An uncommented item + */ + public static final org.jooq.Parameter OUT_ARRAY = createParameter("OUT_ARRAY", org.jooq.test.oracle.generatedclasses.udt.UBookType.U_BOOK_TYPE.getDataType().asArrayDataType(org.jooq.test.oracle.generatedclasses.udt.records.UBookArrayRecord.class)); + + /** + * Create a new routine call instance + */ + public PArrays4() { + super(org.jooq.SQLDialect.ORACLE, "P_ARRAYS4", org.jooq.test.oracle.generatedclasses.Test.TEST); + + addInParameter(IN_ARRAY); + addOutParameter(OUT_ARRAY); + } + + /** + * Set the IN_ARRAY parameter to the routine + */ + public void setInArray(org.jooq.test.oracle.generatedclasses.udt.records.UBookArrayRecord value) { + setValue(IN_ARRAY, value); + } + + public org.jooq.test.oracle.generatedclasses.udt.records.UBookArrayRecord getOutArray() { + return getValue(OUT_ARRAY); + } +} diff --git a/jOOQ-test/src/org/jooq/test/oracle/generatedclasses/routines/PTables4.java b/jOOQ-test/src/org/jooq/test/oracle/generatedclasses/routines/PTables4.java new file mode 100644 index 0000000000..5646507a26 --- /dev/null +++ b/jOOQ-test/src/org/jooq/test/oracle/generatedclasses/routines/PTables4.java @@ -0,0 +1,44 @@ +/** + * This class is generated by jOOQ + */ +package org.jooq.test.oracle.generatedclasses.routines; + +/** + * This class is generated by jOOQ. + */ +public class PTables4 extends org.jooq.impl.AbstractRoutine { + + private static final long serialVersionUID = -1028752490; + + + /** + * An uncommented item + */ + public static final org.jooq.Parameter IN_TABLE = createParameter("IN_TABLE", org.jooq.test.oracle.generatedclasses.udt.UBookType.U_BOOK_TYPE.getDataType().asArrayDataType(org.jooq.test.oracle.generatedclasses.udt.records.UBookTableRecord.class)); + + /** + * An uncommented item + */ + public static final org.jooq.Parameter OUT_TABLE = createParameter("OUT_TABLE", org.jooq.test.oracle.generatedclasses.udt.UBookType.U_BOOK_TYPE.getDataType().asArrayDataType(org.jooq.test.oracle.generatedclasses.udt.records.UBookTableRecord.class)); + + /** + * Create a new routine call instance + */ + public PTables4() { + super(org.jooq.SQLDialect.ORACLE, "P_TABLES4", org.jooq.test.oracle.generatedclasses.Test.TEST); + + addInParameter(IN_TABLE); + addOutParameter(OUT_TABLE); + } + + /** + * Set the IN_TABLE parameter to the routine + */ + public void setInTable(org.jooq.test.oracle.generatedclasses.udt.records.UBookTableRecord value) { + setValue(IN_TABLE, value); + } + + public org.jooq.test.oracle.generatedclasses.udt.records.UBookTableRecord getOutTable() { + return getValue(OUT_TABLE); + } +}