From 990b5c683b4e1185928efc09a30268d70479625e Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Tue, 6 May 2014 16:55:18 +0200 Subject: [PATCH] [#3240] Add DSL.sequence() methods for plain SQL sequence construction --- jOOQ/src/main/java/org/jooq/impl/DSL.java | 50 +++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/jOOQ/src/main/java/org/jooq/impl/DSL.java b/jOOQ/src/main/java/org/jooq/impl/DSL.java index 5d06a0fbd3..3a307c4e32 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DSL.java +++ b/jOOQ/src/main/java/org/jooq/impl/DSL.java @@ -5424,6 +5424,56 @@ public class DSL { return new SQLTable(queryPart(template, parameters)); } + /** + * Create a "plain SQL" sequence. + *

+ * NOTE: When inserting plain SQL into jOOQ objects, you must + * guarantee syntax integrity. You may also create the possibility of + * malicious SQL injection. Be sure to properly use bind variables and/or + * escape literals when concatenated into SQL clauses! + * + * @param sql The SQL + * @return A field wrapping the plain SQL + */ + @Support + public static Sequence sequence(String sql) { + return sequence(sql, BigInteger.class); + } + + /** + * Create a "plain SQL" sequence. + *

+ * NOTE: When inserting plain SQL into jOOQ objects, you must + * guarantee syntax integrity. You may also create the possibility of + * malicious SQL injection. Be sure to properly use bind variables and/or + * escape literals when concatenated into SQL clauses! + * + * @param sql The SQL + * @param type The field type + * @return A field wrapping the plain SQL + */ + @Support + public static Sequence sequence(String sql, Class type) { + return sequence(sql, getDataType(type)); + } + + /** + * Create a "plain SQL" sequence. + *

+ * NOTE: When inserting plain SQL into jOOQ objects, you must + * guarantee syntax integrity. You may also create the possibility of + * malicious SQL injection. Be sure to properly use bind variables and/or + * escape literals when concatenated into SQL clauses! + * + * @param sql The SQL + * @param type The field type + * @return A field wrapping the plain SQL + */ + @Support + public static Sequence sequence(String sql, DataType type) { + return new SequenceImpl(sql, null, type); + } + /** * Create a "plain SQL" field. *