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

The wrong exception was thrown when using unquoted text for COMMENT, ALTER USER, and SET PASSWORD.

上级 455544f2
...@@ -81,11 +81,11 @@ public class AlterUser extends DefineCommand { ...@@ -81,11 +81,11 @@ public class AlterUser extends DefineCommand {
} }
private char[] getCharArray(Expression e) throws SQLException { private char[] getCharArray(Expression e) throws SQLException {
return e.getValue(session).getString().toCharArray(); return e.optimize(session).getValue(session).getString().toCharArray();
} }
private byte[] getByteArray(Expression e) throws SQLException { private byte[] getByteArray(Expression e) throws SQLException {
return ByteUtils.convertStringToBytes(e.getValue(session).getString()); return ByteUtils.convertStringToBytes(e.optimize(session).getValue(session).getString());
} }
public int update() throws SQLException { public int update() throws SQLException {
......
...@@ -52,7 +52,7 @@ public class CreateUser extends DefineCommand { ...@@ -52,7 +52,7 @@ public class CreateUser extends DefineCommand {
} }
private byte[] getByteArray(Expression e) throws SQLException { private byte[] getByteArray(Expression e) throws SQLException {
return ByteUtils.convertStringToBytes(e.getValue(session).getString()); return ByteUtils.convertStringToBytes(e.optimize(session).getValue(session).getString());
} }
public int update() throws SQLException { public int update() throws SQLException {
......
...@@ -91,7 +91,7 @@ public class SetComment extends DefineCommand { ...@@ -91,7 +91,7 @@ public class SetComment extends DefineCommand {
if (object == null) { if (object == null) {
throw Message.getSQLException(errorCode, objectName); throw Message.getSQLException(errorCode, objectName);
} }
String text = expr.getValue(session).getString(); String text = expr.optimize(session).getValue(session).getString();
if (column) { if (column) {
Table table = (Table) object; Table table = (Table) object;
table.getColumn(columnName).setComment(text); table.getColumn(columnName).setComment(text);
......
...@@ -2,6 +2,15 @@ ...@@ -2,6 +2,15 @@
create table test(id identity); create table test(id identity);
> ok > ok
set password test;
> exception
alter user sa set password test;
> exception
comment on table test is test;
> exception
select 1 from test a where 1 in(select 1 from test b where b.id in(select 1 from test c where c.id=a.id)); select 1 from test a where 1 in(select 1 from test b where b.id in(select 1 from test c where c.id=a.id));
> 1 > 1
> - > -
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论