diff options
Diffstat (limited to 'src/main/java/com/iciql/UpdateColumnSet.java')
-rw-r--r-- | src/main/java/com/iciql/UpdateColumnSet.java | 70 |
1 files changed, 34 insertions, 36 deletions
diff --git a/src/main/java/com/iciql/UpdateColumnSet.java b/src/main/java/com/iciql/UpdateColumnSet.java index a961480..7ae74a0 100644 --- a/src/main/java/com/iciql/UpdateColumnSet.java +++ b/src/main/java/com/iciql/UpdateColumnSet.java @@ -19,45 +19,43 @@ package com.iciql; /** * This class represents "SET column = value" in an UPDATE statement. - * - * @param <T> - * the query type - * @param <A> - * the new value data type + * + * @param <T> the query type + * @param <A> the new value data type */ public class UpdateColumnSet<T, A> implements UpdateColumn { - private Query<T> query; - private A x; - private A y; - private boolean isParameter; - - UpdateColumnSet(Query<T> query, A x) { - this.query = query; - this.x = x; - } - - public Query<T> to(A y) { - query.addUpdateColumnDeclaration(this); - this.y = y; - return query; - } - - public Query<T> toParameter() { - query.addUpdateColumnDeclaration(this); - isParameter = true; - return query; - } - - public void appendSQL(SQLStatement stat) { - query.appendSQL(stat, null, x); - stat.appendSQL(" = "); - if (isParameter) { - query.appendSQL(stat, x, RuntimeParameter.PARAMETER); - } else { - query.appendSQL(stat, x, y); - } - } + private Query<T> query; + private A x; + private A y; + private boolean isParameter; + + UpdateColumnSet(Query<T> query, A x) { + this.query = query; + this.x = x; + } + + public Query<T> to(A y) { + query.addUpdateColumnDeclaration(this); + this.y = y; + return query; + } + + public Query<T> toParameter() { + query.addUpdateColumnDeclaration(this); + isParameter = true; + return query; + } + + public void appendSQL(SQLStatement stat) { + query.appendSQL(stat, null, x); + stat.appendSQL(" = "); + if (isParameter) { + query.appendSQL(stat, x, RuntimeParameter.PARAMETER); + } else { + query.appendSQL(stat, x, y); + } + } } |