diff --git a/jOOQ/src/main/java/org/jooq/impl/DSL.java b/jOOQ/src/main/java/org/jooq/impl/DSL.java
index 4970035387..7bad603f4b 100644
--- a/jOOQ/src/main/java/org/jooq/impl/DSL.java
+++ b/jOOQ/src/main/java/org/jooq/impl/DSL.java
@@ -5060,6 +5060,28 @@ public class DSL {
return new SchemaImpl(name);
}
+ /**
+ * Create a qualified schema, given its schema name.
+ *
+ * This constructs a schema reference given the schema's qualified name.
+ * jOOQ will render the schema name according to your
+ * {@link Settings#getRenderNameStyle()} settings. Choose
+ * {@link RenderNameStyle#QUOTED} to prevent syntax errors and/or SQL
+ * injection.
+ *
+ * Example:
+ * // This schema...
+ * schema(name("MY_SCHEMA"));
+ *
+ * // ... will render this SQL on SQL Server with RenderNameStyle.QUOTED set
+ * [MY_SCHEMA]
+ *
+ */
+ @Support
+ public static Schema schema(Name name) {
+ return new SchemaImpl(name);
+ }
+
/**
* Create a qualified sequence, given its sequence name.
*
@@ -5149,6 +5171,81 @@ public class DSL {
return new SequenceImpl(name, schema, type);
}
+ /**
+ * Create a qualified sequence, given its sequence name.
+ *
+ * This constructs a sequence reference given the sequence's qualified name.
+ * jOOQ will render the sequence name according to your
+ * {@link Settings#getRenderNameStyle()} settings. Choose
+ * {@link RenderNameStyle#QUOTED} to prevent syntax errors and/or SQL
+ * injection.
+ *
+ * Example:
+ * // This sequence...
+ * sequence(name("MY_SCHEMA", "MY_SEQUENCE"));
+ *
+ * // ... will render this SQL on SQL Server with RenderNameStyle.QUOTED set
+ * [MY_SCHEMA].[MY_SEQUENCE]
+ *
+ */
+ @Support
+ public static Sequence sequence(Name name) {
+ return sequence(name, BigInteger.class);
+ }
+
+ /**
+ * Create a qualified sequence, given its sequence name.
+ *
+ * This constructs a sequence reference given the sequence's qualified name.
+ * jOOQ will render the sequence name according to your
+ * {@link Settings#getRenderNameStyle()} settings. Choose
+ * {@link RenderNameStyle#QUOTED} to prevent syntax errors and/or SQL
+ * injection.
+ *
+ * Example:
+ * // This sequence...
+ * sequence(name("MY_SCHEMA", "MY_SEQUENCE"));
+ *
+ * // ... will render this SQL on SQL Server with RenderNameStyle.QUOTED set
+ * [MY_SCHEMA].[MY_SEQUENCE]
+ *
+ */
+ @Support
+ public static Sequence sequence(Name name, Class type) {
+ return sequence(name, getDataType(type));
+ }
+
+ /**
+ * Create a qualified sequence, given its sequence name.
+ *
+ * This constructs a sequence reference given the sequence's qualified name.
+ * jOOQ will render the sequence name according to your
+ * {@link Settings#getRenderNameStyle()} settings. Choose
+ * {@link RenderNameStyle#QUOTED} to prevent syntax errors and/or SQL
+ * injection.
+ *
+ * Example:
+ * // This sequence...
+ * sequence(name("MY_SCHEMA", "MY_SEQUENCE"));
+ *
+ * // ... will render this SQL on SQL Server with RenderNameStyle.QUOTED set
+ * [MY_SCHEMA].[MY_SEQUENCE]
+ *
+ */
+ @Support
+ public static Sequence sequence(Name name, DataType type) {
+ if (name == null)
+ throw new NullPointerException();
+
+ if (name.getName().length < 1 || name.getName().length > 2)
+ throw new IllegalArgumentException("Must provide a qualified name of length 1 or 2 : " + name);
+
+ String n = name.getName()[name.getName().length - 1];
+ Schema s = name.getName().length == 2 ? schema(name(name.getName()[0])) : null;
+
+ return new SequenceImpl(n, s, type);
+ }
+
/**
* Create a qualified table, given its table name.
*
@@ -5172,7 +5269,29 @@ public class DSL {
*/
@Support
public static Table tableByName(String... qualifiedName) {
- return new QualifiedTable(qualifiedName);
+ return table(name(qualifiedName));
+ }
+
+ /**
+ * Create a qualified table, given its table name.
+ *
+ * This constructs a table reference given the table's qualified name. jOOQ
+ * will render the table name according to your
+ * {@link Settings#getRenderNameStyle()} settings. Choose
+ * {@link RenderNameStyle#QUOTED} to prevent syntax errors and/or SQL
+ * injection.
+ *
+ * Example:
+ * // This table...
+ * tableByName("MY_SCHEMA", "MY_TABLE");
+ *
+ * // ... will render this SQL on SQL Server with RenderNameStyle.QUOTED set
+ * [MY_SCHEMA].[MY_TABLE]
+ *
+ */
+ @Support
+ public static Table table(Name name) {
+ return new QualifiedTable(name);
}
/**
@@ -5279,7 +5398,100 @@ public class DSL {
*/
@Support
public static Field fieldByName(DataType type, String... qualifiedName) {
- return new QualifiedField(type, qualifiedName);
+ return field(name(qualifiedName), type);
+ }
+
+ /**
+ * Create a qualified field, given its (qualified) field name.
+ *
+ * This constructs a field reference given the field's qualified name. jOOQ
+ * will render the field name according to your
+ * {@link Settings#getRenderNameStyle()} settings. Choose
+ * {@link RenderNameStyle#QUOTED} to prevent syntax errors and/or SQL
+ * injection.
+ *
+ * Example:
+ * // This field...
+ * field(name("MY_SCHEMA", "MY_TABLE", "MY_FIELD"));
+ *
+ * // ... will render this SQL on SQL Server with RenderNameStyle.QUOTED set
+ * [MY_SCHEMA].[MY_TABLE].[MY_FIELD]
+ *
+ *
+ * Another example:
+ * create.select(field("length({1})", Integer.class, field(name("TITLE"))))
+ * .from(table(name("T_BOOK")))
+ * .fetch();
+ *
+ * // ... will execute this SQL on SQL Server:
+ * select length([TITLE]) from [T_BOOK]
+ *