提交 ebbc8943 authored 作者: noelgrandin's avatar noelgrandin

Issue 474: H2 Mysql Compatibility code fails to ignore "COMMENT" in CREATE…

Issue 474: H2 Mysql Compatibility code fails to ignore "COMMENT" in CREATE TABLE, patch from Aaron Azeckoski
上级 04b35a38
......@@ -29,6 +29,7 @@ Change Log
</li><li>Fixed a deadlock when updating LOB's concurrently. See TestLob.testDeadlock2().
</li><li>Fixed a deadlock related to very large temporary result sets.
</li><li>Add "-list" command line option to Shell tool so that result-list-mode can be triggered when reading from a file
</li><li>Issue 474: H2 Mysql Compatibility code fails to ignore "COMMENT" in CREATE TABLE, patch from Aaron Azeckoski
</li></ul>
<h2>Version 1.3.172 (2013-05-25)</h2>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -5332,6 +5332,13 @@ public class Parser {
} while (readIfMore());
}
}
// Allows "COMMENT='comment'" in DDL statements (MySQL syntax)
if (readIf("COMMENT")) {
if (readIf("=")) {
// read the complete string comment, but nothing with it for now
readString();
}
}
if (readIf("ENGINE")) {
if (readIf("=")) {
// map MySQL engine types onto H2 behavior
......
......@@ -262,6 +262,25 @@ public class TestCompatibility extends TestBase {
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");
// Check if mysql comments are supported, ensure clean connection
conn.close();
conn = getConnection("compatibility;MODE=MYSQL");
stat = conn.createStatement();
stat.execute("DROP TABLE IF EXISTS TEST_NO_COMMENT");
stat.execute("CREATE table TEST_NO_COMMENT (ID bigint not null auto_increment, " +
"SOME_STR varchar(255), primary key (ID))");
// now test creating a table with a comment
stat.execute("DROP TABLE IF EXISTS TEST_COMMENT");
stat.execute("create table TEST_COMMENT (ID bigint not null auto_increment, " +
"SOME_STR varchar(255), primary key (ID)) comment='Some comment.'");
/* now test creating a table with a comment and engine
* and other typical mysql stuff as generated by hibernate
*/
stat.execute("DROP TABLE IF EXISTS TEST_COMMENT_ENGINE");
stat.execute("create table TEST_COMMENT_ENGINE (ID bigint not null auto_increment, " +
"ATTACHMENT_ID varchar(255), SOME_ITEM_ID bigint not null, primary key (ID), " +
"unique (ATTACHMENT_ID, SOME_ITEM_ID)) comment='Comment Again' ENGINE=InnoDB");
conn.close();
conn = getConnection("compatibility");
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论