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

Issue 431: Improved compatibility with MySQL: support for "ENGINE=InnoDB…

Issue 431: Improved compatibility with MySQL: support for "ENGINE=InnoDB charset=UTF8" when creating a table.
上级 d61ad865
......@@ -18,7 +18,9 @@ Change Log
<h1>Change Log</h1>
<h2>Next Version (unreleased)</h2>
<ul><li>Issue 249: Improved compatiblity with MySQL in the MySQL mode:
<ul><li>Issue 431: Improved compatibility with MySQL: support for
"ENGINE=InnoDB charset=UTF8" when creating a table.
</li><li>Issue 249: Improved compatiblity with MySQL in the MySQL mode:
now the methods DatabaseMetaData methods stores*Case*Identifiers return the same as MySQL
when using the MySQL mode.
</li><li>Issue 434: H2 Console didn't work in the Chrome browser
......
......@@ -5291,10 +5291,24 @@ public class Parser {
}
}
if (readIf("ENGINE")) {
command.setTableEngine(readUniqueIdentifier());
if (readIf("=")) {
// map MySQL engine types onto H2 behavior
String tableEngine = readUniqueIdentifier();
if ("InnoDb".equalsIgnoreCase(tableEngine)) {
// ok
} else if (!"MyISAM".equalsIgnoreCase(tableEngine)) {
throw DbException.get(ErrorCode.FEATURE_NOT_SUPPORTED_1, tableEngine);
}
} else {
command.setTableEngine(readUniqueIdentifier());
}
} else if (database.getSettings().defaultTableEngine != null) {
command.setTableEngine(database.getSettings().defaultTableEngine);
}
if (readIf("CHARSET")) {
read("=");
read("UTF8");
}
if (temp) {
if (readIf("ON")) {
read("COMMIT");
......
......@@ -252,6 +252,11 @@ public class TestCompatibility extends TestBase {
rs.updateString(2, "Hallo");
rs.updateRow();
stat.execute("CREATE TABLE TEST_1(ID INT PRIMARY KEY) ENGINE=InnoDb");
stat.execute("CREATE TABLE TEST_2(ID INT PRIMARY KEY) ENGINE=MyISAM");
stat.execute("CREATE TABLE TEST_3(ID INT PRIMARY KEY) ENGINE=InnoDb charset=UTF8");
stat.execute("CREATE TABLE TEST_4(ID INT PRIMARY KEY) charset=UTF8");
conn.close();
conn = getConnection("compatibility");
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论