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

Small improvements.

上级 523a345d
...@@ -4493,11 +4493,13 @@ public class Parser { ...@@ -4493,11 +4493,13 @@ public class Parser {
return table; return table;
} }
String[] schemaNames = session.getSchemaSearchPath(); String[] schemaNames = session.getSchemaSearchPath();
for (int i = 0; schemaNames != null && i < schemaNames.length; i++) { if (schemaNames != null) {
Schema s = database.getSchema(schemaNames[i]); for (String name : schemaNames) {
table = s.findTableOrView(session, tableName); Schema s = database.getSchema(name);
if (table != null) { table = s.findTableOrView(session, tableName);
return table; if (table != null) {
return table;
}
} }
} }
throw DbException.get(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, tableName); throw DbException.get(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1, tableName);
......
...@@ -220,10 +220,11 @@ public class CreateTable extends SchemaCommand { ...@@ -220,10 +220,11 @@ public class CreateTable extends SchemaCommand {
*/ */
private boolean setPrimaryKeyColumns(IndexColumn[] columns) { private boolean setPrimaryKeyColumns(IndexColumn[] columns) {
if (pkColumns != null) { if (pkColumns != null) {
if (columns.length != pkColumns.length) { int len = columns.length;
if (len != pkColumns.length) {
throw DbException.get(ErrorCode.SECOND_PRIMARY_KEY); throw DbException.get(ErrorCode.SECOND_PRIMARY_KEY);
} }
for (int i = 0; i < columns.length; i++) { for (int i = 0; i < len; i++) {
if (!columns[i].columnName.equals(pkColumns[i].columnName)) { if (!columns[i].columnName.equals(pkColumns[i].columnName)) {
throw DbException.get(ErrorCode.SECOND_PRIMARY_KEY); throw DbException.get(ErrorCode.SECOND_PRIMARY_KEY);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论