[#799] Add support for Oracle PL/SQL's object-oriented MEMBER PROCEDURES and MEMBER FUNCTIONS
[#957] Add <R> R Factory.newRecord(UDT<R>) for constructing attached UDTRecords
This commit is contained in:
parent
93312a1f2f
commit
41f1fa807f
@ -928,7 +928,7 @@ public class DefaultGenerator implements Generator {
|
||||
// XXX Generating UDTs
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
File targetUDTPackageDir = new File(targetPackageDir, "udt");
|
||||
File targetUDTPackageDir = new File(targetPackageDir, "udt");
|
||||
if (database.getUDTs().size() > 0) {
|
||||
log.info("Generating UDTs", targetUDTPackageDir.getCanonicalPath());
|
||||
|
||||
@ -948,7 +948,16 @@ public class DefaultGenerator implements Generator {
|
||||
out.print(UDTImpl.class);
|
||||
out.print("<");
|
||||
out.print(strategy.getFullJavaClassName(udt, "Record"));
|
||||
out.println("> {");
|
||||
out.print(">");
|
||||
|
||||
// [#799] Oracle UDTs with member procedures have similarities
|
||||
// with packages
|
||||
if (udt.getRoutines().size() > 0) {
|
||||
out.print(" implements ");
|
||||
out.print(org.jooq.Package.class);
|
||||
}
|
||||
|
||||
out.println(" {");
|
||||
out.printSerial();
|
||||
|
||||
printSingletonInstance(udt, out);
|
||||
@ -958,6 +967,29 @@ public class DefaultGenerator implements Generator {
|
||||
printUDTColumn(out, attribute, udt);
|
||||
}
|
||||
|
||||
// [#799] Oracle UDT's can have member procedures
|
||||
for (RoutineDefinition routine : udt.getRoutines()) {
|
||||
try {
|
||||
if (!routine.isSQLUsable()) {
|
||||
|
||||
// Static execute() convenience method
|
||||
printConvenienceMethodProcedure(out, routine, false);
|
||||
}
|
||||
else {
|
||||
|
||||
// Static execute() convenience method
|
||||
printConvenienceMethodFunction(out, routine, false);
|
||||
|
||||
// Static asField() convenience method
|
||||
printConvenienceMethodFunctionAsField(out, routine, false);
|
||||
printConvenienceMethodFunctionAsField(out, routine, true);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("Error while generating routine " + routine, e);
|
||||
}
|
||||
}
|
||||
|
||||
out.println();
|
||||
printNoFurtherInstancesAllowedJavadoc(out);
|
||||
out.println("\tprivate " + strategy.getJavaClassName(udt) + "() {");
|
||||
@ -990,7 +1022,7 @@ public class DefaultGenerator implements Generator {
|
||||
// ----------------------------------------------------------------------
|
||||
// XXX Generating UDT record classes
|
||||
// ----------------------------------------------------------------------
|
||||
File targetRecordUDTPackageDir = new File(new File(targetPackageDir, "udt"), "records");
|
||||
File targetRecordUDTPackageDir = new File(targetUDTPackageDir, "records");
|
||||
if (database.getUDTs().size() > 0) {
|
||||
log.info("Generating UDT records", targetRecordUDTPackageDir.getCanonicalPath());
|
||||
|
||||
@ -1019,6 +1051,23 @@ public class DefaultGenerator implements Generator {
|
||||
printGetterAndSetter(out, attribute);
|
||||
}
|
||||
|
||||
// [#799] Oracle UDT's can have member procedures
|
||||
for (RoutineDefinition routine : udt.getRoutines()) {
|
||||
try {
|
||||
if (!routine.isSQLUsable()) {
|
||||
// Instance execute() convenience method
|
||||
printConvenienceMethodProcedure(out, routine, true);
|
||||
}
|
||||
else {
|
||||
// Instance execute() convenience method
|
||||
printConvenienceMethodFunction(out, routine, true);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("Error while generating routine " + routine, e);
|
||||
}
|
||||
}
|
||||
|
||||
out.println();
|
||||
out.println("\tpublic " + strategy.getJavaClassName(udt, "Record") + "() {");
|
||||
|
||||
@ -1037,10 +1086,36 @@ public class DefaultGenerator implements Generator {
|
||||
watch.splitInfo("UDT records generated");
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// XXX Generating UDT member procedures
|
||||
// ----------------------------------------------------------------------
|
||||
if (database.getUDTs().size() > 0) {
|
||||
for (UDTDefinition udt : database.getUDTs()) {
|
||||
if (udt.getRoutines().size() > 0) {
|
||||
try {
|
||||
File dir = new File(targetUDTPackageDir, strategy.getJavaIdentifierUC(udt).toLowerCase());
|
||||
log.info("Generating member routines", dir.getCanonicalPath());
|
||||
|
||||
for (RoutineDefinition routine : udt.getRoutines()) {
|
||||
try {
|
||||
printRoutine(database, schema, routine);
|
||||
} catch (Exception e) {
|
||||
log.error("Error while generating member routines " + routine, e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Error while generating UDT " + udt, e);
|
||||
}
|
||||
|
||||
watch.splitInfo("Member procedures routines");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// XXX Generating ARRAY record classes
|
||||
// ----------------------------------------------------------------------
|
||||
File targetRecordARRAYPackageDir = new File(new File(targetPackageDir, "udt"), "records");
|
||||
File targetRecordARRAYPackageDir = new File(targetUDTPackageDir, "records");
|
||||
if (database.getArrays().size() > 0) {
|
||||
log.info("Generating ARRAYs", targetRecordARRAYPackageDir.getCanonicalPath());
|
||||
|
||||
@ -1193,12 +1268,12 @@ public class DefaultGenerator implements Generator {
|
||||
if (!routine.isSQLUsable()) {
|
||||
|
||||
// Static execute() convenience method
|
||||
printConvenienceMethodProcedure(outR, routine);
|
||||
printConvenienceMethodProcedure(outR, routine, false);
|
||||
}
|
||||
else {
|
||||
|
||||
// Static execute() convenience method
|
||||
printConvenienceMethodFunction(outR, routine);
|
||||
printConvenienceMethodFunction(outR, routine, false);
|
||||
|
||||
// Static asField() convenience method
|
||||
printConvenienceMethodFunctionAsField(outR, routine, false);
|
||||
@ -1225,7 +1300,7 @@ public class DefaultGenerator implements Generator {
|
||||
|
||||
for (PackageDefinition pkg : database.getPackages()) {
|
||||
try {
|
||||
File targetPackagePackageDir = new File(targetPackagesPackageDir, strategy.getJavaClassName(pkg).toLowerCase());
|
||||
File targetPackagePackageDir = new File(targetPackagesPackageDir, strategy.getJavaIdentifierUC(pkg).toLowerCase());
|
||||
log.info("Generating package", targetPackagePackageDir.getCanonicalPath());
|
||||
|
||||
for (RoutineDefinition routine : pkg.getRoutines()) {
|
||||
@ -1263,11 +1338,11 @@ public class DefaultGenerator implements Generator {
|
||||
try {
|
||||
if (!routine.isSQLUsable()) {
|
||||
// Static execute() convenience method
|
||||
printConvenienceMethodProcedure(outPkg, routine);
|
||||
printConvenienceMethodProcedure(outPkg, routine, false);
|
||||
}
|
||||
else {
|
||||
// Static execute() convenience method
|
||||
printConvenienceMethodFunction(outPkg, routine);
|
||||
printConvenienceMethodFunction(outPkg, routine, false);
|
||||
|
||||
// Static asField() convenience method
|
||||
printConvenienceMethodFunctionAsField(outPkg, routine, false);
|
||||
@ -1384,6 +1459,7 @@ public class DefaultGenerator implements Generator {
|
||||
}
|
||||
|
||||
out.print(">");
|
||||
|
||||
out.println(" {");
|
||||
out.printSerial();
|
||||
out.println();
|
||||
@ -1588,7 +1664,7 @@ public class DefaultGenerator implements Generator {
|
||||
out.println("\t}");
|
||||
}
|
||||
|
||||
private void printConvenienceMethodFunction(GenerationWriter out, RoutineDefinition function) throws SQLException {
|
||||
private void printConvenienceMethodFunction(GenerationWriter out, RoutineDefinition function, boolean instance) throws SQLException {
|
||||
// [#281] - Java can't handle more than 255 method parameters
|
||||
if (function.getInParameters().size() > 254) {
|
||||
log.warn("Too many parameters", "Function " + function + " has more than 254 in parameters. Skipping generation of convenience method.");
|
||||
@ -1606,20 +1682,36 @@ public class DefaultGenerator implements Generator {
|
||||
|
||||
printThrowsDataAccessException(out);
|
||||
out.println("\t */");
|
||||
out.print("\tpublic ");
|
||||
|
||||
if (!instance) {
|
||||
out.print("static ");
|
||||
}
|
||||
|
||||
out.print("\tpublic static ");
|
||||
out.print(getJavaType(function.getReturnType()));
|
||||
out.print(" ");
|
||||
out.print(strategy.getJavaClassNameLC(function));
|
||||
out.print("(");
|
||||
out.print(Configuration.class);
|
||||
out.print(" configuration");
|
||||
|
||||
String glue = "";
|
||||
if (!instance) {
|
||||
out.print(Configuration.class);
|
||||
out.print(" configuration");
|
||||
glue = ", ";
|
||||
}
|
||||
|
||||
for (ParameterDefinition parameter : function.getInParameters()) {
|
||||
out.print(", ");
|
||||
// Skip SELF parameter
|
||||
if (instance && parameter.equals(function.getInParameters().get(0))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
out.print(glue);
|
||||
printNumberType(out, parameter.getType());
|
||||
out.print(" ");
|
||||
out.print(strategy.getJavaClassNameLC(parameter));
|
||||
|
||||
glue = ", ";
|
||||
}
|
||||
|
||||
out.println(") {");
|
||||
@ -1630,12 +1722,35 @@ public class DefaultGenerator implements Generator {
|
||||
out.println("();");
|
||||
|
||||
for (ParameterDefinition parameter : function.getInParameters()) {
|
||||
out.println("\t\tf.set" + strategy.getJavaClassName(parameter) + "(" + strategy.getJavaClassNameLC(parameter) + ");");
|
||||
out.print("\t\tf.set");
|
||||
out.print(strategy.getJavaClassName(parameter));
|
||||
out.print("(");
|
||||
|
||||
if (instance && parameter.equals(function.getInParameters().get(0))) {
|
||||
out.print("this");
|
||||
}
|
||||
else {
|
||||
out.print(strategy.getJavaClassNameLC(parameter));
|
||||
}
|
||||
|
||||
out.println(");");
|
||||
}
|
||||
|
||||
out.println();
|
||||
out.print("\t\tf.execute(");
|
||||
|
||||
if (instance) {
|
||||
out.print("getConfiguration()");
|
||||
}
|
||||
else {
|
||||
out.print("configuration");
|
||||
}
|
||||
|
||||
out.println(");");
|
||||
|
||||
// TODO [#956] Find a way to register "SELF" as OUT parameter
|
||||
// in case this is a UDT instance (member) function
|
||||
|
||||
out.println("\t\tf.execute(configuration);");
|
||||
out.println("\t\treturn f.getReturnValue();");
|
||||
out.println("\t}");
|
||||
}
|
||||
@ -1655,7 +1770,7 @@ public class DefaultGenerator implements Generator {
|
||||
out.println("\tprivate " + javaClassName + "() {}");
|
||||
}
|
||||
|
||||
private void printConvenienceMethodProcedure(GenerationWriter out, RoutineDefinition procedure) throws SQLException {
|
||||
private void printConvenienceMethodProcedure(GenerationWriter out, RoutineDefinition procedure, boolean instance) throws SQLException {
|
||||
// [#281] - Java can't handle more than 255 method parameters
|
||||
if (procedure.getInParameters().size() > 254) {
|
||||
log.warn("Too many parameters", "Procedure " + procedure + " has more than 254 in parameters. Skipping generation of convenience method.");
|
||||
@ -1683,7 +1798,11 @@ public class DefaultGenerator implements Generator {
|
||||
|
||||
printThrowsDataAccessException(out);
|
||||
out.println("\t */");
|
||||
out.print("\tpublic static ");
|
||||
out.print("\tpublic ");
|
||||
|
||||
if (!instance) {
|
||||
out.print("static ");
|
||||
}
|
||||
|
||||
if (procedure.getOutParameters().size() == 0) {
|
||||
out.print("void ");
|
||||
@ -1698,14 +1817,26 @@ public class DefaultGenerator implements Generator {
|
||||
|
||||
out.print(strategy.getJavaClassNameLC(procedure));
|
||||
out.print("(");
|
||||
out.print(Configuration.class);
|
||||
out.print(" configuration");
|
||||
|
||||
String glue = "";
|
||||
if (!instance) {
|
||||
out.print(Configuration.class);
|
||||
out.print(" configuration");
|
||||
glue = ", ";
|
||||
}
|
||||
|
||||
for (ParameterDefinition parameter : procedure.getInParameters()) {
|
||||
out.print(", ");
|
||||
// Skip SELF parameter
|
||||
if (instance && parameter.equals(procedure.getInParameters().get(0))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
out.print(glue);
|
||||
printNumberType(out, parameter.getType());
|
||||
out.print(" ");
|
||||
out.print(strategy.getJavaClassNameLC(parameter));
|
||||
|
||||
glue = ", ";
|
||||
}
|
||||
|
||||
out.println(") {");
|
||||
@ -1716,17 +1847,47 @@ public class DefaultGenerator implements Generator {
|
||||
out.println("();");
|
||||
|
||||
for (ParameterDefinition parameter : procedure.getInParameters()) {
|
||||
out.println("\t\tp.set" + strategy.getJavaClassName(parameter) + "(" + strategy.getJavaClassNameLC(parameter) + ");");
|
||||
out.print("\t\tp.set");
|
||||
out.print(strategy.getJavaClassName(parameter));
|
||||
out.print("(");
|
||||
|
||||
if (instance && parameter.equals(procedure.getInParameters().get(0))) {
|
||||
out.print("this");
|
||||
}
|
||||
else {
|
||||
out.print(strategy.getJavaClassNameLC(parameter));
|
||||
}
|
||||
|
||||
out.println(");");
|
||||
}
|
||||
|
||||
out.println();
|
||||
out.println("\t\tp.execute(configuration);");
|
||||
out.print("\t\tp.execute(");
|
||||
|
||||
if (procedure.getOutParameters().size() == 1) {
|
||||
out.println("\t\treturn p.get" + strategy.getJavaClassName(procedure.getOutParameters().get(0)) + "();");
|
||||
if (instance) {
|
||||
out.print("getConfiguration()");
|
||||
}
|
||||
else if (procedure.getOutParameters().size() > 1) {
|
||||
out.println("\t\treturn p;");
|
||||
else {
|
||||
out.print("configuration");
|
||||
}
|
||||
|
||||
out.println(");");
|
||||
|
||||
if (procedure.getOutParameters().size() > 0) {
|
||||
if (instance) {
|
||||
out.print("\t\tfrom(p.get");
|
||||
out.print(strategy.getJavaClassName(procedure.getOutParameters().get(0)));
|
||||
out.println("());");
|
||||
}
|
||||
|
||||
if (procedure.getOutParameters().size() == 1) {
|
||||
out.print("\t\treturn p.get");
|
||||
out.print(strategy.getJavaClassName(procedure.getOutParameters().get(0)));
|
||||
out.println("();");
|
||||
}
|
||||
else if (procedure.getOutParameters().size() > 1) {
|
||||
out.println("\t\treturn p;");
|
||||
}
|
||||
}
|
||||
|
||||
out.println("\t}");
|
||||
|
||||
@ -360,13 +360,21 @@ public class DefaultGeneratorStrategy implements GeneratorStrategy {
|
||||
else if (definition instanceof TableDefinition) {
|
||||
return "tables";
|
||||
}
|
||||
|
||||
// [#799] UDT's are also packages
|
||||
else if (definition instanceof UDTDefinition) {
|
||||
return "udt";
|
||||
}
|
||||
else if (definition instanceof PackageDefinition) {
|
||||
return "packages";
|
||||
}
|
||||
else if (definition instanceof RoutineDefinition) {
|
||||
RoutineDefinition routine = (RoutineDefinition) definition;
|
||||
|
||||
if (routine.getPackage() != null) {
|
||||
if (routine.getPackage() instanceof UDTDefinition) {
|
||||
return "udt." + getJavaIdentifierUC(routine.getPackage()).toLowerCase();
|
||||
}
|
||||
else if (routine.getPackage() != null) {
|
||||
return "packages." + getJavaIdentifierUC(routine.getPackage()).toLowerCase();
|
||||
}
|
||||
else {
|
||||
@ -379,9 +387,6 @@ public class DefaultGeneratorStrategy implements GeneratorStrategy {
|
||||
else if (definition instanceof ArrayDefinition) {
|
||||
return "udt";
|
||||
}
|
||||
else if (definition instanceof UDTDefinition) {
|
||||
return "udt";
|
||||
}
|
||||
|
||||
// Default always to the main package
|
||||
return "";
|
||||
|
||||
@ -48,6 +48,8 @@ extends
|
||||
implements
|
||||
UDTDefinition {
|
||||
|
||||
private List<RoutineDefinition> routines;
|
||||
|
||||
public AbstractUDTDefinition(Database database, String name, String comment) {
|
||||
super(database, name, comment);
|
||||
}
|
||||
@ -66,4 +68,15 @@ implements
|
||||
public final AttributeDefinition getAttribute(int attributeIndex) {
|
||||
return getElement(attributeIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final List<RoutineDefinition> getRoutines() {
|
||||
if (routines == null) {
|
||||
routines = getRoutines0();
|
||||
}
|
||||
|
||||
return routines;
|
||||
}
|
||||
|
||||
protected abstract List<RoutineDefinition> getRoutines0();
|
||||
}
|
||||
|
||||
@ -37,13 +37,16 @@ package org.jooq.util;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* A definition for a UDT
|
||||
* <p>
|
||||
* This extends {@link PackageDefinition} because Oracle internally models UDT's
|
||||
* in similar ways as packages. This is especially true for the way, member
|
||||
* procedures and functions are called.
|
||||
*
|
||||
* @author Lukas Eder
|
||||
*/
|
||||
public interface UDTDefinition extends Definition {
|
||||
public interface UDTDefinition extends PackageDefinition {
|
||||
|
||||
/**
|
||||
* All attributes in the UDT
|
||||
@ -60,4 +63,9 @@ public interface UDTDefinition extends Definition {
|
||||
*/
|
||||
AttributeDefinition getAttribute(int attributeIndex);
|
||||
|
||||
/**
|
||||
* All routines in the UDT
|
||||
*/
|
||||
@Override
|
||||
List<RoutineDefinition> getRoutines();
|
||||
}
|
||||
|
||||
@ -39,6 +39,7 @@ import static org.jooq.util.db2.syscat.tables.Attributes.ATTRIBUTES;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.jooq.Record;
|
||||
@ -48,6 +49,7 @@ import org.jooq.util.DataTypeDefinition;
|
||||
import org.jooq.util.Database;
|
||||
import org.jooq.util.DefaultAttributeDefinition;
|
||||
import org.jooq.util.DefaultDataTypeDefinition;
|
||||
import org.jooq.util.RoutineDefinition;
|
||||
import org.jooq.util.db2.syscat.tables.Attributes;
|
||||
|
||||
/**
|
||||
@ -93,4 +95,8 @@ public class DB2UDTDefinition extends AbstractUDTDefinition {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<RoutineDefinition> getRoutines0() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,6 +35,7 @@
|
||||
*/
|
||||
package org.jooq.util.oracle;
|
||||
|
||||
import static org.jooq.util.oracle.sys.Tables.ALL_ARGUMENTS;
|
||||
import static org.jooq.util.oracle.sys.Tables.ALL_TYPE_ATTRS;
|
||||
|
||||
import java.sql.SQLException;
|
||||
@ -48,6 +49,7 @@ import org.jooq.util.DataTypeDefinition;
|
||||
import org.jooq.util.Database;
|
||||
import org.jooq.util.DefaultAttributeDefinition;
|
||||
import org.jooq.util.DefaultDataTypeDefinition;
|
||||
import org.jooq.util.RoutineDefinition;
|
||||
|
||||
public class OracleUDTDefinition extends AbstractUDTDefinition {
|
||||
|
||||
@ -86,4 +88,32 @@ public class OracleUDTDefinition extends AbstractUDTDefinition {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<RoutineDefinition> getRoutines0() {
|
||||
List<RoutineDefinition> result = new ArrayList<RoutineDefinition>();
|
||||
|
||||
for (Record record : create()
|
||||
.selectDistinct(
|
||||
ALL_ARGUMENTS.OBJECT_NAME,
|
||||
ALL_ARGUMENTS.OBJECT_ID,
|
||||
ALL_ARGUMENTS.OVERLOAD)
|
||||
.from(ALL_ARGUMENTS)
|
||||
.where(ALL_ARGUMENTS.OWNER.equal(getSchemaName()))
|
||||
.and(ALL_ARGUMENTS.PACKAGE_NAME.equal(getName()))
|
||||
.orderBy(
|
||||
ALL_ARGUMENTS.OBJECT_NAME,
|
||||
ALL_ARGUMENTS.OVERLOAD)
|
||||
.fetch()) {
|
||||
|
||||
result.add(new OracleRoutineDefinition(getDatabase(),
|
||||
this,
|
||||
record.getValue(ALL_ARGUMENTS.OBJECT_NAME),
|
||||
"",
|
||||
record.getValue(ALL_ARGUMENTS.OBJECT_ID),
|
||||
record.getValue(ALL_ARGUMENTS.OVERLOAD)));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,6 +39,7 @@ import static org.jooq.util.postgres.information_schema.Tables.ATTRIBUTES;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.jooq.Record;
|
||||
@ -48,6 +49,7 @@ import org.jooq.util.DataTypeDefinition;
|
||||
import org.jooq.util.Database;
|
||||
import org.jooq.util.DefaultAttributeDefinition;
|
||||
import org.jooq.util.DefaultDataTypeDefinition;
|
||||
import org.jooq.util.RoutineDefinition;
|
||||
|
||||
public class PostgresUDTDefinition extends AbstractUDTDefinition {
|
||||
|
||||
@ -88,4 +90,9 @@ public class PostgresUDTDefinition extends AbstractUDTDefinition {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<RoutineDefinition> getRoutines0() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,6 +76,8 @@ import org.jooq.Table;
|
||||
import org.jooq.TableLike;
|
||||
import org.jooq.TableRecord;
|
||||
import org.jooq.Truncate;
|
||||
import org.jooq.UDT;
|
||||
import org.jooq.UDTRecord;
|
||||
import org.jooq.UpdateQuery;
|
||||
import org.jooq.UpdateSetStep;
|
||||
import org.jooq.exception.DataAccessException;
|
||||
@ -323,6 +325,11 @@ public class FactoryProxy implements FactoryOperations, MethodInterceptor {
|
||||
return getDelegate().truncate(table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends UDTRecord<R>> R newRecord(UDT<R> type) {
|
||||
return getDelegate().newRecord(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final <R extends TableRecord<R>> R newRecord(Table<R> table) {
|
||||
return getDelegate().newRecord(table);
|
||||
|
||||
@ -1102,8 +1102,9 @@ public abstract class jOOQAbstractTest<
|
||||
assertEquals(0, schema.getUDTs().size());
|
||||
}
|
||||
// [#643] The U_INVALID types are only available in Oracle
|
||||
// [#799] The member procedure UDT's too
|
||||
else if (getDialect() == SQLDialect.ORACLE) {
|
||||
assertEquals(5, schema.getUDTs().size());
|
||||
assertEquals(7, schema.getUDTs().size());
|
||||
}
|
||||
else {
|
||||
assertEquals(2, schema.getUDTs().size());
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
package org.jooq.test;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static junit.framework.Assert.assertNull;
|
||||
import static org.jooq.impl.Factory.one;
|
||||
import static org.jooq.impl.Factory.substring;
|
||||
import static org.jooq.impl.Factory.trueCondition;
|
||||
@ -53,6 +54,9 @@ import static org.jooq.test.oracle.generatedclasses.Tables.T_TRIGGERS;
|
||||
import static org.jooq.test.oracle.generatedclasses.Tables.V_AUTHOR;
|
||||
import static org.jooq.test.oracle.generatedclasses.Tables.V_BOOK;
|
||||
import static org.jooq.test.oracle.generatedclasses.Tables.V_LIBRARY;
|
||||
import static org.jooq.test.oracle.generatedclasses.udt.UAuthorType.U_AUTHOR_TYPE;
|
||||
import static org.jooq.test.oracle.generatedclasses.udt.UAuthorType.countBooks;
|
||||
import static org.jooq.test.oracle.generatedclasses.udt.UAuthorType.load;
|
||||
import static org.jooq.util.oracle.OracleFactory.connectByIsCycle;
|
||||
import static org.jooq.util.oracle.OracleFactory.connectByIsLeaf;
|
||||
import static org.jooq.util.oracle.OracleFactory.level;
|
||||
@ -101,10 +105,12 @@ import org.jooq.test.oracle.generatedclasses.udt.UInvalidType;
|
||||
import org.jooq.test.oracle.generatedclasses.udt.UStreetType;
|
||||
import org.jooq.test.oracle.generatedclasses.udt.records.OInvalidTypeRecord;
|
||||
import org.jooq.test.oracle.generatedclasses.udt.records.TInvalidTypeRecord;
|
||||
import org.jooq.test.oracle.generatedclasses.udt.records.UAuthorTypeRecord;
|
||||
import org.jooq.test.oracle.generatedclasses.udt.records.UInvalidTypeRecord;
|
||||
import org.jooq.test.oracle.generatedclasses.udt.records.UNumberArrayRecord;
|
||||
import org.jooq.test.oracle.generatedclasses.udt.records.UNumberLongArrayRecord;
|
||||
import org.jooq.test.oracle.generatedclasses.udt.records.UStringArrayRecord;
|
||||
import org.jooq.test.oracle.generatedclasses.udt.u_author_type.GetBooks;
|
||||
import org.jooq.util.oracle.OracleDataType;
|
||||
import org.jooq.util.oracle.OracleFactory;
|
||||
|
||||
@ -614,36 +620,38 @@ public class jOOQOracleTest extends jOOQAbstractTest<
|
||||
// Oracle-specific tests
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
private OracleFactory ora() {
|
||||
return new OracleFactory(create().getConnection(), create().getSchemaMapping());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOracleConnectBySimple() throws Exception {
|
||||
OracleFactory ora = new OracleFactory(create().getConnection(), create().getSchemaMapping());
|
||||
assertEquals(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9),
|
||||
ora().select(rownum())
|
||||
.connectBy(level().lessThan(10))
|
||||
.fetch(rownum()));
|
||||
assertEquals(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9),
|
||||
ora().select(rownum())
|
||||
.connectByNoCycle(level().lessThan(10))
|
||||
.fetch(rownum()));
|
||||
|
||||
assertEquals(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9),
|
||||
ora.select(rownum())
|
||||
.connectBy(level().lessThan(10))
|
||||
.fetch(rownum()));
|
||||
ora().select(rownum())
|
||||
.connectBy(level().lessThan(10))
|
||||
.and("1 = ?", 1)
|
||||
.startWith("? = ?", 1, 1)
|
||||
.fetch(rownum()));
|
||||
assertEquals(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9),
|
||||
ora.select(rownum())
|
||||
.connectByNoCycle(level().lessThan(10))
|
||||
.fetch(rownum()));
|
||||
|
||||
assertEquals(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9),
|
||||
ora.select(rownum())
|
||||
.connectBy(level().lessThan(10))
|
||||
.and("1 = ?", 1)
|
||||
.startWith("? = ?", 1, 1)
|
||||
.fetch(rownum()));
|
||||
assertEquals(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9),
|
||||
ora.select(rownum())
|
||||
.connectByNoCycle(level().lessThan(10))
|
||||
.and("1 = ?", 1)
|
||||
.startWith("? = ?", 1, 1)
|
||||
.fetch(rownum()));
|
||||
ora().select(rownum())
|
||||
.connectByNoCycle(level().lessThan(10))
|
||||
.and("1 = ?", 1)
|
||||
.startWith("? = ?", 1, 1)
|
||||
.fetch(rownum()));
|
||||
|
||||
Result<Record> result =
|
||||
ora.select(rownum(), connectByIsCycle(), connectByIsLeaf())
|
||||
.connectByNoCycle(level().lessThan(4))
|
||||
.fetch();
|
||||
ora().select(rownum(), connectByIsCycle(), connectByIsLeaf())
|
||||
.connectByNoCycle(level().lessThan(4))
|
||||
.fetch();
|
||||
|
||||
assertEquals(Integer.valueOf(1), result.getValue(0, rownum()));
|
||||
assertEquals(Integer.valueOf(2), result.getValue(1, rownum()));
|
||||
@ -660,17 +668,15 @@ public class jOOQOracleTest extends jOOQAbstractTest<
|
||||
|
||||
@Test
|
||||
public void testOracleConnectByDirectory() throws Exception {
|
||||
OracleFactory ora = new OracleFactory(create().getConnection(), create().getSchemaMapping());
|
||||
|
||||
List<?> paths =
|
||||
ora.select(substring(sysConnectByPath(TDirectory_NAME(), "/"), 2))
|
||||
.from(TDirectory())
|
||||
.where(trueCondition())
|
||||
.and(trueCondition())
|
||||
.connectBy(prior(TDirectory_ID()).equal(TDirectory_PARENT_ID()))
|
||||
.startWith(TDirectory_PARENT_ID().isNull())
|
||||
.orderBy(one())
|
||||
.fetch(0);
|
||||
ora().select(substring(sysConnectByPath(TDirectory_NAME(), "/"), 2))
|
||||
.from(TDirectory())
|
||||
.where(trueCondition())
|
||||
.and(trueCondition())
|
||||
.connectBy(prior(TDirectory_ID()).equal(TDirectory_PARENT_ID()))
|
||||
.startWith(TDirectory_PARENT_ID().isNull())
|
||||
.orderBy(one())
|
||||
.fetch(0);
|
||||
|
||||
assertEquals(26, paths.size());
|
||||
assertEquals(Arrays.asList(
|
||||
@ -701,4 +707,63 @@ public class jOOQOracleTest extends jOOQAbstractTest<
|
||||
"C:/Program Files/Java/jre6/lib/javaws.jar",
|
||||
"C:/Program Files/Java/jre6/lib/rt.jar"), paths);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMemberProcedures() throws Exception {
|
||||
UAuthorTypeRecord author1;
|
||||
UAuthorTypeRecord author2;
|
||||
|
||||
// Unattached:
|
||||
author1 = new UAuthorTypeRecord();
|
||||
author1.setId(1);
|
||||
author2 = load(ora(), author1);
|
||||
assertEquals(1, (int) author1.getId());
|
||||
assertEquals(1, (int) author2.getId());
|
||||
assertNull(author1.getFirstName());
|
||||
assertEquals("George", author2.getFirstName());
|
||||
assertNull(author1.getLastName());
|
||||
assertEquals("Orwell", author2.getLastName());
|
||||
|
||||
// Attached
|
||||
author1 = ora().newRecord(U_AUTHOR_TYPE);
|
||||
author1.setId(1);
|
||||
author2 = author1.load();
|
||||
assertEquals(1, (int) author1.getId());
|
||||
assertEquals(1, (int) author2.getId());
|
||||
assertEquals("George", author1.getFirstName());
|
||||
assertEquals("George", author2.getFirstName());
|
||||
assertEquals("Orwell", author1.getLastName());
|
||||
assertEquals("Orwell", author2.getLastName());
|
||||
|
||||
// Count books
|
||||
author1 = ora().newRecord(U_AUTHOR_TYPE);
|
||||
assertEquals(BigDecimal.ZERO, author1.countBooks());
|
||||
assertEquals(BigDecimal.ZERO, ora().select(countBooks(author1)).fetchOne(0));
|
||||
|
||||
author1 = ora().newRecord(U_AUTHOR_TYPE);
|
||||
author1.setId(1);
|
||||
assertEquals(new BigDecimal("2"), author1.countBooks());
|
||||
assertEquals(new BigDecimal("2"), ora().select(countBooks(author1)).fetchOne(0));
|
||||
|
||||
// Get books
|
||||
author1 = ora().newRecord(U_AUTHOR_TYPE);
|
||||
GetBooks noBooks = author1.getBooks();
|
||||
assertNull(noBooks.getBook1().getId());
|
||||
assertNull(noBooks.getBook1().getTitle());
|
||||
assertNull(noBooks.getBook2().getId());
|
||||
assertNull(noBooks.getBook2().getTitle());
|
||||
|
||||
author1 = ora().newRecord(U_AUTHOR_TYPE);
|
||||
author1.setId(1);
|
||||
GetBooks books = author1.getBooks();
|
||||
assertEquals(1, (int) books.getBook1().getId());
|
||||
assertEquals("1984", books.getBook1().getTitle());
|
||||
assertEquals(2, (int) books.getBook2().getId());
|
||||
assertEquals("Animal Farm", books.getBook2().getTitle());
|
||||
|
||||
// Get books also calls upon load, internally. Check if that's reflected
|
||||
assertEquals(1, (int) author1.getId());
|
||||
assertEquals("George", author1.getFirstName());
|
||||
assertEquals("Orwell", author1.getLastName());
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,6 +67,96 @@ DROP TYPE o_invalid_type/
|
||||
DROP TYPE t_invalid_type/
|
||||
DROP TYPE u_invalid_type/
|
||||
|
||||
DROP TYPE t_book_type/
|
||||
DROP TYPE u_author_type/
|
||||
DROP TYPE u_book_type/
|
||||
|
||||
CREATE TYPE u_book_type AS OBJECT (
|
||||
id number(7),
|
||||
title varchar2(400)
|
||||
)
|
||||
/
|
||||
|
||||
CREATE TYPE t_book_type AS TABLE OF u_book_type/
|
||||
|
||||
CREATE OR REPLACE TYPE u_author_type AS OBJECT (
|
||||
id number(7),
|
||||
first_name varchar2(50),
|
||||
last_name varchar2(50),
|
||||
|
||||
member procedure load,
|
||||
member procedure get_books (book1 OUT u_book_type, book2 OUT u_book_type),
|
||||
|
||||
member function count_books return number
|
||||
)
|
||||
/
|
||||
|
||||
CREATE OR REPLACE TYPE BODY u_author_type AS
|
||||
member procedure load is
|
||||
x number(7);
|
||||
begin
|
||||
x := id;
|
||||
|
||||
if x is not null then
|
||||
select a.first_name, a.last_name
|
||||
into first_name, last_name
|
||||
from t_author a
|
||||
where a.id = x;
|
||||
end if;
|
||||
end load;
|
||||
|
||||
member procedure get_books (book1 OUT u_book_type, book2 OUT u_book_type) is
|
||||
x number(7);
|
||||
b1 u_book_type := u_book_type(null, null);
|
||||
b2 u_book_type := u_book_type(null, null);
|
||||
begin
|
||||
x := id;
|
||||
|
||||
-- execute a load to check whether the author is also reloaded
|
||||
self.load;
|
||||
|
||||
if x is not null then
|
||||
select b.id, b.title
|
||||
into b1.id, b1.title
|
||||
from (
|
||||
select b.id, b.title, rownum r
|
||||
from t_book b
|
||||
where b.author_id = x
|
||||
order by b.id
|
||||
) b
|
||||
where b.r = 1;
|
||||
|
||||
select b.id, b.title
|
||||
into b2.id, b2.title
|
||||
from (
|
||||
select b.id, b.title, rownum r
|
||||
from t_book b
|
||||
where b.author_id = x
|
||||
order by b.id
|
||||
) b
|
||||
where b.r = 2;
|
||||
end if;
|
||||
|
||||
book1 := b1;
|
||||
book2 := b2;
|
||||
end get_books;
|
||||
|
||||
member function count_books return number is
|
||||
x number(7);
|
||||
r number(7);
|
||||
begin
|
||||
x := id;
|
||||
|
||||
select count(*)
|
||||
into r
|
||||
from t_book
|
||||
where author_id = x;
|
||||
|
||||
return r;
|
||||
end count_books;
|
||||
end;
|
||||
/
|
||||
|
||||
CREATE TYPE u_invalid_type AS invalid/
|
||||
CREATE TYPE t_invalid_type AS TABLE OF u_invalid_type/
|
||||
CREATE TYPE o_invalid_type AS OBJECT (
|
||||
|
||||
@ -10,7 +10,7 @@ package org.jooq.test.oracle.generatedclasses;
|
||||
comments = "This class is generated by jOOQ")
|
||||
public class Test extends org.jooq.impl.SchemaImpl {
|
||||
|
||||
private static final long serialVersionUID = 915695249;
|
||||
private static final long serialVersionUID = 1869611933;
|
||||
|
||||
/**
|
||||
* The singleton instance of TEST
|
||||
@ -31,6 +31,8 @@ public class Test extends org.jooq.impl.SchemaImpl {
|
||||
addMapping("TEST.O_INVALID_TYPE", org.jooq.test.oracle.generatedclasses.udt.records.OInvalidTypeRecord.class);
|
||||
addMapping("TEST.T_INVALID_TYPE", org.jooq.test.oracle.generatedclasses.udt.records.TInvalidTypeRecord.class);
|
||||
addMapping("TEST.U_ADDRESS_TYPE", org.jooq.test.oracle.generatedclasses.udt.records.UAddressTypeRecord.class);
|
||||
addMapping("TEST.U_AUTHOR_TYPE", org.jooq.test.oracle.generatedclasses.udt.records.UAuthorTypeRecord.class);
|
||||
addMapping("TEST.U_BOOK_TYPE", org.jooq.test.oracle.generatedclasses.udt.records.UBookTypeRecord.class);
|
||||
addMapping("TEST.U_INVALID_TYPE", org.jooq.test.oracle.generatedclasses.udt.records.UInvalidTypeRecord.class);
|
||||
addMapping("TEST.U_STREET_TYPE", org.jooq.test.oracle.generatedclasses.udt.records.UStreetTypeRecord.class);
|
||||
}
|
||||
@ -70,6 +72,8 @@ public class Test extends org.jooq.impl.SchemaImpl {
|
||||
org.jooq.test.oracle.generatedclasses.udt.OInvalidType.O_INVALID_TYPE,
|
||||
org.jooq.test.oracle.generatedclasses.udt.TInvalidType.T_INVALID_TYPE,
|
||||
org.jooq.test.oracle.generatedclasses.udt.UAddressType.U_ADDRESS_TYPE,
|
||||
org.jooq.test.oracle.generatedclasses.udt.UAuthorType.U_AUTHOR_TYPE,
|
||||
org.jooq.test.oracle.generatedclasses.udt.UBookType.U_BOOK_TYPE,
|
||||
org.jooq.test.oracle.generatedclasses.udt.UInvalidType.U_INVALID_TYPE,
|
||||
org.jooq.test.oracle.generatedclasses.udt.UStreetType.U_STREET_TYPE);
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ package org.jooq.test.oracle.generatedclasses.tables.records;
|
||||
comments = "This class is generated by jOOQ")
|
||||
public class XUnusedRecord extends org.jooq.impl.UpdatableRecordImpl<org.jooq.test.oracle.generatedclasses.tables.records.XUnusedRecord> {
|
||||
|
||||
private static final long serialVersionUID = 263044219;
|
||||
private static final long serialVersionUID = 1210920393;
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
@ -144,8 +144,6 @@ public class XUnusedRecord extends org.jooq.impl.UpdatableRecordImpl<org.jooq.te
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*
|
||||
* This item causes a name clash. That is why an underline character was appended to the Java field name
|
||||
*/
|
||||
public void setClass_(java.lang.Integer value) {
|
||||
setValue(org.jooq.test.oracle.generatedclasses.tables.XUnused.X_UNUSED.CLASS, value);
|
||||
@ -153,8 +151,6 @@ public class XUnusedRecord extends org.jooq.impl.UpdatableRecordImpl<org.jooq.te
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*
|
||||
* This item causes a name clash. That is why an underline character was appended to the Java field name
|
||||
*/
|
||||
public java.lang.Integer getClass_() {
|
||||
return getValue(org.jooq.test.oracle.generatedclasses.tables.XUnused.X_UNUSED.CLASS);
|
||||
@ -162,8 +158,6 @@ public class XUnusedRecord extends org.jooq.impl.UpdatableRecordImpl<org.jooq.te
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*
|
||||
* This item causes a name clash. That is why an underline character was appended to the Java field name
|
||||
*/
|
||||
public void setFields_(java.lang.Integer value) {
|
||||
setValue(org.jooq.test.oracle.generatedclasses.tables.XUnused.X_UNUSED.FIELDS, value);
|
||||
@ -171,8 +165,6 @@ public class XUnusedRecord extends org.jooq.impl.UpdatableRecordImpl<org.jooq.te
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*
|
||||
* This item causes a name clash. That is why an underline character was appended to the Java field name
|
||||
*/
|
||||
public java.lang.Integer getFields_() {
|
||||
return getValue(org.jooq.test.oracle.generatedclasses.tables.XUnused.X_UNUSED.FIELDS);
|
||||
@ -180,8 +172,6 @@ public class XUnusedRecord extends org.jooq.impl.UpdatableRecordImpl<org.jooq.te
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*
|
||||
* This item causes a name clash. That is why an underline character was appended to the Java field name
|
||||
*/
|
||||
public void setConfiguration_(java.lang.Integer value) {
|
||||
setValue(org.jooq.test.oracle.generatedclasses.tables.XUnused.X_UNUSED.CONFIGURATION, value);
|
||||
@ -189,8 +179,6 @@ public class XUnusedRecord extends org.jooq.impl.UpdatableRecordImpl<org.jooq.te
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*
|
||||
* This item causes a name clash. That is why an underline character was appended to the Java field name
|
||||
*/
|
||||
public java.lang.Integer getConfiguration_() {
|
||||
return getValue(org.jooq.test.oracle.generatedclasses.tables.XUnused.X_UNUSED.CONFIGURATION);
|
||||
@ -212,8 +200,6 @@ public class XUnusedRecord extends org.jooq.impl.UpdatableRecordImpl<org.jooq.te
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*
|
||||
* This item causes a name clash. That is why an underline character was appended to the Java field name
|
||||
*/
|
||||
public void setMetaData_(java.lang.Integer value) {
|
||||
setValue(org.jooq.test.oracle.generatedclasses.tables.XUnused.X_UNUSED.META_DATA, value);
|
||||
@ -221,8 +207,6 @@ public class XUnusedRecord extends org.jooq.impl.UpdatableRecordImpl<org.jooq.te
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*
|
||||
* This item causes a name clash. That is why an underline character was appended to the Java field name
|
||||
*/
|
||||
public java.lang.Integer getMetaData_() {
|
||||
return getValue(org.jooq.test.oracle.generatedclasses.tables.XUnused.X_UNUSED.META_DATA);
|
||||
@ -230,8 +214,6 @@ public class XUnusedRecord extends org.jooq.impl.UpdatableRecordImpl<org.jooq.te
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*
|
||||
* This item causes a name clash. That is why an underline character was appended to the Java field name
|
||||
*/
|
||||
public void setType0_(java.lang.Integer value) {
|
||||
setValue(org.jooq.test.oracle.generatedclasses.tables.XUnused.X_UNUSED.TYPE0, value);
|
||||
@ -239,8 +221,6 @@ public class XUnusedRecord extends org.jooq.impl.UpdatableRecordImpl<org.jooq.te
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*
|
||||
* This item causes a name clash. That is why an underline character was appended to the Java field name
|
||||
*/
|
||||
public java.lang.Integer getType0_() {
|
||||
return getValue(org.jooq.test.oracle.generatedclasses.tables.XUnused.X_UNUSED.TYPE0);
|
||||
|
||||
@ -0,0 +1,122 @@
|
||||
/**
|
||||
* This class is generated by jOOQ
|
||||
*/
|
||||
package org.jooq.test.oracle.generatedclasses.udt;
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@javax.annotation.Generated(value = {"http://www.jooq.org", "2.0.0"},
|
||||
comments = "This class is generated by jOOQ")
|
||||
public class UAuthorType extends org.jooq.impl.UDTImpl<org.jooq.test.oracle.generatedclasses.udt.records.UAuthorTypeRecord> implements org.jooq.Package {
|
||||
|
||||
private static final long serialVersionUID = -1306463347;
|
||||
|
||||
/**
|
||||
* The singleton instance of U_AUTHOR_TYPE
|
||||
*/
|
||||
public static final org.jooq.test.oracle.generatedclasses.udt.UAuthorType U_AUTHOR_TYPE = new org.jooq.test.oracle.generatedclasses.udt.UAuthorType();
|
||||
|
||||
/**
|
||||
* The class holding records for this type
|
||||
*/
|
||||
private static final java.lang.Class<org.jooq.test.oracle.generatedclasses.udt.records.UAuthorTypeRecord> __RECORD_TYPE = org.jooq.test.oracle.generatedclasses.udt.records.UAuthorTypeRecord.class;
|
||||
|
||||
/**
|
||||
* The class holding records for this type
|
||||
*/
|
||||
@Override
|
||||
public java.lang.Class<org.jooq.test.oracle.generatedclasses.udt.records.UAuthorTypeRecord> getRecordType() {
|
||||
return __RECORD_TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*/
|
||||
public static final org.jooq.UDTField<org.jooq.test.oracle.generatedclasses.udt.records.UAuthorTypeRecord, java.lang.Integer> ID = createField("ID", org.jooq.impl.SQLDataType.INTEGER, U_AUTHOR_TYPE);
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*/
|
||||
public static final org.jooq.UDTField<org.jooq.test.oracle.generatedclasses.udt.records.UAuthorTypeRecord, java.lang.String> FIRST_NAME = createField("FIRST_NAME", org.jooq.impl.SQLDataType.VARCHAR, U_AUTHOR_TYPE);
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*/
|
||||
public static final org.jooq.UDTField<org.jooq.test.oracle.generatedclasses.udt.records.UAuthorTypeRecord, java.lang.String> LAST_NAME = createField("LAST_NAME", org.jooq.impl.SQLDataType.VARCHAR, U_AUTHOR_TYPE);
|
||||
|
||||
/**
|
||||
* Invoke COUNT_BOOKS
|
||||
*
|
||||
* @param self
|
||||
* @throws org.jooq.exception.DataAccessException if something went wrong executing the query
|
||||
*/
|
||||
public static java.math.BigDecimal countBooks(org.jooq.Configuration configuration, org.jooq.test.oracle.generatedclasses.udt.records.UAuthorTypeRecord self) {
|
||||
org.jooq.test.oracle.generatedclasses.udt.u_author_type.CountBooks f = new org.jooq.test.oracle.generatedclasses.udt.u_author_type.CountBooks();
|
||||
f.setSelf(self);
|
||||
|
||||
f.execute(configuration);
|
||||
return f.getReturnValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get COUNT_BOOKS as a field
|
||||
*
|
||||
* @param self
|
||||
*/
|
||||
public static org.jooq.Field<java.math.BigDecimal> countBooks(org.jooq.test.oracle.generatedclasses.udt.records.UAuthorTypeRecord self) {
|
||||
org.jooq.test.oracle.generatedclasses.udt.u_author_type.CountBooks f = new org.jooq.test.oracle.generatedclasses.udt.u_author_type.CountBooks();
|
||||
f.setSelf(self);
|
||||
|
||||
return f.asField();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get COUNT_BOOKS as a field
|
||||
*
|
||||
* @param self
|
||||
*/
|
||||
public static org.jooq.Field<java.math.BigDecimal> countBooks(org.jooq.Field<org.jooq.test.oracle.generatedclasses.udt.records.UAuthorTypeRecord> self) {
|
||||
org.jooq.test.oracle.generatedclasses.udt.u_author_type.CountBooks f = new org.jooq.test.oracle.generatedclasses.udt.u_author_type.CountBooks();
|
||||
f.setSelf(self);
|
||||
|
||||
return f.asField();
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke GET_BOOKS
|
||||
*
|
||||
* @param self IN OUT parameter
|
||||
* @param book1 OUT parameter
|
||||
* @param book2 OUT parameter
|
||||
* @throws org.jooq.exception.DataAccessException if something went wrong executing the query
|
||||
*/
|
||||
public static org.jooq.test.oracle.generatedclasses.udt.u_author_type.GetBooks getBooks(org.jooq.Configuration configuration, org.jooq.test.oracle.generatedclasses.udt.records.UAuthorTypeRecord self) {
|
||||
org.jooq.test.oracle.generatedclasses.udt.u_author_type.GetBooks p = new org.jooq.test.oracle.generatedclasses.udt.u_author_type.GetBooks();
|
||||
p.setSelf(self);
|
||||
|
||||
p.execute(configuration);
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke LOAD
|
||||
*
|
||||
* @param self IN OUT parameter
|
||||
* @throws org.jooq.exception.DataAccessException if something went wrong executing the query
|
||||
*/
|
||||
public static org.jooq.test.oracle.generatedclasses.udt.records.UAuthorTypeRecord load(org.jooq.Configuration configuration, org.jooq.test.oracle.generatedclasses.udt.records.UAuthorTypeRecord self) {
|
||||
org.jooq.test.oracle.generatedclasses.udt.u_author_type.Load p = new org.jooq.test.oracle.generatedclasses.udt.u_author_type.Load();
|
||||
p.setSelf(self);
|
||||
|
||||
p.execute(configuration);
|
||||
return p.getSelf();
|
||||
}
|
||||
|
||||
/**
|
||||
* No further instances allowed
|
||||
*/
|
||||
private UAuthorType() {
|
||||
super("U_AUTHOR_TYPE", org.jooq.test.oracle.generatedclasses.Test.TEST);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
/**
|
||||
* This class is generated by jOOQ
|
||||
*/
|
||||
package org.jooq.test.oracle.generatedclasses.udt;
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@javax.annotation.Generated(value = {"http://www.jooq.org", "2.0.0"},
|
||||
comments = "This class is generated by jOOQ")
|
||||
public class UBookType extends org.jooq.impl.UDTImpl<org.jooq.test.oracle.generatedclasses.udt.records.UBookTypeRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1693876579;
|
||||
|
||||
/**
|
||||
* The singleton instance of U_BOOK_TYPE
|
||||
*/
|
||||
public static final org.jooq.test.oracle.generatedclasses.udt.UBookType U_BOOK_TYPE = new org.jooq.test.oracle.generatedclasses.udt.UBookType();
|
||||
|
||||
/**
|
||||
* The class holding records for this type
|
||||
*/
|
||||
private static final java.lang.Class<org.jooq.test.oracle.generatedclasses.udt.records.UBookTypeRecord> __RECORD_TYPE = org.jooq.test.oracle.generatedclasses.udt.records.UBookTypeRecord.class;
|
||||
|
||||
/**
|
||||
* The class holding records for this type
|
||||
*/
|
||||
@Override
|
||||
public java.lang.Class<org.jooq.test.oracle.generatedclasses.udt.records.UBookTypeRecord> getRecordType() {
|
||||
return __RECORD_TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*/
|
||||
public static final org.jooq.UDTField<org.jooq.test.oracle.generatedclasses.udt.records.UBookTypeRecord, java.lang.Integer> ID = createField("ID", org.jooq.impl.SQLDataType.INTEGER, U_BOOK_TYPE);
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*/
|
||||
public static final org.jooq.UDTField<org.jooq.test.oracle.generatedclasses.udt.records.UBookTypeRecord, java.lang.String> TITLE = createField("TITLE", org.jooq.impl.SQLDataType.VARCHAR, U_BOOK_TYPE);
|
||||
|
||||
/**
|
||||
* No further instances allowed
|
||||
*/
|
||||
private UBookType() {
|
||||
super("U_BOOK_TYPE", org.jooq.test.oracle.generatedclasses.Test.TEST);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,107 @@
|
||||
/**
|
||||
* This class is generated by jOOQ
|
||||
*/
|
||||
package org.jooq.test.oracle.generatedclasses.udt.records;
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@javax.annotation.Generated(value = {"http://www.jooq.org", "2.0.0"},
|
||||
comments = "This class is generated by jOOQ")
|
||||
public class UAuthorTypeRecord extends org.jooq.impl.UDTRecordImpl<org.jooq.test.oracle.generatedclasses.udt.records.UAuthorTypeRecord> {
|
||||
|
||||
private static final long serialVersionUID = 1355125548;
|
||||
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*/
|
||||
public void setId(java.lang.Integer value) {
|
||||
setValue(org.jooq.test.oracle.generatedclasses.udt.UAuthorType.ID, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*/
|
||||
public java.lang.Integer getId() {
|
||||
return getValue(org.jooq.test.oracle.generatedclasses.udt.UAuthorType.ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*/
|
||||
public void setFirstName(java.lang.String value) {
|
||||
setValue(org.jooq.test.oracle.generatedclasses.udt.UAuthorType.FIRST_NAME, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*/
|
||||
public java.lang.String getFirstName() {
|
||||
return getValue(org.jooq.test.oracle.generatedclasses.udt.UAuthorType.FIRST_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*/
|
||||
public void setLastName(java.lang.String value) {
|
||||
setValue(org.jooq.test.oracle.generatedclasses.udt.UAuthorType.LAST_NAME, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*/
|
||||
public java.lang.String getLastName() {
|
||||
return getValue(org.jooq.test.oracle.generatedclasses.udt.UAuthorType.LAST_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke COUNT_BOOKS
|
||||
*
|
||||
* @param self
|
||||
* @throws org.jooq.exception.DataAccessException if something went wrong executing the query
|
||||
*/
|
||||
public java.math.BigDecimal countBooks() {
|
||||
org.jooq.test.oracle.generatedclasses.udt.u_author_type.CountBooks f = new org.jooq.test.oracle.generatedclasses.udt.u_author_type.CountBooks();
|
||||
f.setSelf(this);
|
||||
|
||||
f.execute(getConfiguration());
|
||||
return f.getReturnValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke GET_BOOKS
|
||||
*
|
||||
* @param self IN OUT parameter
|
||||
* @param book1 OUT parameter
|
||||
* @param book2 OUT parameter
|
||||
* @throws org.jooq.exception.DataAccessException if something went wrong executing the query
|
||||
*/
|
||||
public org.jooq.test.oracle.generatedclasses.udt.u_author_type.GetBooks getBooks() {
|
||||
org.jooq.test.oracle.generatedclasses.udt.u_author_type.GetBooks p = new org.jooq.test.oracle.generatedclasses.udt.u_author_type.GetBooks();
|
||||
p.setSelf(this);
|
||||
|
||||
p.execute(getConfiguration());
|
||||
from(p.getSelf());
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoke LOAD
|
||||
*
|
||||
* @param self IN OUT parameter
|
||||
* @throws org.jooq.exception.DataAccessException if something went wrong executing the query
|
||||
*/
|
||||
public org.jooq.test.oracle.generatedclasses.udt.records.UAuthorTypeRecord load() {
|
||||
org.jooq.test.oracle.generatedclasses.udt.u_author_type.Load p = new org.jooq.test.oracle.generatedclasses.udt.u_author_type.Load();
|
||||
p.setSelf(this);
|
||||
|
||||
p.execute(getConfiguration());
|
||||
from(p.getSelf());
|
||||
return p.getSelf();
|
||||
}
|
||||
|
||||
public UAuthorTypeRecord() {
|
||||
super(org.jooq.test.oracle.generatedclasses.udt.UAuthorType.U_AUTHOR_TYPE);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
/**
|
||||
* This class is generated by jOOQ
|
||||
*/
|
||||
package org.jooq.test.oracle.generatedclasses.udt.records;
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@javax.annotation.Generated(value = {"http://www.jooq.org", "2.0.0"},
|
||||
comments = "This class is generated by jOOQ")
|
||||
public class UBookTypeRecord extends org.jooq.impl.UDTRecordImpl<org.jooq.test.oracle.generatedclasses.udt.records.UBookTypeRecord> {
|
||||
|
||||
private static final long serialVersionUID = -1694057466;
|
||||
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*/
|
||||
public void setId(java.lang.Integer value) {
|
||||
setValue(org.jooq.test.oracle.generatedclasses.udt.UBookType.ID, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*/
|
||||
public java.lang.Integer getId() {
|
||||
return getValue(org.jooq.test.oracle.generatedclasses.udt.UBookType.ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*/
|
||||
public void setTitle(java.lang.String value) {
|
||||
setValue(org.jooq.test.oracle.generatedclasses.udt.UBookType.TITLE, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*/
|
||||
public java.lang.String getTitle() {
|
||||
return getValue(org.jooq.test.oracle.generatedclasses.udt.UBookType.TITLE);
|
||||
}
|
||||
|
||||
public UBookTypeRecord() {
|
||||
super(org.jooq.test.oracle.generatedclasses.udt.UBookType.U_BOOK_TYPE);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
/**
|
||||
* This class is generated by jOOQ
|
||||
*/
|
||||
package org.jooq.test.oracle.generatedclasses.udt.u_author_type;
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@javax.annotation.Generated(value = {"http://www.jooq.org", "2.0.0"},
|
||||
comments = "This class is generated by jOOQ")
|
||||
public class CountBooks extends org.jooq.impl.AbstractRoutine<java.math.BigDecimal> {
|
||||
|
||||
private static final long serialVersionUID = -737595056;
|
||||
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*/
|
||||
public static final org.jooq.Parameter<java.math.BigDecimal> RETURN_VALUE = createParameter("RETURN_VALUE", org.jooq.impl.SQLDataType.NUMERIC);
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*/
|
||||
public static final org.jooq.Parameter<org.jooq.test.oracle.generatedclasses.udt.records.UAuthorTypeRecord> SELF = createParameter("SELF", org.jooq.test.oracle.generatedclasses.udt.UAuthorType.U_AUTHOR_TYPE.getDataType());
|
||||
|
||||
/**
|
||||
* Create a new routine call instance
|
||||
*/
|
||||
public CountBooks() {
|
||||
super(org.jooq.SQLDialect.ORACLE, "COUNT_BOOKS", org.jooq.test.oracle.generatedclasses.Test.TEST, org.jooq.test.oracle.generatedclasses.udt.UAuthorType.U_AUTHOR_TYPE, org.jooq.impl.SQLDataType.NUMERIC);
|
||||
|
||||
setReturnParameter(RETURN_VALUE);
|
||||
addInParameter(SELF);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the <code>SELF</code> parameter to the routine
|
||||
*/
|
||||
public void setSelf(org.jooq.test.oracle.generatedclasses.udt.records.UAuthorTypeRecord value) {
|
||||
setValue(SELF, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the <code>SELF</code> parameter to the function
|
||||
* <p>
|
||||
* Use this method only, if the function is called as a {@link org.jooq.Field} in a {@link org.jooq.Select} statement!
|
||||
*/
|
||||
public void setSelf(org.jooq.Field<org.jooq.test.oracle.generatedclasses.udt.records.UAuthorTypeRecord> field) {
|
||||
setField(SELF, field);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
/**
|
||||
* This class is generated by jOOQ
|
||||
*/
|
||||
package org.jooq.test.oracle.generatedclasses.udt.u_author_type;
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@javax.annotation.Generated(value = {"http://www.jooq.org", "2.0.0"},
|
||||
comments = "This class is generated by jOOQ")
|
||||
public class GetBooks extends org.jooq.impl.AbstractRoutine<java.lang.Void> {
|
||||
|
||||
private static final long serialVersionUID = 1050061777;
|
||||
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*/
|
||||
public static final org.jooq.Parameter<org.jooq.test.oracle.generatedclasses.udt.records.UAuthorTypeRecord> SELF = createParameter("SELF", org.jooq.test.oracle.generatedclasses.udt.UAuthorType.U_AUTHOR_TYPE.getDataType());
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*/
|
||||
public static final org.jooq.Parameter<org.jooq.test.oracle.generatedclasses.udt.records.UBookTypeRecord> BOOK1 = createParameter("BOOK1", org.jooq.test.oracle.generatedclasses.udt.UBookType.U_BOOK_TYPE.getDataType());
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*/
|
||||
public static final org.jooq.Parameter<org.jooq.test.oracle.generatedclasses.udt.records.UBookTypeRecord> BOOK2 = createParameter("BOOK2", org.jooq.test.oracle.generatedclasses.udt.UBookType.U_BOOK_TYPE.getDataType());
|
||||
|
||||
/**
|
||||
* Create a new routine call instance
|
||||
*/
|
||||
public GetBooks() {
|
||||
super(org.jooq.SQLDialect.ORACLE, "GET_BOOKS", org.jooq.test.oracle.generatedclasses.Test.TEST, org.jooq.test.oracle.generatedclasses.udt.UAuthorType.U_AUTHOR_TYPE);
|
||||
|
||||
addInOutParameter(SELF);
|
||||
addOutParameter(BOOK1);
|
||||
addOutParameter(BOOK2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the <code>SELF</code> parameter to the routine
|
||||
*/
|
||||
public void setSelf(org.jooq.test.oracle.generatedclasses.udt.records.UAuthorTypeRecord value) {
|
||||
setValue(SELF, value);
|
||||
}
|
||||
|
||||
public org.jooq.test.oracle.generatedclasses.udt.records.UAuthorTypeRecord getSelf() {
|
||||
return getValue(SELF);
|
||||
}
|
||||
|
||||
public org.jooq.test.oracle.generatedclasses.udt.records.UBookTypeRecord getBook1() {
|
||||
return getValue(BOOK1);
|
||||
}
|
||||
|
||||
public org.jooq.test.oracle.generatedclasses.udt.records.UBookTypeRecord getBook2() {
|
||||
return getValue(BOOK2);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
/**
|
||||
* This class is generated by jOOQ
|
||||
*/
|
||||
package org.jooq.test.oracle.generatedclasses.udt.u_author_type;
|
||||
|
||||
/**
|
||||
* This class is generated by jOOQ.
|
||||
*/
|
||||
@javax.annotation.Generated(value = {"http://www.jooq.org", "2.0.0"},
|
||||
comments = "This class is generated by jOOQ")
|
||||
public class Load extends org.jooq.impl.AbstractRoutine<java.lang.Void> {
|
||||
|
||||
private static final long serialVersionUID = -1417820903;
|
||||
|
||||
|
||||
/**
|
||||
* An uncommented item
|
||||
*/
|
||||
public static final org.jooq.Parameter<org.jooq.test.oracle.generatedclasses.udt.records.UAuthorTypeRecord> SELF = createParameter("SELF", org.jooq.test.oracle.generatedclasses.udt.UAuthorType.U_AUTHOR_TYPE.getDataType());
|
||||
|
||||
/**
|
||||
* Create a new routine call instance
|
||||
*/
|
||||
public Load() {
|
||||
super(org.jooq.SQLDialect.ORACLE, "LOAD", org.jooq.test.oracle.generatedclasses.Test.TEST, org.jooq.test.oracle.generatedclasses.udt.UAuthorType.U_AUTHOR_TYPE);
|
||||
|
||||
addInOutParameter(SELF);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the <code>SELF</code> parameter to the routine
|
||||
*/
|
||||
public void setSelf(org.jooq.test.oracle.generatedclasses.udt.records.UAuthorTypeRecord value) {
|
||||
setValue(SELF, value);
|
||||
}
|
||||
|
||||
public org.jooq.test.oracle.generatedclasses.udt.records.UAuthorTypeRecord getSelf() {
|
||||
return getValue(SELF);
|
||||
}
|
||||
}
|
||||
@ -655,6 +655,15 @@ public interface FactoryOperations extends Configuration {
|
||||
// Global Record factory
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Create a new attached {@link UDTRecord}.
|
||||
*
|
||||
* @param <R> The generic record type
|
||||
* @param type The UDT describing records of type <R>
|
||||
* @return The new record
|
||||
*/
|
||||
<R extends UDTRecord<R>> R newRecord(UDT<R> type);
|
||||
|
||||
/**
|
||||
* Create a new {@link Record} that can be inserted into the corresponding
|
||||
* table.
|
||||
|
||||
@ -599,6 +599,20 @@ abstract class AbstractRecord extends AbstractStore<Object> implements Record {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was implemented with [#799]. It may be useful to make it
|
||||
* public for broader use...?
|
||||
*/
|
||||
protected final void from(Record source) {
|
||||
for (Field<?> field : getFields()) {
|
||||
Field<?> sourceField = source.getField(field);
|
||||
|
||||
if (sourceField != null) {
|
||||
Util.setValue(this, field, source, sourceField);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final void into(Object result, java.lang.reflect.Field member, Field<?> field) throws IllegalAccessException {
|
||||
Class<?> mType = member.getType();
|
||||
|
||||
|
||||
@ -97,6 +97,7 @@ import org.jooq.Table;
|
||||
import org.jooq.TableLike;
|
||||
import org.jooq.TableRecord;
|
||||
import org.jooq.Truncate;
|
||||
import org.jooq.UDT;
|
||||
import org.jooq.UDTRecord;
|
||||
import org.jooq.UpdateQuery;
|
||||
import org.jooq.UpdateSetStep;
|
||||
@ -1145,6 +1146,14 @@ public class Factory implements FactoryOperations {
|
||||
// Global Record factory
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public final <R extends UDTRecord<R>> R newRecord(UDT<R> type) {
|
||||
return Util.newRecord(type, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
||||
@ -109,9 +109,12 @@ class UDTConstant<R extends UDTRecord<R>> extends AbstractField<R> {
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
throw new SQLDialectNotSupportedException("UDTs not supported in dialect " + context.getDialect());
|
||||
// Assume default behaviour if dialect is not available
|
||||
default:
|
||||
toSQLInline(context);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void toSQLInline(RenderContext context) {
|
||||
@ -133,8 +136,11 @@ class UDTConstant<R extends UDTRecord<R>> extends AbstractField<R> {
|
||||
case POSTGRES:
|
||||
return "ROW";
|
||||
|
||||
case ORACLE: // No break
|
||||
case DB2: {
|
||||
case ORACLE:
|
||||
case DB2:
|
||||
|
||||
// Assume default behaviour if dialect is not available
|
||||
default: {
|
||||
UDT<?> udt = record.getUDT();
|
||||
|
||||
if (getMappedSchema(context, udt.getSchema()) != null) {
|
||||
@ -145,8 +151,6 @@ class UDTConstant<R extends UDTRecord<R>> extends AbstractField<R> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new SQLDialectNotSupportedException("UDTs not supported in dialect " + context.getDialect());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -44,6 +44,7 @@ import org.jooq.Attachable;
|
||||
import org.jooq.BindContext;
|
||||
import org.jooq.DataType;
|
||||
import org.jooq.Field;
|
||||
import org.jooq.QueryPart;
|
||||
import org.jooq.Record;
|
||||
import org.jooq.RenderContext;
|
||||
import org.jooq.Schema;
|
||||
@ -119,12 +120,12 @@ public class UDTImpl<R extends UDTRecord<R>> extends AbstractType<R> implements
|
||||
|
||||
@Override
|
||||
public final void toSQL(RenderContext context) {
|
||||
throw new UnsupportedOperationException("UDTImpl cannot be used as a true QueryPart");
|
||||
context.literal(getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void bind(BindContext context) {
|
||||
throw new UnsupportedOperationException("UDTImpl cannot be used as a true QueryPart");
|
||||
context.bind((QueryPart) fields);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -57,7 +57,7 @@ import org.jooq.FieldProvider;
|
||||
import org.jooq.NamedQueryPart;
|
||||
import org.jooq.Record;
|
||||
import org.jooq.RenderContext;
|
||||
import org.jooq.Table;
|
||||
import org.jooq.Type;
|
||||
import org.jooq.exception.DataAccessException;
|
||||
import org.jooq.tools.StringUtils;
|
||||
|
||||
@ -106,15 +106,15 @@ final class Util {
|
||||
/**
|
||||
* Create a new record
|
||||
*/
|
||||
static <R extends Record> R newRecord(Table<R> table) {
|
||||
return newRecord(table, null);
|
||||
static <R extends Record> R newRecord(Type<R> type) {
|
||||
return newRecord(type, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new record
|
||||
*/
|
||||
static <R extends Record> R newRecord(Table<R> table, Configuration configuration) {
|
||||
return newRecord(table.getRecordType(), table, configuration);
|
||||
static <R extends Record> R newRecord(Type<R> type, Configuration configuration) {
|
||||
return newRecord(type.getRecordType(), type, configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user