Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
333a5027
提交
333a5027
authored
1月 19, 2017
作者:
Noel Grandin
提交者:
GitHub
1月 19, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #436 from alexpaschenko/h2-434
Issue #434 - parse engine params in CREATE TABLE w/o engine specified
上级
f097c7b4
63e0663c
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
19 行增加
和
8 行删除
+19
-8
help.csv
h2/src/docsrc/help/help.csv
+5
-1
Parser.java
h2/src/main/org/h2/command/Parser.java
+7
-7
TestTableEngines.java
h2/src/test/org/h2/test/db/TestTableEngines.java
+7
-0
没有找到文件。
h2/src/docsrc/help/help.csv
浏览文件 @
333a5027
...
@@ -613,7 +613,8 @@ CREATE SEQUENCE SEQ_ID
...
@@ -613,7 +613,8 @@ CREATE SEQUENCE SEQ_ID
CREATE [ CACHED | MEMORY ] [ TEMP | [ GLOBAL | LOCAL ] TEMPORARY ]
CREATE [ CACHED | MEMORY ] [ TEMP | [ GLOBAL | LOCAL ] TEMPORARY ]
TABLE [ IF NOT EXISTS ] name
TABLE [ IF NOT EXISTS ] name
[ ( { columnDefinition | constraint } [,...] ) ]
[ ( { columnDefinition | constraint } [,...] ) ]
[ ENGINE tableEngineName [ WITH tableEngineParamName [,...] ] ]
[ ENGINE tableEngineName ]
[ WITH tableEngineParamName [,...] ]
[ NOT PERSISTENT ] [ TRANSACTIONAL ]
[ NOT PERSISTENT ] [ TRANSACTIONAL ]
[ AS select ]","
[ AS select ]","
Creates a new table.
Creates a new table.
...
@@ -635,6 +636,9 @@ The ENGINE option is only required when custom table implementations are used.
...
@@ -635,6 +636,9 @@ The ENGINE option is only required when custom table implementations are used.
The table engine class must implement the interface ""org.h2.api.TableEngine"".
The table engine class must implement the interface ""org.h2.api.TableEngine"".
Any table engine parameters are passed down in the tableEngineParams field of the CreateTableData object.
Any table engine parameters are passed down in the tableEngineParams field of the CreateTableData object.
Either ENGINE, or WITH (table engine params), or both may be specified. If ENGINE is not specified
in CREATE TABLE, then the engine specified by DEFAULT_TABLE_ENGINE option of database params is used.
Tables with the NOT PERSISTENT modifier are kept fully in memory, and all
Tables with the NOT PERSISTENT modifier are kept fully in memory, and all
rows are lost when the database is closed.
rows are lost when the database is closed.
...
...
h2/src/main/org/h2/command/Parser.java
浏览文件 @
333a5027
...
@@ -6124,15 +6124,15 @@ public class Parser {
...
@@ -6124,15 +6124,15 @@ public class Parser {
}
}
}
else
{
}
else
{
command
.
setTableEngine
(
readUniqueIdentifier
());
command
.
setTableEngine
(
readUniqueIdentifier
());
if
(
readIf
(
"WITH"
))
{
ArrayList
<
String
>
tableEngineParams
=
New
.
arrayList
();
do
{
tableEngineParams
.
add
(
readUniqueIdentifier
());
}
while
(
readIf
(
","
));
command
.
setTableEngineParams
(
tableEngineParams
);
}
}
}
}
}
if
(
readIf
(
"WITH"
))
{
ArrayList
<
String
>
tableEngineParams
=
New
.
arrayList
();
do
{
tableEngineParams
.
add
(
readUniqueIdentifier
());
}
while
(
readIf
(
","
));
command
.
setTableEngineParams
(
tableEngineParams
);
}
// MySQL compatibility
// MySQL compatibility
if
(
readIf
(
"AUTO_INCREMENT"
))
{
if
(
readIf
(
"AUTO_INCREMENT"
))
{
read
(
"="
);
read
(
"="
);
...
...
h2/src/test/org/h2/test/db/TestTableEngines.java
浏览文件 @
333a5027
...
@@ -110,6 +110,13 @@ public class TestTableEngines extends TestBase {
...
@@ -110,6 +110,13 @@ public class TestTableEngines extends TestBase {
EndlessTableEngine
.
createTableData
.
tableEngineParams
.
get
(
0
));
EndlessTableEngine
.
createTableData
.
tableEngineParams
.
get
(
0
));
assertEquals
(
"param2"
,
assertEquals
(
"param2"
,
EndlessTableEngine
.
createTableData
.
tableEngineParams
.
get
(
1
));
EndlessTableEngine
.
createTableData
.
tableEngineParams
.
get
(
1
));
stat
.
execute
(
"CREATE TABLE t2(id int, name varchar) WITH \"param1\", \"param2\""
);
assertEquals
(
2
,
EndlessTableEngine
.
createTableData
.
tableEngineParams
.
size
());
assertEquals
(
"param1"
,
EndlessTableEngine
.
createTableData
.
tableEngineParams
.
get
(
0
));
assertEquals
(
"param2"
,
EndlessTableEngine
.
createTableData
.
tableEngineParams
.
get
(
1
));
conn
.
close
();
conn
.
close
();
if
(!
config
.
memory
)
{
if
(!
config
.
memory
)
{
// Test serialization of table parameters
// Test serialization of table parameters
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论