提交 d2353456 authored 作者: Thomas Mueller's avatar Thomas Mueller

Cleanup:

- Rename Declaration and related classes to UpdateColumn etc. 
上级 274f303b
...@@ -32,7 +32,7 @@ public class Query<T> { ...@@ -32,7 +32,7 @@ public class Query<T> {
private Db db; private Db db;
private SelectTable<T> from; private SelectTable<T> from;
private ArrayList<Token> conditions = Utils.newArrayList(); private ArrayList<Token> conditions = Utils.newArrayList();
private ArrayList<Declaration> declarations = Utils.newArrayList(); private ArrayList<UpdateColumn> declarations = Utils.newArrayList();
private ArrayList<SelectTable<?>> joins = Utils.newArrayList(); private ArrayList<SelectTable<?>> joins = Utils.newArrayList();
private final IdentityHashMap<Object, SelectColumn<T>> aliasMap = Utils.newIdentityHashMap(); private final IdentityHashMap<Object, SelectColumn<T>> aliasMap = Utils.newIdentityHashMap();
private ArrayList<OrderExpression<T>> orderByList = Utils.newArrayList(); private ArrayList<OrderExpression<T>> orderByList = Utils.newArrayList();
...@@ -121,14 +121,14 @@ public class Query<T> { ...@@ -121,14 +121,14 @@ public class Query<T> {
return stat.executeUpdate(); return stat.executeUpdate();
} }
public <A> SetColumn<T, A> set(A field) { public <A> UpdateColumnSet<T, A> set(A field) {
int renameSetColumnClassToUpdateSetColumn; int renameSetColumnClassToUpdateSetColumn;
return new SetColumn<T, A>(this, field); return new UpdateColumnSet<T, A>(this, field);
} }
public <A> IncrementColumn<T, A> increment(A field) { public <A> UpdateColumnIncrement<T, A> increment(A field) {
int renameIncrementColumnClassToUpdateIncrementColumn; int renameIncrementColumnClassToUpdateIncrementColumn;
return new IncrementColumn<T, A>(this, field); return new UpdateColumnIncrement<T, A>(this, field);
} }
public int update() { public int update() {
...@@ -140,7 +140,7 @@ public class Query<T> { ...@@ -140,7 +140,7 @@ public class Query<T> {
from.appendSQL(stat); from.appendSQL(stat);
stat.appendSQL(" SET "); stat.appendSQL(" SET ");
int i = 0; int i = 0;
for (Declaration declaration : declarations) { for (UpdateColumn declaration : declarations) {
if (i++ > 0) { if (i++ > 0) {
stat.appendSQL(", "); stat.appendSQL(", ");
} }
...@@ -329,7 +329,7 @@ public class Query<T> { ...@@ -329,7 +329,7 @@ public class Query<T> {
conditions.add(condition); conditions.add(condition);
} }
void addDeclarationToken(Declaration declaration) { void addDeclarationToken(UpdateColumn declaration) {
int todoWhatIsDeclaration; int todoWhatIsDeclaration;
declarations.add(declaration); declarations.add(declaration);
} }
......
...@@ -10,9 +10,7 @@ package org.h2.jaqu; ...@@ -10,9 +10,7 @@ package org.h2.jaqu;
* Classes implementing this interface can be used as a declaration in an * Classes implementing this interface can be used as a declaration in an
* update statement. * update statement.
*/ */
public interface Declaration { public interface UpdateColumn {
final static int renameClassToUpdateDeclaration = 0;
/** /**
* Append the SQL to the given statement using the given query. * Append the SQL to the given statement using the given query.
......
...@@ -7,19 +7,19 @@ ...@@ -7,19 +7,19 @@
package org.h2.jaqu; package org.h2.jaqu;
/** /**
* This class represents "SET column = (column + 1)" in an UPDATE statement. * This class represents "SET column = (column + x)" in an UPDATE statement.
* *
* @param <T> the query type * @param <T> the query type
* @param <A> the new value data type * @param <A> the new value data type
*/ */
//## Java 1.5 begin ## //## Java 1.5 begin ##
public class IncrementColumn<T, A> implements Declaration { public class UpdateColumnIncrement<T, A> implements UpdateColumn {
private Query<T> query; private Query<T> query;
private A x; private A x;
private A y; private A y;
IncrementColumn(Query<T> query, A x) { UpdateColumnIncrement(Query<T> query, A x) {
this.query = query; this.query = query;
this.x = x; this.x = x;
} }
......
...@@ -13,13 +13,13 @@ package org.h2.jaqu; ...@@ -13,13 +13,13 @@ package org.h2.jaqu;
* @param <A> the new value data type * @param <A> the new value data type
*/ */
//## Java 1.5 begin ## //## Java 1.5 begin ##
public class SetColumn<T, A> implements Declaration { public class UpdateColumnSet<T, A> implements UpdateColumn {
private Query<T> query; private Query<T> query;
private A x; private A x;
private A y; private A y;
SetColumn(Query<T> query, A x) { UpdateColumnSet(Query<T> query, A x) {
this.query = query; this.query = query;
this.x = x; this.x = x;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论