Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
6c4afa7b
提交
6c4afa7b
authored
6月 24, 2013
作者:
noelgrandin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add syntax for passing additional parameters into custom TableEngine implementations
上级
eb6934d0
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
44 行增加
和
1 行删除
+44
-1
help.csv
h2/src/docsrc/help/help.csv
+3
-1
changelog.html
h2/src/docsrc/html/changelog.html
+1
-0
features.html
h2/src/docsrc/html/features.html
+7
-0
Parser.java
h2/src/main/org/h2/command/Parser.java
+7
-0
CreateTable.java
h2/src/main/org/h2/command/ddl/CreateTable.java
+4
-0
CreateTableData.java
h2/src/main/org/h2/command/ddl/CreateTableData.java
+5
-0
TestTableEngines.java
h2/src/test/org/h2/test/db/TestTableEngines.java
+17
-0
没有找到文件。
h2/src/docsrc/help/help.csv
浏览文件 @
6c4afa7b
...
...
@@ -580,7 +580,8 @@ CREATE SEQUENCE SEQ_ID
CREATE [ CACHED | MEMORY ] [ TEMP | [ GLOBAL | LOCAL ] TEMPORARY ]
TABLE [ IF NOT EXISTS ] name
[ ( { columnDefinition | constraint } [,...] ) ]
[ ENGINE tableEngineName ] [ NOT PERSISTENT ] [ TRANSACTIONAL ]
[ ENGINE tableEngineName [ WITH tableEngineParam [,...] ] ]
[ NOT PERSISTENT ] [ TRANSACTIONAL ]
[ AS select ]","
Creates a new table.
...
...
@@ -599,6 +600,7 @@ unless the temporary table is created using CREATE CACHED TABLE.
The ENGINE option is only required when custom table implementations are used.
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.
Tables with the NOT PERSISTENT modifier are kept fully in memory, and all
rows are lost when the database is closed.
...
...
h2/src/docsrc/html/changelog.html
浏览文件 @
6c4afa7b
...
...
@@ -41,6 +41,7 @@ Change Log
</li><li>
Issue 477: PgServer binary transmission of query params is unimplemented, patch from Andrew Franklin
</li><li>
Issue 479: Support for SUBSTRING without a FROM condition, patch from Andrew Franklin
</li><li>
Issue 472: PgServer does not work with any recent Postgres JDBC driver, patch from Andrew Franklin
</li><li>
Add syntax for passing additional parameters into custom TableEngine implementations
</li></ul>
<h2>
Version 1.3.172 (2013-05-25)
</h2>
...
...
h2/src/docsrc/html/features.html
浏览文件 @
6c4afa7b
...
...
@@ -1658,6 +1658,13 @@ and then create the table from SQL like this:
CREATE TABLE TEST(ID INT, NAME VARCHAR) ENGINE "acme.MyTableEngine";
</pre>
</p>
<p>
It is also possible to pass in parameters to the table engine, like so:
<pre>
CREATE TABLE TEST(ID INT, NAME VARCHAR) ENGINE "acme.MyTableEngine" WITH "param1", "param2";
</pre>
In which case the parameters are passed down in the tableEngineParams field of the CreateTableData object.
</p>
<h2
id=
"triggers"
>
Triggers
</h2>
<p>
...
...
h2/src/main/org/h2/command/Parser.java
浏览文件 @
6c4afa7b
...
...
@@ -5369,6 +5369,13 @@ public class Parser {
}
}
else
{
command
.
setTableEngine
(
readUniqueIdentifier
());
if
(
readIf
(
"WITH"
))
{
ArrayList
<
String
>
tableEngineParams
=
New
.
arrayList
();
do
{
tableEngineParams
.
add
(
readUniqueIdentifier
());
}
while
(
readIf
(
","
));
command
.
setTableEngineParams
(
tableEngineParams
);
}
}
}
else
if
(
database
.
getSettings
().
defaultTableEngine
!=
null
)
{
command
.
setTableEngine
(
database
.
getSettings
().
defaultTableEngine
);
...
...
h2/src/main/org/h2/command/ddl/CreateTable.java
浏览文件 @
6c4afa7b
...
...
@@ -289,6 +289,10 @@ public class CreateTable extends SchemaCommand {
data
.
tableEngine
=
tableEngine
;
}
public
void
setTableEngineParams
(
ArrayList
<
String
>
tableEngineParams
)
{
data
.
tableEngineParams
=
tableEngineParams
;
}
public
void
setHidden
(
boolean
isHidden
)
{
data
.
isHidden
=
isHidden
;
}
...
...
h2/src/main/org/h2/command/ddl/CreateTableData.java
浏览文件 @
6c4afa7b
...
...
@@ -72,6 +72,11 @@ public class CreateTableData {
*/
public
String
tableEngine
;
/**
* The table engine params to use for creating the table.
*/
public
ArrayList
<
String
>
tableEngineParams
;
/**
* The table is hidden.
*/
...
...
h2/src/test/org/h2/test/db/TestTableEngines.java
浏览文件 @
6c4afa7b
...
...
@@ -55,6 +55,7 @@ public class TestTableEngines extends TestBase {
return
;
}
testEarlyFilter
();
testEngineParams
();
testSimpleQuery
();
}
...
...
@@ -71,6 +72,19 @@ public class TestTableEngines extends TestBase {
deleteDb
(
"tableEngine"
);
}
private
void
testEngineParams
()
throws
SQLException
{
deleteDb
(
"tableEngine"
);
Connection
conn
=
getConnection
(
"tableEngine"
);
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"CREATE TABLE t1(id int, name varchar) ENGINE \""
+
EndlessTableEngine
.
class
.
getName
()
+
"\" 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
();
deleteDb
(
"tableEngine"
);
}
private
void
testSimpleQuery
()
throws
SQLException
{
deleteDb
(
"tableEngine"
);
...
...
@@ -352,6 +366,8 @@ public class TestTableEngines extends TestBase {
*/
public
static
class
EndlessTableEngine
implements
TableEngine
{
public
static
CreateTableData
createTableData
;
/**
* A table implementation with one row.
*/
...
...
@@ -407,6 +423,7 @@ public class TestTableEngines extends TestBase {
*/
@Override
public
EndlessTable
createTable
(
CreateTableData
data
)
{
createTableData
=
data
;
return
new
EndlessTable
(
data
);
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论