提交 2d649ea2 authored 作者: noelgrandin@gmail.com's avatar noelgrandin@gmail.com

Fix "USE schema" command for MySQL compatibility, patch by mfulton

上级 0c05828b
...@@ -38,6 +38,7 @@ Change Log ...@@ -38,6 +38,7 @@ Change Log
</li><li>Fix bug which could generate deadlocks when multiple connections accessed the same table. </li><li>Fix bug which could generate deadlocks when multiple connections accessed the same table.
</li><li>Some places in the code were not respecting the value set in the "SET MAX_MEMORY_ROWS x" command </li><li>Some places in the code were not respecting the value set in the "SET MAX_MEMORY_ROWS x" command
</li><li>Fix bug which could generate a NegativeArraySizeException when performing large (>40M) row union operations </li><li>Fix bug which could generate a NegativeArraySizeException when performing large (>40M) row union operations
</li><li>Fix "USE schema" command for MySQL compatibility, patch by mfulton
</li></ul> </li></ul>
<h2>Version 1.4.182 Beta (2014-10-17)</h2> <h2>Version 1.4.182 Beta (2014-10-17)</h2>
......
...@@ -5083,13 +5083,10 @@ public class Parser { ...@@ -5083,13 +5083,10 @@ public class Parser {
} }
private Prepared parseUse() { private Prepared parseUse() {
if (readIf("SCHEMA")) { readIfEqualOrTo();
readIfEqualOrTo(); Set command = new Set(session, SetTypes.SCHEMA);
Set command = new Set(session, SetTypes.SCHEMA); command.setString(readAliasIdentifier());
command.setString(readAliasIdentifier()); return command;
return command;
}
throw getSyntaxError();
} }
private Set parseSetCollation() { private Set parseSetCollation() {
......
...@@ -231,12 +231,10 @@ public class TestCompatibility extends TestBase { ...@@ -231,12 +231,10 @@ public class TestCompatibility extends TestBase {
private void testMySQL() throws SQLException { private void testMySQL() throws SQLException {
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
stat.execute("create schema test_schema"); stat.execute("create schema test_schema");
stat.execute("use schema test_schema"); stat.execute("use test_schema");
assertResult("TEST_SCHEMA", stat, assertResult("TEST_SCHEMA", stat, "select schema()");
"select schema()"); stat.execute("use public");
stat.execute("use schema public"); assertResult("PUBLIC", stat, "select schema()");
assertResult("PUBLIC", stat,
"select schema()");
stat.execute("SELECT 1"); stat.execute("SELECT 1");
stat.execute("DROP TABLE IF EXISTS TEST"); stat.execute("DROP TABLE IF EXISTS TEST");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论