提交 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 {
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
* @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);
}
......@@ -250,7 +251,7 @@ public abstract class Command implements CommandInterface {
while (true) {
database.checkPowerOff();
try {
return updateOrInsert();
return update();
} catch (DbException e) {
start = filterConcurrentUpdate(e, start);
} catch (OutOfMemoryError e) {
......
......@@ -69,7 +69,7 @@ class CommandContainer extends Command {
}
@Override
public int updateOrInsert() {
public int update() {
recompileIfRequired();
setProgress(DatabaseEventListener.STATE_STATEMENT_START);
start();
......
......@@ -33,12 +33,12 @@ class CommandList extends Command {
if (remainingCommand.isQuery()) {
remainingCommand.query(0);
} else {
remainingCommand.updateOrInsert();
remainingCommand.update();
}
}
@Override
public int updateOrInsert() {
public int update() {
int updateCount = command.executeUpdate();
executeRemaining();
return updateCount;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论