提交 74a0a0cc authored 作者: noelgrandin's avatar noelgrandin

add some documentation for the TableEngine feature

上级 8b529da5
...@@ -73,6 +73,8 @@ Features ...@@ -73,6 +73,8 @@ Features
Multi-Dimensional Indexes</a><br /> Multi-Dimensional Indexes</a><br />
<a href="#user_defined_functions"> <a href="#user_defined_functions">
User-Defined Functions and Stored Procedures</a><br /> User-Defined Functions and Stored Procedures</a><br />
<a href="#pluggable_tables">
Pluggable or User-Defined Tables</a><br />
<a href="#triggers"> <a href="#triggers">
Triggers</a><br /> Triggers</a><br />
<a href="#compacting"> <a href="#compacting">
...@@ -1623,6 +1625,34 @@ SELECT * FROM MATRIX(4) ORDER BY X, Y; ...@@ -1623,6 +1625,34 @@ SELECT * FROM MATRIX(4) ORDER BY X, Y;
</pre> </pre>
<h2 id="pluggable_tables">Pluggable or User-Defined Tables</h2>
<p>
For situations where you need to expose other data-sources to the SQL engine as a table,
there are "pluggable tables".
For some examples, have a look at the code in <code>org.h2.test.db.TestTableEngines</code>.
</p>
<p>
In order to create your own TableEngine, you need to implement the <code>org.h2.api.TableEngine</code> interface e.g.
something like this:
<pre>
package acme;
public static class MyTableEngine implements org.h2.api.TableEngine {
private static class MyTable extends org.h2.table.TableBase {
.. rather a lot of code here...
}
public EndlessTable createTable(CreateTableData data) {
return new EndlessTable(data);
}
}
</pre>
and then create the table from SQL like this:
<pre>
CREATE TABLE mytable(id int, name varchar) ENGINE "acme.MyTableEngine";
</pre>
</p>
<h2 id="triggers">Triggers</h2> <h2 id="triggers">Triggers</h2>
<p> <p>
This database supports Java triggers that are called before or after a row is updated, inserted or deleted. This database supports Java triggers that are called before or after a row is updated, inserted or deleted.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论