diff --git a/jOOQ/src/main/java/org/jooq/SQL.java b/jOOQ/src/main/java/org/jooq/SQL.java
new file mode 100644
index 0000000000..0db3a3310a
--- /dev/null
+++ b/jOOQ/src/main/java/org/jooq/SQL.java
@@ -0,0 +1,50 @@
+/**
+ * Copyright (c) 2009-2014, Data Geekery GmbH (http://www.datageekery.com)
+ * All rights reserved.
+ *
+ * This work is dual-licensed
+ * - under the Apache Software License 2.0 (the "ASL")
+ * - under the jOOQ License and Maintenance Agreement (the "jOOQ License")
+ * =============================================================================
+ * You may choose which license applies to you:
+ *
+ * - If you're using this work with Open Source databases, you may choose
+ * either ASL or jOOQ License.
+ * - If you're using this work with at least one commercial database, you must
+ * choose jOOQ License
+ *
+ * For more information, please visit http://www.jooq.org/licenses
+ *
+ * Apache Software License 2.0:
+ * -----------------------------------------------------------------------------
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * jOOQ License and Maintenance Agreement:
+ * -----------------------------------------------------------------------------
+ * Data Geekery grants the Customer the non-exclusive, timely limited and
+ * non-transferable license to install and use the Software under the terms of
+ * the jOOQ License and Maintenance Agreement.
+ *
+ * This library is distributed with a LIMITED WARRANTY. See the jOOQ License
+ * and Maintenance Agreement for more details: http://www.jooq.org/licensing
+ */
+package org.jooq;
+
+/**
+ * A plain SQL {@link QueryPart}.
+ *
+ * @author Lukas Eder
+ */
+public interface SQL extends QueryPart {
+
+}
diff --git a/jOOQ/src/main/java/org/jooq/impl/DSL.java b/jOOQ/src/main/java/org/jooq/impl/DSL.java
index 86bca6f225..754fb1de93 100644
--- a/jOOQ/src/main/java/org/jooq/impl/DSL.java
+++ b/jOOQ/src/main/java/org/jooq/impl/DSL.java
@@ -213,6 +213,7 @@ import org.jooq.Row7;
import org.jooq.Row8;
import org.jooq.Row9;
import org.jooq.RowN;
+import org.jooq.SQL;
import org.jooq.SQLDialect;
import org.jooq.Schema;
import org.jooq.Select;
@@ -5515,16 +5516,67 @@ public class DSL {
// -------------------------------------------------------------------------
/**
- * Create a new {@link org.jooq.Template} that can transform parameter
- * objects into a {@link QueryPart}.
+ * A custom SQL clause that can render arbitrary expressions.
+ *
+ * A plain SQL QueryPart is a QueryPart that can
+ * contain user-defined plain SQL, because sometimes it is easier to express
+ * things directly in SQL.
+ *
+ * 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 input SQL.
- * @return A template that can transform parameter objects into a
- * {@link QueryPart}.
+ * @param sql The SQL
+ * @return A query part wrapping the plain SQL
*/
- @SuppressWarnings("deprecation")
- static org.jooq.Template template(String sql) {
- return new SQLTemplate(sql);
+ @Support
+ public static SQL sql(String sql) {
+ return sql(sql, new Object[0]);
+ }
+
+ /**
+ * A custom SQL clause that can render arbitrary expressions.
+ *
+ * A plain SQL QueryPart is a QueryPart that can
+ * contain user-defined plain SQL, because sometimes it is easier to express
+ * things directly in SQL.
+ *
+ * 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 clause, containing {numbered placeholders} where query
+ * parts can be injected
+ * @param parts The {@link QueryPart} objects that are rendered at the
+ * {numbered placeholder} locations
+ * @return A query part wrapping the plain SQL
+ */
+ @Support
+ public static SQL sql(String sql, QueryPart... parts) {
+ return sql(sql, (Object[]) parts);
+ }
+
+ /**
+ * A custom SQL clause that can render arbitrary expressions.
+ *
+ * A plain SQL QueryPart is a QueryPart that can
+ * contain user-defined plain SQL, because sometimes it is easier to express
+ * things directly in SQL. There must be as many binding variables contained
+ * in the SQL, as passed in the bindings parameter
+ *
+ * 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 query part wrapping the plain SQL
+ */
+ @Support
+ public static SQL sql(String sql, Object... bindings) {
+ return new SQLImpl(sql, bindings);
}
/**
@@ -5544,7 +5596,7 @@ public class DSL {
*/
@Support
public static QueryPart queryPart(String sql) {
- return queryPart(template(sql), new Object[0]);
+ return sql(sql);
}
/**
@@ -5567,7 +5619,7 @@ public class DSL {
*/
@Support
public static QueryPart queryPart(String sql, QueryPart... parts) {
- return queryPart(template(sql), (Object[]) parts);
+ return sql(sql, parts);
}
/**
@@ -5588,22 +5640,9 @@ public class DSL {
*/
@Support
public static QueryPart queryPart(String sql, Object... bindings) {
- return queryPart(template(sql), bindings);
+ return sql(sql, bindings);
}
- /**
- * A custom SQL clause that can render arbitrary expressions from a
- * template.
- *
- * @param template The template generating a delegate query part
- * @param parameters The parameters provided to the template
- * @return A query part wrapping the plain SQL
- */
- @SuppressWarnings("deprecation")
- @Support
- static QueryPart queryPart(org.jooq.Template template, Object... parameters) {
- return template.transform(parameters);
- }
// -------------------------------------------------------------------------
// XXX Plain SQL API
// -------------------------------------------------------------------------
@@ -5871,7 +5910,7 @@ public class DSL {
*/
@Support
public static Table table(String sql, Object... bindings) {
- return table(template(sql), bindings);
+ return new SQLTable(sql(sql, bindings));
}
/**
@@ -5906,21 +5945,7 @@ public class DSL {
*/
@Support
public static Table table(String sql, QueryPart... parts) {
- return table(template(sql), (Object[]) parts);
- }
-
- /**
- * A custom SQL clause that can render arbitrary table expressions from a
- * template.
- *
- * @param template The template generating a delegate query part
- * @param parameters The parameters provided to the template
- * @return A query part wrapping the plain SQL
- */
- @SuppressWarnings("deprecation")
- @Support
- static Table table(org.jooq.Template template, Object... parameters) {
- return new SQLTable(queryPart(template, parameters));
+ return table(sql, (Object[]) parts);
}
/**
@@ -5997,7 +6022,7 @@ public class DSL {
*/
@Support
public static Field