提交 854bc905 authored 作者: Thomas Mueller's avatar Thomas Mueller

Rename "updateOrInsert" back to "update", because it could also be "delete", or…

Rename "updateOrInsert" back to "update", because it could also be "delete", or changing a setting, or running system command. "update" and "query" are the same terms used as in "Statement.executeUpdate" and "Statement.executeQuery".
上级 27df6632
...@@ -92,12 +92,13 @@ public abstract class Command implements CommandInterface { ...@@ -92,12 +92,13 @@ public abstract class Command implements CommandInterface {
public abstract ResultInterface queryMeta(); public abstract ResultInterface queryMeta();
/** /**
* Execute an updating statement, if this is possible. * Execute an updating statement (for example an insert, a delete, or an update),
* if this is possible.
* *
* @return the update count * @return the update count
* @throws DbException if the command is not an updating statement * @throws DbException if the command is not an updating statement
*/ */
public int updateOrInsert() { public int update() {
throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_QUERY); throw DbException.get(ErrorCode.METHOD_NOT_ALLOWED_FOR_QUERY);
} }
...@@ -250,7 +251,7 @@ public abstract class Command implements CommandInterface { ...@@ -250,7 +251,7 @@ public abstract class Command implements CommandInterface {
while (true) { while (true) {
database.checkPowerOff(); database.checkPowerOff();
try { try {
return updateOrInsert(); return update();
} catch (DbException e) { } catch (DbException e) {
start = filterConcurrentUpdate(e, start); start = filterConcurrentUpdate(e, start);
} catch (OutOfMemoryError e) { } catch (OutOfMemoryError e) {
......
...@@ -69,7 +69,7 @@ class CommandContainer extends Command { ...@@ -69,7 +69,7 @@ class CommandContainer extends Command {
} }
@Override @Override
public int updateOrInsert() { public int update() {
recompileIfRequired(); recompileIfRequired();
setProgress(DatabaseEventListener.STATE_STATEMENT_START); setProgress(DatabaseEventListener.STATE_STATEMENT_START);
start(); start();
......
...@@ -33,12 +33,12 @@ class CommandList extends Command { ...@@ -33,12 +33,12 @@ class CommandList extends Command {
if (remainingCommand.isQuery()) { if (remainingCommand.isQuery()) {
remainingCommand.query(0); remainingCommand.query(0);
} else { } else {
remainingCommand.updateOrInsert(); remainingCommand.update();
} }
} }
@Override @Override
public int updateOrInsert() { public int update() {
int updateCount = command.executeUpdate(); int updateCount = command.executeUpdate();
executeRemaining(); executeRemaining();
return updateCount; return updateCount;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论