Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
f385a38c
提交
f385a38c
authored
12月 03, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
825fd604
显示空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
152 行增加
和
40 行删除
+152
-40
advanced.html
h2/src/docsrc/html/advanced.html
+1
-1
changelog.html
h2/src/docsrc/html/changelog.html
+8
-6
fragments.html
h2/src/docsrc/html/fragments.html
+1
-0
history.html
h2/src/docsrc/html/history.html
+6
-6
links.html
h2/src/docsrc/html/links.html
+2
-2
tutorial.html
h2/src/docsrc/html/tutorial.html
+59
-23
JdbcConnection.java
h2/src/main/org/h2/jdbc/JdbcConnection.java
+4
-0
TestBase.java
h2/src/test/org/h2/test/TestBase.java
+6
-0
TestFunctions.java
h2/src/test/org/h2/test/db/TestFunctions.java
+2
-1
TestLob.java
h2/src/test/org/h2/test/db/TestLob.java
+29
-0
TestTriggersConstraints.java
h2/src/test/org/h2/test/db/TestTriggersConstraints.java
+1
-1
test-1.2.txt
h2/src/test/org/h2/test/test-1.2.txt
+32
-0
dictionary.txt
h2/src/tools/org/h2/build/doc/dictionary.txt
+1
-0
没有找到文件。
h2/src/docsrc/html/advanced.html
浏览文件 @
f385a38c
h2/src/docsrc/html/changelog.html
浏览文件 @
f385a38c
...
...
@@ -18,7 +18,9 @@ Change Log
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
Trying to alter a temporary table threw a strange exception.
<ul><li>
Right outer joins on tables that were already 'inner joined' was processed incorrectly.
</li><li>
Temporary files from LOB objects were not deleted early enough when using the server mode.
</li><li>
Trying to alter a temporary table threw a strange exception.
It is still not possible to do that, but the exception message is better now.
</li><li>
When the system property h2.maxMemoryRowsDistinct was set, and
using SELECT DISTINCT, the temporary table was not correctly dropped.
...
...
h2/src/docsrc/html/fragments.html
浏览文件 @
f385a38c
...
...
@@ -78,6 +78,7 @@ translate -->
<a
href=
"sourceError.html"
>
Error Analyzer
</a><br
/>
<a
href=
"http://groups.google.com/group/h2-database"
>
Google Group (English)
</a><br
/>
<a
href=
"http://groups.google.co.jp/group/h2-database-jp"
>
Google Group (Japanese)
</a><br
/>
<a
href=
"http://groups.google.com/group/h2-cn"
>
Google Group (Chinese)
</a><br
/>
<br
/>
<b>
Appendix
</b><br
/>
<a
href=
"jaqu.html"
>
JaQu
</a><br
/>
...
...
h2/src/docsrc/html/history.html
浏览文件 @
f385a38c
h2/src/docsrc/html/links.html
浏览文件 @
f385a38c
h2/src/docsrc/html/tutorial.html
浏览文件 @
f385a38c
...
...
@@ -40,6 +40,8 @@ Tutorial
Upgrade, Backup, and Restore
</a><br
/>
<a
href=
"#command_line_tools"
>
Command Line Tools
</a><br
/>
<a
href=
"shell_tool"
>
The Shell Tool
</a><br
/>
<a
href=
"#open_office"
>
Using OpenOffice Base
</a><br
/>
<a
href=
"#web_start"
>
...
...
@@ -376,7 +378,7 @@ To enable it, change the following setting in persistence.xml:
<pre>
<
property
name="toplink.target-database"
value="oracle.toplink.essentials.platform.database.H2Platform"/
>
value="oracle.toplink.essentials.platform.database.H2Platform"/
>
</pre>
<p>
In old versions of Glassfish, the property name is
<code>
toplink.platform.class.name
</code>
.
...
...
@@ -428,9 +430,9 @@ add the following snippet to your web.xml file (between the
<code>
context-param
</code>
and the
<code>
filter
</code>
section):
</p>
<pre>
<
listener
>
<
listener-class
>org.h2.server.web.DbStarter
<
/listener-class>
<
/listener
>
<
listener
>
<
listener-class
>
org.h2.server.web.DbStarter
<
/listener-class
>
<
/listener
>
</pre>
<p>
For details on how to access the database, see the file
<code>
DbStarter.java
</code>
.
...
...
@@ -450,22 +452,22 @@ These options need to be placed between the <code>description</code> tag
and the
<code>
listener
</code>
/
<code>
filter
</code>
tags:
</p>
<pre>
<
context-param
>
<
param-name
>db.url
<
/param-name>
<
param-value
>jdbc:h2:~/test
<
/param-value>
<
/context-param
>
<
context-param
>
<
param-name
>db.user
<
/param-name>
<
param-value
>sa
<
/param-value>
<
/context-param
>
<
context-param
>
<
param-name
>db.password
<
/param-name>
<
param-value
>sa
<
/param-value>
<
/context-param
>
<
context-param
>
<
param-name
>db.tcpServer
<
/param-name>
<
param-value
>-tcpAllowOthers
<
/param-value>
<
/context-param
>
<
context-param
>
<
param-name
>
db.url
<
/param-name
>
<
param-value
>
jdbc:h2:~/test
<
/param-value
>
<
/context-param
>
<
context-param
>
<
param-name
>
db.user
<
/param-name
>
<
param-value
>
sa
<
/param-value
>
<
/context-param
>
<
context-param
>
<
param-name
>
db.password
<
/param-name
>
<
param-value
>
sa
<
/param-value
>
<
/context-param
>
<
context-param
>
<
param-name
>
db.tcpServer
<
/param-name
>
<
param-value
>
-tcpAllowOthers
<
/param-value
>
<
/context-param
>
</pre>
<p>
When the web application is stopped, the database connection will be closed automatically.
...
...
@@ -675,6 +677,40 @@ The tools can also be called from an application by calling the main or another
For details, see the Javadoc documentation.
</p>
<h2
id=
"shell_tool"
>
The Shell Tool
</h2>
<p>
The Shell tool is a simple interactive command line tool. To start it, type:
</p>
<pre>
java -cp h2*.jar org.h2.tools.Shell
</pre>
<p>
You will be prompted for a database URL, JDBC driver, user name, and password.
The connection setting can also be set as command line parameters.
After connecting, you will get the list of options.
The built-in commands don't need to end with a semicolon, but
SQL statements are only executed if the line ends with a semicolon
<code>
;
</code>
.
This allows to enter multi-line statements:
</p>
<pre>
sql
>
select * from test
...
>
where id = 0;
</pre>
<p>
By default, results are printed as a table. For results with many column, consinder using the list mode:
</p>
<pre>
sql
>
list
Result list mode is now on
sql
>
select * from test;
ID : 1
NAME: Hello
ID : 2
NAME: World
(2 rows, 0 ms)
</pre>
<h2
id=
"open_office"
>
Using OpenOffice Base
</h2>
<p>
OpenOffice.org Base supports database access over the JDBC API. To connect to a H2 database
...
...
@@ -731,9 +767,9 @@ access denied (<code>java.io.FilePermission ... read</code>).
Example permission tags:
</p>
<pre>
<
security
>
<
all-permissions/
>
<
/security
>
<
security
>
<
all-permissions/
>
<
/security
>
</pre>
<h2
id=
"connection_pool"
>
Using a Connection Pool
</h2>
...
...
h2/src/main/org/h2/jdbc/JdbcConnection.java
浏览文件 @
f385a38c
...
...
@@ -1351,6 +1351,10 @@ public class JdbcConnection extends TraceObject implements Connection {
}
}
/**
* INTERNAL.
* Called after executing a command that could have written something.
*/
protected
void
afterWriting
()
{
session
.
afterWriting
();
}
...
...
h2/src/test/org/h2/test/TestBase.java
浏览文件 @
f385a38c
...
...
@@ -39,6 +39,11 @@ public abstract class TestBase {
*/
protected
static
String
baseDir
=
getTestDir
(
""
);
/**
* The temporary directory.
*/
protected
static
final
String
TEMP_DIR
=
"data/temp"
;
/**
* An id used to create unique file names.
*/
...
...
@@ -97,6 +102,7 @@ public abstract class TestBase {
*/
public
TestBase
init
(
TestAll
conf
)
throws
Exception
{
baseDir
=
getTestDir
(
""
);
System
.
setProperty
(
"java.io.tmpdir"
,
TEMP_DIR
);
this
.
config
=
conf
;
return
this
;
}
...
...
h2/src/test/org/h2/test/db/TestFunctions.java
浏览文件 @
f385a38c
...
...
@@ -65,7 +65,8 @@ public class TestFunctions extends TestBase implements AggregateFunction {
Connection
conn
=
getConnection
(
"functions"
);
Statement
stat
=
conn
.
createStatement
();
ResultSet
rs
;
stat
.
execute
(
"create force alias sayHi as 'String test(String name) {\nreturn \"Hello \" + name;\n}'"
);
stat
.
execute
(
"create force alias sayHi as 'String test(String name) {\n"
+
"return \"Hello \" + name;\n}'"
);
rs
=
stat
.
executeQuery
(
"call sayHi('Joe')"
);
rs
.
next
();
assertEquals
(
"Hello Joe"
,
rs
.
getString
(
1
));
...
...
h2/src/test/org/h2/test/db/TestLob.java
浏览文件 @
f385a38c
...
...
@@ -8,6 +8,7 @@ package org.h2.test.db;
import
java.io.ByteArrayInputStream
;
import
java.io.CharArrayReader
;
import
java.io.File
;
import
java.io.InputStream
;
import
java.io.Reader
;
import
java.io.StringReader
;
...
...
@@ -24,6 +25,7 @@ import java.util.ArrayList;
import
java.util.Random
;
import
org.h2.constant.SysProperties
;
import
org.h2.store.FileLister
;
import
org.h2.store.fs.FileSystem
;
import
org.h2.test.TestBase
;
import
org.h2.tools.DeleteDbFiles
;
import
org.h2.util.FileUtils
;
...
...
@@ -47,6 +49,7 @@ public class TestLob extends TestBase {
}
public
void
test
()
throws
Exception
{
testTempFilesDeleted
();
testAddLobRestart
();
testLobServerMemory
();
if
(
config
.
memory
)
{
...
...
@@ -77,6 +80,32 @@ public class TestLob extends TestBase {
deleteDb
(
"lob"
);
}
private
void
testTempFilesDeleted
()
throws
Exception
{
String
[]
list
;
FileSystem
.
getInstance
(
TEMP_DIR
).
deleteRecursive
(
TEMP_DIR
,
false
);
FileUtils
.
mkdirs
(
new
File
(
TEMP_DIR
));
list
=
FileUtils
.
listFiles
(
TEMP_DIR
);
if
(
list
.
length
>
0
)
{
fail
(
"Unexpected temp file: "
+
list
[
0
]);
}
deleteDb
(
"lob"
);
Connection
conn
=
getConnection
(
"lob"
);
Statement
stat
;
stat
=
conn
.
createStatement
();
stat
.
execute
(
"create table test(id int primary key, name text)"
);
stat
.
execute
(
"insert into test values(1, space(100000))"
);
ResultSet
rs
;
rs
=
stat
.
executeQuery
(
"select * from test"
);
rs
.
next
();
rs
.
getCharacterStream
(
"name"
).
close
();
rs
.
close
();
conn
.
close
();
list
=
FileUtils
.
listFiles
(
TEMP_DIR
);
if
(
list
.
length
>
0
)
{
fail
(
"Unexpected temp file: "
+
list
[
0
]);
}
}
private
void
testAddLobRestart
()
throws
SQLException
{
DeleteDbFiles
.
execute
(
"memFS:"
,
"lob"
,
true
);
Connection
conn
=
org
.
h2
.
Driver
.
load
().
connect
(
"jdbc:h2:memFS:lob"
,
null
);
...
...
h2/src/test/org/h2/test/db/TestTriggersConstraints.java
浏览文件 @
f385a38c
...
...
@@ -51,7 +51,7 @@ public class TestTriggersConstraints extends TestBase implements Trigger {
stat
=
conn
.
createStatement
();
stat
.
execute
(
"drop table if exists meta_tables"
);
stat
.
execute
(
"create table meta_tables(name varchar)"
);
stat
.
execute
(
"create trigger meta_tables_sel before select on meta_tables call \""
+
TestSelect
.
class
.
getName
()
+
"\""
);
stat
.
execute
(
"create trigger meta_tables_sel
ect
before select on meta_tables call \""
+
TestSelect
.
class
.
getName
()
+
"\""
);
ResultSet
rs
;
rs
=
stat
.
executeQuery
(
"select * from meta_tables"
);
assertTrue
(
rs
.
next
());
...
...
h2/src/test/org/h2/test/test-1.2.txt
浏览文件 @
f385a38c
--- special grammar and test cases ---------------------------------------------------------------------------------------------
create table a(a int) as select 1;
> ok
create table b(b int) as select 1;
> ok
create table c(c int) as select x from system_range(1, 2);
> ok
select * from a inner join b on a=b right outer join c on c=a;
> C A B
> - ---- ----
> 1 1 1
> 2 null null
> rows: 2
select * from c left outer join (a inner join b on b=a) on c=a;
> C A B
> - ---- ----
> 1 1 1
> 2 null null
> rows: 2
select * from c left outer join a on c=a inner join b on b=a;
> C A B
> - - -
> 1 1 1
> rows: 1
drop table a, b, c;
> ok
create table test(a int, b int) as select x, x from system_range(1, 100);
> ok
...
...
h2/src/tools/org/h2/build/doc/dictionary.txt
浏览文件 @
f385a38c
...
...
@@ -623,3 +623,4 @@ autovacuum vacuuming endlessly talking evicted splitting unbound declaring
selector descendant isdescendantnode issamenode ischildnode localname
weakreference ancestor junctions wake fills rail sleeps turns grammars straight
answers attachments emails clipboard prioritize tips urgently standby
checklists serves gbif biodiversity wakes taxon ratio ended ipt
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论