diff --git a/jOOQ-tools/src/org/jooq/xtend/DSLContext.xtend b/jOOQ-tools/src/org/jooq/xtend/DSLContext.xtend index e188e31843..83a8be2f74 100644 --- a/jOOQ-tools/src/org/jooq/xtend/DSLContext.xtend +++ b/jOOQ-tools/src/org/jooq/xtend/DSLContext.xtend @@ -63,12 +63,53 @@ class DSLContext extends Generators { def static void main(String[] args) { val ctx = new DSLContext(); + ctx.generateNewRecord(); ctx.generateSelect(); ctx.generateSelectDistinct(); ctx.generateInsert(); ctx.generateMerge(); } + def generateNewRecord() { + val outImpl = new StringBuilder(); + val outAPI = new StringBuilder(); + + for (degree : (1..Constants::MAX_ROW_DEGREE)) { + var fieldOrRow = "Row" + degree; + + if (degree == 1) { + fieldOrRow = "Field"; + } + + outAPI.append(''' + + /** + * Create a new empty {@link Record}. + *
+ * The resulting record is attached to this {@link Configuration} by
+ * default. Use {@link Settings#isAttachRecords()} to override this
+ * behaviour.
+ *
+ * @return The new record
+ */
+ «generatedMethod»
+ <«TN(degree)»> Record«recTypeSuffix(degree)» newRecord(«Field_TN_fieldn(degree)»);
+ ''');
+
+ outImpl.append('''
+
+ «generatedMethod»
+ @Override
+ public <«TN(degree)»> Record«recTypeSuffix(degree)» newRecord(«Field_TN_fieldn(degree)») {
+ return (Record«recTypeSuffixRaw(degree)») newRecord(new Field[] { «fieldn(degree)» });
+ }
+ ''');
+ }
+
+ insert("org.jooq.DSLContext", outAPI, "newRecord");
+ insert("org.jooq.impl.DefaultDSLContext", outImpl, "newRecord");
+ }
+
def generateSelect() {
val outDSL = new StringBuilder();
val outImpl = new StringBuilder();
diff --git a/jOOQ/src/main/java/org/jooq/DSLContext.java b/jOOQ/src/main/java/org/jooq/DSLContext.java
index d681582b3c..3d5968caa3 100644
--- a/jOOQ/src/main/java/org/jooq/DSLContext.java
+++ b/jOOQ/src/main/java/org/jooq/DSLContext.java
@@ -53,43 +53,43 @@
*/
package org.jooq;
-import static org.jooq.SQLDialect.ASE;
-import static org.jooq.SQLDialect.CUBRID;
-import static org.jooq.SQLDialect.DB2;
-import static org.jooq.SQLDialect.DERBY;
-import static org.jooq.SQLDialect.FIREBIRD;
-import static org.jooq.SQLDialect.H2;
-import static org.jooq.SQLDialect.HSQLDB;
-import static org.jooq.SQLDialect.INGRES;
-import static org.jooq.SQLDialect.MARIADB;
-import static org.jooq.SQLDialect.MYSQL;
-import static org.jooq.SQLDialect.ORACLE;
-import static org.jooq.SQLDialect.POSTGRES;
-import static org.jooq.SQLDialect.SQLITE;
-import static org.jooq.SQLDialect.SQLSERVER;
-import static org.jooq.SQLDialect.SQLSERVER2012;
-import static org.jooq.SQLDialect.SYBASE;
-
-import java.math.BigInteger;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.Statement;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Generated;
-
-import org.jooq.api.annotation.State;
-import org.jooq.api.annotation.Transition;
-import org.jooq.conf.ParamType;
-import org.jooq.conf.Settings;
-import org.jooq.conf.StatementType;
-import org.jooq.exception.DataAccessException;
-import org.jooq.exception.InvalidResultException;
-import org.jooq.exception.MappingException;
-import org.jooq.impl.DSL;
+import static org.jooq.SQLDialect.ASE;
+import static org.jooq.SQLDialect.CUBRID;
+import static org.jooq.SQLDialect.DB2;
+import static org.jooq.SQLDialect.DERBY;
+import static org.jooq.SQLDialect.FIREBIRD;
+import static org.jooq.SQLDialect.H2;
+import static org.jooq.SQLDialect.HSQLDB;
+import static org.jooq.SQLDialect.INGRES;
+import static org.jooq.SQLDialect.MARIADB;
+import static org.jooq.SQLDialect.MYSQL;
+import static org.jooq.SQLDialect.ORACLE;
+import static org.jooq.SQLDialect.POSTGRES;
+import static org.jooq.SQLDialect.SQLITE;
+import static org.jooq.SQLDialect.SQLSERVER;
+import static org.jooq.SQLDialect.SQLSERVER2012;
+import static org.jooq.SQLDialect.SYBASE;
+
+import java.math.BigInteger;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.Generated;
+
+import org.jooq.api.annotation.State;
+import org.jooq.api.annotation.Transition;
+import org.jooq.conf.ParamType;
+import org.jooq.conf.Settings;
+import org.jooq.conf.StatementType;
+import org.jooq.exception.DataAccessException;
+import org.jooq.exception.InvalidResultException;
+import org.jooq.exception.MappingException;
+import org.jooq.impl.DSL;
/**
* A contextual DSL providing "attached" implementations to the
@@ -4633,6 +4633,286 @@ public interface DSLContext {
* @see Record#into(Class)
*/
+ * The resulting record is attached to this {@link Configuration} by
+ * default. Use {@link Settings#isAttachRecords()} to override this
+ * behaviour.
+ *
+ * @param fields The fields defining the
+ * The resulting record is attached to this {@link Configuration} by
+ * default. Use {@link Settings#isAttachRecords()} to override this
+ * behaviour.
+ *
+ * @return The new record
+ */
+ @Generated("This method was generated using jOOQ-tools")
+
+ * The resulting record is attached to this {@link Configuration} by
+ * default. Use {@link Settings#isAttachRecords()} to override this
+ * behaviour.
+ *
+ * @return The new record
+ */
+ @Generated("This method was generated using jOOQ-tools")
+
+ * The resulting record is attached to this {@link Configuration} by
+ * default. Use {@link Settings#isAttachRecords()} to override this
+ * behaviour.
+ *
+ * @return The new record
+ */
+ @Generated("This method was generated using jOOQ-tools")
+
+ * The resulting record is attached to this {@link Configuration} by
+ * default. Use {@link Settings#isAttachRecords()} to override this
+ * behaviour.
+ *
+ * @return The new record
+ */
+ @Generated("This method was generated using jOOQ-tools")
+
+ * The resulting record is attached to this {@link Configuration} by
+ * default. Use {@link Settings#isAttachRecords()} to override this
+ * behaviour.
+ *
+ * @return The new record
+ */
+ @Generated("This method was generated using jOOQ-tools")
+
+ * The resulting record is attached to this {@link Configuration} by
+ * default. Use {@link Settings#isAttachRecords()} to override this
+ * behaviour.
+ *
+ * @return The new record
+ */
+ @Generated("This method was generated using jOOQ-tools")
+
+ * The resulting record is attached to this {@link Configuration} by
+ * default. Use {@link Settings#isAttachRecords()} to override this
+ * behaviour.
+ *
+ * @return The new record
+ */
+ @Generated("This method was generated using jOOQ-tools")
+
+ * The resulting record is attached to this {@link Configuration} by
+ * default. Use {@link Settings#isAttachRecords()} to override this
+ * behaviour.
+ *
+ * @return The new record
+ */
+ @Generated("This method was generated using jOOQ-tools")
+
+ * The resulting record is attached to this {@link Configuration} by
+ * default. Use {@link Settings#isAttachRecords()} to override this
+ * behaviour.
+ *
+ * @return The new record
+ */
+ @Generated("This method was generated using jOOQ-tools")
+
+ * The resulting record is attached to this {@link Configuration} by
+ * default. Use {@link Settings#isAttachRecords()} to override this
+ * behaviour.
+ *
+ * @return The new record
+ */
+ @Generated("This method was generated using jOOQ-tools")
+
+ * The resulting record is attached to this {@link Configuration} by
+ * default. Use {@link Settings#isAttachRecords()} to override this
+ * behaviour.
+ *
+ * @return The new record
+ */
+ @Generated("This method was generated using jOOQ-tools")
+
+ * The resulting record is attached to this {@link Configuration} by
+ * default. Use {@link Settings#isAttachRecords()} to override this
+ * behaviour.
+ *
+ * @return The new record
+ */
+ @Generated("This method was generated using jOOQ-tools")
+
+ * The resulting record is attached to this {@link Configuration} by
+ * default. Use {@link Settings#isAttachRecords()} to override this
+ * behaviour.
+ *
+ * @return The new record
+ */
+ @Generated("This method was generated using jOOQ-tools")
+
+ * The resulting record is attached to this {@link Configuration} by
+ * default. Use {@link Settings#isAttachRecords()} to override this
+ * behaviour.
+ *
+ * @return The new record
+ */
+ @Generated("This method was generated using jOOQ-tools")
+
+ * The resulting record is attached to this {@link Configuration} by
+ * default. Use {@link Settings#isAttachRecords()} to override this
+ * behaviour.
+ *
+ * @return The new record
+ */
+ @Generated("This method was generated using jOOQ-tools")
+
+ * The resulting record is attached to this {@link Configuration} by
+ * default. Use {@link Settings#isAttachRecords()} to override this
+ * behaviour.
+ *
+ * @return The new record
+ */
+ @Generated("This method was generated using jOOQ-tools")
+
+ * The resulting record is attached to this {@link Configuration} by
+ * default. Use {@link Settings#isAttachRecords()} to override this
+ * behaviour.
+ *
+ * @return The new record
+ */
+ @Generated("This method was generated using jOOQ-tools")
+
+ * The resulting record is attached to this {@link Configuration} by
+ * default. Use {@link Settings#isAttachRecords()} to override this
+ * behaviour.
+ *
+ * @return The new record
+ */
+ @Generated("This method was generated using jOOQ-tools")
+
+ * The resulting record is attached to this {@link Configuration} by
+ * default. Use {@link Settings#isAttachRecords()} to override this
+ * behaviour.
+ *
+ * @return The new record
+ */
+ @Generated("This method was generated using jOOQ-tools")
+
+ * The resulting record is attached to this {@link Configuration} by
+ * default. Use {@link Settings#isAttachRecords()} to override this
+ * behaviour.
+ *
+ * @return The new record
+ */
+ @Generated("This method was generated using jOOQ-tools")
+ Record type
+ * @return The new record
+ */
+ Record newRecord(Field>... fields);
+
+ // [jooq-tools] START [newRecord]
+
+ /**
+ * Create a new empty {@link Record}.
+ *