Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
95060196
提交
95060196
authored
2月 26, 2008
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
f9198a75
显示空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
112 行增加
和
60 行删除
+112
-60
PageParser.java
h2/src/main/org/h2/server/web/PageParser.java
+3
-2
WebServer.java
h2/src/main/org/h2/server/web/WebServer.java
+2
-2
WebServlet.java
h2/src/main/org/h2/server/web/WebServlet.java
+2
-2
WebThread.java
h2/src/main/org/h2/server/web/WebThread.java
+10
-10
help.jsp
h2/src/main/org/h2/server/web/res/help.jsp
+8
-8
table.js
h2/src/main/org/h2/server/web/res/table.js
+0
-7
Console.java
h2/src/main/org/h2/tools/Console.java
+34
-20
newsfeed.sql
h2/src/test/org/h2/samples/newsfeed.sql
+1
-1
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+50
-6
dictionary.txt
h2/src/tools/org/h2/tools/doc/dictionary.txt
+2
-2
没有找到文件。
h2/src/main/org/h2/server/web/PageParser.java
浏览文件 @
95060196
...
...
@@ -82,8 +82,7 @@ public class PageParser {
append
(
s
);
i
=
pos
;
}
else
{
setError
(
i
);
return
;
buff
.
append
(
c
);
}
break
;
}
else
if
(
p
.
charAt
(
i
+
3
)
==
':'
&&
p
.
charAt
(
i
+
1
)
==
'/'
)
{
...
...
@@ -149,6 +148,8 @@ public class PageParser {
i
=
j
;
String
s
=
(
String
)
get
(
item
);
append
(
s
);
}
else
{
buff
.
append
(
c
);
}
break
;
default
:
...
...
h2/src/main/org/h2/server/web/WebServer.java
浏览文件 @
95060196
...
...
@@ -164,14 +164,14 @@ public class WebServer implements Service {
return
session
;
}
WebSession
createNewSession
(
String
host
name
)
{
WebSession
createNewSession
(
String
host
Addr
)
{
String
newId
;
do
{
newId
=
generateSessionId
();
}
while
(
sessions
.
get
(
newId
)
!=
null
);
WebSession
session
=
new
WebSession
(
this
);
session
.
put
(
"sessionId"
,
newId
);
session
.
put
(
"ip"
,
host
name
);
session
.
put
(
"ip"
,
host
Addr
);
session
.
put
(
"language"
,
DEFAULT_LANGUAGE
);
sessions
.
put
(
newId
,
session
);
// always read the english translation, to that untranslated text appears at least in english
...
...
h2/src/main/org/h2/server/web/WebServlet.java
浏览文件 @
95060196
...
...
@@ -112,8 +112,8 @@ public class WebServlet extends HttpServlet {
app
.
setSession
(
session
,
attributes
);
String
ifModifiedSince
=
req
.
getHeader
(
"if-modified-since"
);
String
host
name
=
req
.
getRemoteHost
();
file
=
app
.
processRequest
(
file
,
host
name
);
String
host
Addr
=
req
.
getRemoteAddr
();
file
=
app
.
processRequest
(
file
,
host
Addr
);
session
=
app
.
getSession
();
String
mimeType
=
app
.
getMimeType
();
...
...
h2/src/main/org/h2/server/web/WebThread.java
浏览文件 @
95060196
...
...
@@ -102,7 +102,7 @@ class WebThread extends Thread implements DatabaseEventListener {
return
requestedFile
;
}
public
String
processRequest
(
String
file
,
String
host
name
)
{
public
String
processRequest
(
String
file
,
String
host
Addr
)
{
int
index
=
file
.
lastIndexOf
(
'.'
);
String
suffix
;
if
(
index
>=
0
)
{
...
...
@@ -123,7 +123,7 @@ class WebThread extends Thread implements DatabaseEventListener {
cache
=
false
;
mimeType
=
"text/html"
;
if
(
session
==
null
)
{
session
=
server
.
createNewSession
(
host
name
);
session
=
server
.
createNewSession
(
host
Addr
);
if
(!
"notAllowed.jsp"
.
equals
(
file
))
{
file
=
"index.do"
;
}
...
...
@@ -165,14 +165,12 @@ class WebThread extends Thread implements DatabaseEventListener {
session
=
server
.
getSession
(
sessionId
);
}
parseHeader
();
String
hostname
=
socket
.
getInetAddress
().
getHostName
();
file
=
processRequest
(
file
,
hostname
);
String
hostAddr
=
socket
.
getInetAddress
().
getHostAddress
();
file
=
processRequest
(
file
,
hostAddr
);
if
(
file
.
length
()
==
0
)
{
// asynchronous request
return
;
}
String
message
;
byte
[]
bytes
;
if
(
cache
&&
ifModifiedSince
!=
null
&&
ifModifiedSince
.
equals
(
server
.
getStartDateTime
()))
{
...
...
@@ -225,7 +223,6 @@ class WebThread extends Thread implements DatabaseEventListener {
private
void
closeOutput
(
DataOutputStream
output
)
{
try
{
output
.
flush
();
output
.
close
();
socket
.
close
();
}
catch
(
IOException
e
)
{
...
...
@@ -826,11 +823,14 @@ class WebThread extends Thread implements DatabaseEventListener {
String
message
=
PageParser
.
escapeHtml
(
e
.
getMessage
());
String
error
=
"<a class=\"error\" href=\"#\" onclick=\"var x=document.getElementById('st"
+
id
+
"').style;x.display=x.display==''?'none':'';\">"
+
message
+
"</a>"
;
if
(
e
instanceof
SQLException
&&
isH2
)
{
if
(
e
instanceof
SQLException
)
{
SQLException
se
=
(
SQLException
)
e
;
error
+=
" "
+
se
.
getSQLState
()
+
"/"
+
se
.
getErrorCode
();
if
(
isH2
)
{
int
code
=
se
.
getErrorCode
();
error
+=
" <a href=\"http://h2database.com/javadoc/org/h2/constant/ErrorCode.html#c"
+
code
+
"\">(${text.a.help})</a>"
;
}
}
error
+=
"<span style=\"display: none;\" id=\"st"
+
id
+
"\"><br />"
+
stackTrace
+
"</span>"
;
error
=
formatAsError
(
error
);
return
error
;
...
...
h2/src/main/org/h2/server/web/res/help.jsp
浏览文件 @
95060196
...
...
@@ -9,10 +9,8 @@ Initial Developer: H2 Group
<title>
${text.a.title}
</title>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"stylesheet.css"
/>
</head>
<body
class=
"result"
>
<div
id=
"output"
>
<body
class=
"result"
onkeyup=
"auto(event)"
>
<!-- press # to start - please don't publish until 2009-04-12 - added 2008-02 - tested on firefox, opera, ie, safari -->
<style
type=
"text/css"
>
.g
td
{
padding
:
0
;
width
:
10px
;
height
:
10px
;}
</style><div
id=
"game"
style=
"display:none"
><input
id=
"O"
onkeydown=
"k(event)"
readonly
><table
class=
"g"
><script
type=
"text/javascript"
>
var
L
=
264
,
M
=
new
Array
(),
S
,
R
,
P
,
W
,
C
,
D
=
document
,
O
=
D
.
getElementById
(
"O"
);
function
z
(){
S
=
R
=
0
;
P
=
17
;
W
=
200
;
C
=
1
;
for
(
i
=
0
;
i
<
L
;
i
++
)
M
[
i
]
=
i
<
253
&&
(
i
+
1
)
%
12
>
1
?
0
:
8
;}
function
d
(){
for
(
i
=
0
;
i
<
L
;
i
++
)
D
.
getElementsByTagName
(
"td"
)[
i
].
style
.
backgroundColor
=
"#"
+
"fffff000e00c00a008006004000"
.
substr
(
3
*
M
[
i
],
3
);}
function
k
(
e
){
c
=
e
.
keyCode
;
c
?
c
=
c
:
e
.
charCode
;
r
=
R
;
p
=
P
;
if
(
c
==
37
)
p
-=
1
;
if
(
c
==
38
||
c
==
32
)
r
=
"AHILMNQBJKCDEOPFRSG"
.
charCodeAt
(
R
)
-
65
;
if
(
c
==
39
)
p
++
;
if
(
c
==
40
)
W
=
10
;
s
(
0
);
if
(
!
t
(
p
,
r
)){
P
=
p
;
R
=
r
;
s
(
C
);
d
();
s
(
0
);}
else
s
(
C
);}
function
f
(){
setTimeout
(
"f()"
,
W
);
O
.
focus
();
s
(
0
);
if
(
!
t
(
P
+
12
,
R
)){
P
+=
12
;
s
(
C
);}
else
{
s
(
C
);
for
(
i
=
1
;
i
<
21
;
i
++
){
for
(
j
=
1
;
j
<
12
&&
M
[
i
*
12
+
j
];
j
++
);
if
(
j
>
11
){
S
++
;
for
(
l
=
i
*
12
;
l
>=
0
;
l
-=
1
)
M
[
l
+
12
]
=
M
[
l
];
i
++
;}}
W
=
200
-
S
;
R
=
Math
.
random
()
*
7
&
7
;
C
=
R
+
1
;
if
(
P
<
24
)
z
();
P
=
17
;}
d
();
O
.
value
=
S
;}
function
g
(
x
){
return
"01<=/012$/01$01=%01<$0<=$0;<$0<H$01</01<$/0<01;</0<=/01;#$0
<%
/
01
#
/
01
$%
0
</
01
=
"
.
charCodeAt
(
x
)-
48
;}
function
s
(
n
){
for
(
i
=
0
;
i
<
4
;
i
++)
M
[
P
+
g
(
4
*
R
+
i
)]=
n
;}
function
t
(
x
,
y
){
for
(
i
=
3
;
i
>
=
0
&&!
M
[
x
+
g
(
4
*
y
+
i
)];
i
-=
1
);
return
i
+
1
;}
for
(
i
=
0
;
i
<
L
;
i
++)
D
.
write
(
"
<
td
>"
+((
i
%
12
)
>
10
?
"
<
tr
>
":"
"
));
function
auto
(
e
){
c
=
e
.
keyCode
;
c
=
c
?
c:
e
.
charCode
;
if
(
c
==
51
){
D
.
getElementById
(
'
output
'
).
style
.
display
=
'
none
'
;
D
.
getElementById
(
'
game
'
).
style
.
display
=
''
;
z
();
f
();}}</
script
>
</
table
>
</
div
>
<
script
type
=
"text/javascript"
>
<!--
function
set
(
s
)
{
...
...
@@ -21,6 +19,8 @@ function set(s) {
//--
>
</
script
>
<
div
id
=
"output"
>
<
h3
>$
{
text
.
helpImportantCommands
}</
h3
>
<
table
>
<
tr
>
<
th
>$
{
text
.
helpIcon
}</
th
>
<
th
>$
{
text
.
helpAction
}</
th
>
</
tr
>
...
...
h2/src/main/org/h2/server/web/res/table.js
浏览文件 @
95060196
...
...
@@ -133,9 +133,6 @@ function resortTable(link) {
if
(
x
.
match
(
/^
[\d\.]
+$/
))
{
sortNumeric
=
true
;
}
//alert("start copy");
var
newRows
=
new
Array
();
var
rows
=
table
.
rows
;
for
(
i
=
1
;
i
<
rows
.
length
;
i
++
)
{
...
...
@@ -150,9 +147,7 @@ function resortTable(link) {
}
newRows
[
i
-
1
]
=
o
;
}
//alert("start sort");
newRows
.
sort
(
sortCallback
);
var
arrow
;
if
(
span
.
getAttribute
(
"sortDir"
)
==
'down'
)
{
arrow
=
' <img src="sort_up.gif" with=7 height=10 border=0/>'
;
...
...
@@ -163,14 +158,12 @@ function resortTable(link) {
span
.
setAttribute
(
'sortDir'
,
'down'
);
}
//alert("start move");
// we appendChild rows that already exist to the tbody,
// so it moves them rather than creating new ones
var
body
=
table
.
tBodies
[
0
];
for
(
i
=
0
;
i
<
newRows
.
length
;
i
++
)
{
body
.
appendChild
(
newRows
[
i
].
data
);
}
//alert("end");
// delete any other arrows there may be showing
var
allSpans
=
document
.
getElementsByTagName
(
"span"
);
...
...
h2/src/main/org/h2/tools/Console.java
浏览文件 @
95060196
...
...
@@ -13,8 +13,10 @@ import java.awt.GraphicsEnvironment;
import
java.awt.GridBagConstraints
;
import
java.awt.GridBagLayout
;
import
java.awt.Image
;
import
java.awt.Insets
;
import
java.awt.Label
;
import
java.awt.MenuItem
;
import
java.awt.Panel
;
import
java.awt.PopupMenu
;
import
java.awt.SystemColor
;
import
java.awt.TextField
;
...
...
@@ -255,18 +257,38 @@ ShutdownHandler {
GridBagLayout
layout
=
new
GridBagLayout
();
frame
.
setLayout
(
layout
);
GridBagConstraints
c
=
new
GridBagConstraints
();
c
.
anchor
=
GridBagConstraints
.
EAST
;
c
.
insets
.
left
=
2
;
c
.
insets
.
right
=
2
;
c
.
insets
.
top
=
2
;
c
.
insets
.
bottom
=
2
;
// the main panel keeps everything together
Panel
mainPanel
=
new
Panel
(
layout
);
GridBagConstraints
contraintsPanel
=
new
GridBagConstraints
();
contraintsPanel
.
gridx
=
0
;
contraintsPanel
.
weightx
=
1.0
D
;
contraintsPanel
.
weighty
=
1.0
D
;
contraintsPanel
.
fill
=
GridBagConstraints
.
BOTH
;
contraintsPanel
.
insets
=
new
Insets
(
0
,
10
,
0
,
10
);
contraintsPanel
.
gridy
=
0
;
GridBagConstraints
constraintsButton
=
new
GridBagConstraints
();
constraintsButton
.
gridx
=
0
;
constraintsButton
.
gridwidth
=
2
;
constraintsButton
.
insets
=
new
Insets
(
10
,
0
,
0
,
0
);
constraintsButton
.
gridy
=
1
;
constraintsButton
.
anchor
=
GridBagConstraints
.
EAST
;
GridBagConstraints
constraintsTextField
=
new
GridBagConstraints
();
constraintsTextField
.
fill
=
GridBagConstraints
.
HORIZONTAL
;
constraintsTextField
.
gridy
=
0
;
constraintsTextField
.
weightx
=
1.0
;
constraintsTextField
.
insets
=
new
Insets
(
0
,
5
,
0
,
0
);
constraintsTextField
.
gridx
=
1
;
GridBagConstraints
constraintsLabel
=
new
GridBagConstraints
();
constraintsLabel
.
gridx
=
0
;
constraintsLabel
.
gridy
=
0
;
Label
label
=
new
Label
(
"H2 Console URL:"
,
Label
.
LEFT
);
label
.
setFont
(
font
);
c
.
anchor
=
GridBagConstraints
.
WEST
;
c
.
gridwidth
=
GridBagConstraints
.
EAST
;
frame
.
add
(
label
,
c
);
mainPanel
.
add
(
label
,
constraintsLabel
);
TextField
text
=
new
TextField
();
text
.
setEditable
(
false
);
...
...
@@ -275,23 +297,15 @@ ShutdownHandler {
if
(
isWindows
)
{
text
.
setFocusable
(
false
);
}
c
.
anchor
=
GridBagConstraints
.
EAST
;
c
.
gridwidth
=
GridBagConstraints
.
REMAINDER
;
frame
.
add
(
text
,
c
);
Label
label2
=
new
Label
();
c
.
anchor
=
GridBagConstraints
.
WEST
;
c
.
gridwidth
=
GridBagConstraints
.
EAST
;
frame
.
add
(
label2
,
c
);
mainPanel
.
add
(
text
,
constraintsTextField
);
Button
startBrowser
=
new
Button
(
"Start Browser"
);
startBrowser
.
setFocusable
(
false
);
startBrowser
.
setActionCommand
(
"console"
);
startBrowser
.
addActionListener
(
this
);
startBrowser
.
setFont
(
font
);
c
.
anchor
=
GridBagConstraints
.
EAST
;
c
.
gridwidth
=
GridBagConstraints
.
REMAINDER
;
frame
.
add
(
startBrowser
,
c
);
mainPanel
.
add
(
startBrowser
,
constraintsButton
);
frame
.
add
(
mainPanel
,
contraintsPanel
);
int
width
=
300
,
height
=
120
;
frame
.
setSize
(
width
,
height
);
...
...
h2/src/test/org/h2/samples/newsfeed.sql
浏览文件 @
95060196
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
95060196
...
...
@@ -155,11 +155,55 @@ java org.h2.test.TestAll timer
/*
test startBrowser in Linux
larger H2 tray icon for ubuntu
Can not select URL
Strange font
apple:
- console doesn't always work in safari, fix
ant 'get' for dependencies
H2 is an SQL database engine written in Java.
It is very fast and small (about 1 MB).
Embedded, server, and clustering modes are available.
A browser based console application is included.
Disk based and in-memory tables and databases are supported.
Some of its features are transactions isolation, multi-version concurrency
(MVCC), level locking, encrypted databases, fulltext search,
and strong security.
The main API is JDBC, however ODBC and others are also
supported via PostgreSQL network protocol compatibility.
I was looking at MVCC today, I hope it will solve some of my problems
in future. MVCC is listed in the "Advanced Topics" documentation
without any warnings. However, I have encountered a major problem. All
you need to do is use jdbc:h2:test;MVCC=true with a range comparison
in a WHERE clause on an indexed column:
SET AUTOCOMMIT TRUE;
DROP TABLE IF EXISTS test;
CREATE TABLE test (id IDENTITY, A INT, B INT);
CREATE INDEX A ON test(A);
INSERT INTO test VALUES(0, 0, 0);
INSERT INTO test VALUES(2, 2, 2);
SET AUTOCOMMIT FALSE;
SELECT * FROM test WHERE id BETWEEN 0 AND 2;
-- Returned the correct result: TABLE(ID INT=(0,2), A INT=(0,2), B INT=(0,2))
INSERT INTO test VALUES(1, 1, 1);
SELECT * FROM test;
-- Returned the correct result: TABLE(ID INT=(0,2,1), A INT=(0,2,1), B INT=(0,2,1))
SELECT * FROM test WHERE id IS NOT NULL;
-- Returned the correct result: TABLE(ID INT=(0,2,1), A INT=(0,2,1), B INT=(0,2,1))
SELECT * FROM test WHERE id <> 99;
-- Returned the correct result: TABLE(ID INT=(0,2,1), A INT=(0,2,1), B INT=(0,2,1))
SELECT * FROM test WHERE id < 99;
-- Returned WRONG result: TABLE(ID INT=(1,1,2), A INT=(1,1,2), B INT=(1,1,2))
SELECT * FROM test WHERE id >= 0;
-- Returned WRONG result: TABLE(ID INT=(1,1,2), A INT=(1,1,2), B INT=(1,1,2))
SELECT * FROM test WHERE A >= 0;
-- Returned WRONG result: TABLE(ID INT=(1,1,2), A INT=(1,1,2), B INT=(1,1,2))
SELECT * FROM test WHERE B >= 0;
-- Returned the correct result: TABLE(ID INT=(0,2,1), A INT=(0,2,1), B INT=(0,2,1))
If you have a 2nd connection open while the 1st connection's
transaction is uncommitted, the 2nd connection also returns the wrong
result set! This is the same whether the lock mode is READ_COMMITTED
or SERIALIZABLE.
fix or disable the linear hash index
...
...
@@ -169,9 +213,9 @@ link to new changelog and roadmap, remove pages from google groups
Can sometimes not delete log file? need test case
History:
H2 Console: remote connections were very slow because getHostName/getRemoteHost was used. Fixed (now using getHostAddress/getRemoteAddr.
H2 Console: on Linux, Firefox is now started if available. This has been tested on Ubuntu.
Roadmap:
*/
...
...
h2/src/tools/org/h2/tools/doc/dictionary.txt
浏览文件 @
95060196
...
...
@@ -493,7 +493,7 @@ tgconstrrelid classoid relhasoids pretty portals rolcatupdate rolsuper spcowner
latin tgconstrname datallowconn atttypmod dattablespace attrelid ctid timestamptz atthasdef
nspname objsubid typnamespace rolcreaterole tgrelid spclocation relhasrules dont indkey postmaster
relkind autovacuum datlastsysoid attisdropped amname datacl deallocate tgdeferrable stats
spcacl relname rolvaliduntil attnotnull authid aclitem
spcacl relname rolvaliduntil attnotnull authid aclitem
game
plpgsql interrupting spring oids plperl regex newest
xhtml transactionally remotly jnlp launch mirror subversion matcher hoohoho matching bulk
prorettype pronamespace groname inlining nopmd openfire joda fastutil ibatis igniterealtime unimi dsi
...
...
@@ -520,7 +520,7 @@ involves ukrainian chile machines restricting summer aliased backus naur multipl
countdown paused javac analyzing accesses solving forcefully urgent originally defect coordinates
camel council merges spelled adaptive pull controller abstractions workarounds driven
thousands ridvan incremented slots debugging inherit agar fulvio invisible biondi hundreds occupied remap retrieved involved
turkish fulfils iapi filesync
turkish fulfils iapi filesync
ubuntu ahilmnqbjkcdeopfrsg unind ind looking encountered browsers
compares packets destroying echo homed hosts clock countries validated catches turning staging kills distance morning performs internationalization simulator constructed nicer
echo callablestatement procid homed getstart staging prices meantime qujd qujdra qui divided quaere restrictions hudson scoped design inverting newlines
violate verysmallint eremainder iee cgi adjust estimation consumption occupy ikvm light gray viewer grover harpal
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论