提交 0633bbc8 authored 作者: Thomas Mueller's avatar Thomas Mueller

Improved MySQL compatibility by supporting "use schema". Thanks a lot to Karl…

Improved MySQL compatibility by supporting "use schema". Thanks a lot to Karl Pietrzak for the patch!
上级 67fa44ed
......@@ -17,7 +17,9 @@ Change Log
<h1>Change Log</h1>
<h2>Next Version (unreleased)</h2>
<ul><li>Writing to the trace file is now faster, specially with the debug level.
<ul><li>Improved MySQL compatibility by supporting "use schema".
Thanks a lot to Karl Pietrzak for the patch!
</li><li>Writing to the trace file is now faster, specially with the debug level.
</li><li>The database option "defrag_always=true" did not work with the MVStore.
</li><li>The JDBC escape syntax {ts 'value'} did not interpret the value as a timestamp.
The same for {d 'value'} (for date) and {t 'value'} (for time).
......
......@@ -453,6 +453,8 @@ public class Parser {
case 'U':
if (readIf("UPDATE")) {
c = parseUpdate();
} else if (readIf("USE")) {
c = parseUse();
}
break;
case 'v':
......@@ -5065,6 +5067,16 @@ public class Parser {
}
}
private Prepared parseUse() {
if (readIf("SCHEMA")) {
readIfEqualOrTo();
Set command = new Set(session, SetTypes.SCHEMA);
command.setString(readAliasIdentifier());
return command;
}
throw getSyntaxError();
}
private Set parseSetCollation() {
Set command = new Set(session, SetTypes.COLLATION);
String name = readAliasIdentifier();
......
......@@ -230,6 +230,14 @@ public class TestCompatibility extends TestBase {
private void testMySQL() throws SQLException {
Statement stat = conn.createStatement();
stat.execute("create schema test_schema");
stat.execute("use schema test_schema");
assertResult("TEST_SCHEMA", stat,
"select schema()");
stat.execute("use schema public");
assertResult("PUBLIC", stat,
"select schema()");
stat.execute("SELECT 1");
stat.execute("DROP TABLE IF EXISTS TEST");
stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR)");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论