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

Support a comma before closing a list, as in: create table test(id int,)

上级 50d0f816
......@@ -734,8 +734,7 @@ public class Parser {
do {
String columnName = readColumnIdentifier();
columns.add(columnName);
} while (readIf(","));
read(")");
} while (readIfMore());
String[] cols = new String[columns.size()];
columns.toArray(cols);
return cols;
......@@ -751,13 +750,20 @@ public class Parser {
throw Message.getSQLException(ErrorCode.DUPLICATE_COLUMN_NAME_1, column.getSQL());
}
columns.add(column);
} while (readIf(","));
read(")");
} while (readIfMore());
}
Column[] cols = new Column[columns.size()];
columns.toArray(cols);
return cols;
}
private boolean readIfMore() throws SQLException {
if (readIf(",")) {
return !readIf(")");
}
read(")");
return false;
}
private Prepared parseHelp() throws SQLException {
StringBuffer buff = new StringBuffer("SELECT * FROM INFORMATION_SCHEMA.HELP");
......@@ -803,8 +809,7 @@ public class Parser {
} else {
values.add(readExpression());
}
} while (readIf(","));
read(")");
} while (readIfMore());
}
Expression[] expr = new Expression[values.size()];
values.toArray(expr);
......@@ -841,8 +846,7 @@ public class Parser {
} else {
values.add(readExpression());
}
} while (readIf(","));
read(")");
} while (readIfMore());
}
Expression[] expr = new Expression[values.size()];
values.toArray(expr);
......@@ -4531,8 +4535,7 @@ public class Parser {
command.addConstraintCommand(ref);
}
}
} while (readIf(","));
read(")");
} while (readIfMore());
}
if (readIf("AS")) {
command.setQuery(parseSelect());
......
create view test_view(id,) as select * from dual;
drop view test_view;
create table test(id int,);
insert into test(id,) values(1,);
merge into test(id,) key(id,) values(1,);
drop table test;
SET MODE DB2;
SELECT * FROM SYSTEM_RANGE(1, 100) OFFSET 99 ROWS;
> 100;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论