提交 7108c22b authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Remove useless case in CommandRemote and detect internal errors in GeneratedKeysMode

上级 48d40b2f
...@@ -216,9 +216,6 @@ public class CommandRemote implements CommandInterface { ...@@ -216,9 +216,6 @@ public class CommandRemote implements CommandInterface {
int mode = GeneratedKeysMode.valueOf(generatedKeysRequest); int mode = GeneratedKeysMode.valueOf(generatedKeysRequest);
transfer.writeInt(mode); transfer.writeInt(mode);
switch (mode) { switch (mode) {
case GeneratedKeysMode.NONE:
readGeneratedKeys = false;
break;
case GeneratedKeysMode.COLUMN_NUMBERS: { case GeneratedKeysMode.COLUMN_NUMBERS: {
int[] keys = (int[]) generatedKeysRequest; int[] keys = (int[]) generatedKeysRequest;
transfer.writeInt(keys.length); transfer.writeInt(keys.length);
......
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
*/ */
package org.h2.engine; package org.h2.engine;
import org.h2.api.ErrorCode;
import org.h2.message.DbException;
/** /**
* Modes of generated keys' gathering. * Modes of generated keys' gathering.
*/ */
...@@ -54,7 +57,8 @@ public final class GeneratedKeysMode { ...@@ -54,7 +57,8 @@ public final class GeneratedKeysMode {
if (generatedKeysRequest instanceof String[]) { if (generatedKeysRequest instanceof String[]) {
return COLUMN_NAMES; return COLUMN_NAMES;
} }
return NONE; throw DbException.get(ErrorCode.INVALID_VALUE_2,
generatedKeysRequest == null ? "null" : generatedKeysRequest.toString());
} }
private GeneratedKeysMode() { private GeneratedKeysMode() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论