Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
0ea30d28
提交
0ea30d28
authored
1月 26, 2007
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
6f67c668
全部展开
显示空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
441 行增加
和
100 行删除
+441
-100
H2Dictionary.java.txt
...c/tools/org/apache/openjpa/jdbc/sql/H2Dictionary.java.txt
+10
-10
CodeSwitch.java
h2/src/tools/org/h2/tools/code/CodeSwitch.java
+17
-17
PropertiesToUTF8.java
h2/src/tools/org/h2/tools/code/PropertiesToUTF8.java
+7
-4
GenerateDoc.java
h2/src/tools/org/h2/tools/doc/GenerateDoc.java
+5
-5
LinkChecker.java
h2/src/tools/org/h2/tools/doc/LinkChecker.java
+1
-1
SpellChecker.java
h2/src/tools/org/h2/tools/doc/SpellChecker.java
+48
-31
XMLChecker.java
h2/src/tools/org/h2/tools/doc/XMLChecker.java
+5
-5
dictionary.txt
h2/src/tools/org/h2/tools/doc/dictionary.txt
+293
-4
HtmlConverter.java
h2/src/tools/org/h2/tools/indexer/HtmlConverter.java
+35
-3
Indexer.java
h2/src/tools/org/h2/tools/indexer/Indexer.java
+4
-4
H2Adapter.java.txt
h2/src/tools/org/h2/tools/jpox/H2Adapter.java.txt
+9
-9
H2Dialect.java.txt
h2/src/tools/org/hibernate/dialect/H2Dialect.java.txt
+7
-7
没有找到文件。
h2/src/tools/org/apache/openjpa/jdbc/sql/H2Dictionary.java.txt
浏览文件 @
0ea30d28
...
@@ -106,12 +106,12 @@ public class H2Dictionary extends DBDictionary {
...
@@ -106,12 +106,12 @@ public class H2Dictionary extends DBDictionary {
buf.append(", ").append(pkStr);
buf.append(", ").append(pkStr);
}
}
Unique[] un
q
s = table.getUniques();
Unique[] un
ique
s = table.getUniques();
String un
q
Str;
String un
ique
Str;
for (int i = 0; i < un
q
s.length; i++) {
for (int i = 0; i < un
ique
s.length; i++) {
un
qStr = getUniqueConstraintSQL(unq
s[i]);
un
iqueStr = getUniqueConstraintSQL(unique
s[i]);
if (un
q
Str != null)
if (un
ique
Str != null)
buf.append(", ").append(un
q
Str);
buf.append(", ").append(un
ique
Str);
}
}
buf.append(")");
buf.append(")");
...
@@ -154,12 +154,12 @@ public class H2Dictionary extends DBDictionary {
...
@@ -154,12 +154,12 @@ public class H2Dictionary extends DBDictionary {
return cols;
return cols;
}
}
public void setDouble(PreparedStatement st
mn
t, int idx, double val, Column col) throws SQLException {
public void setDouble(PreparedStatement st
a
t, int idx, double val, Column col) throws SQLException {
super.setDouble(st
mn
t, idx, val, col);
super.setDouble(st
a
t, idx, val, col);
}
}
public void setBigDecimal(PreparedStatement st
mn
t, int idx, BigDecimal val, Column col) throws SQLException {
public void setBigDecimal(PreparedStatement st
a
t, int idx, BigDecimal val, Column col) throws SQLException {
super.setBigDecimal(st
mn
t, idx, val, col);
super.setBigDecimal(st
a
t, idx, val, col);
}
}
protected void appendSelectRange(SQLBuffer buf, long start, long end) {
protected void appendSelectRange(SQLBuffer buf, long start, long end) {
...
...
h2/src/tools/org/h2/tools/code/CodeSwitch.java
浏览文件 @
0ea30d28
...
@@ -68,8 +68,8 @@ public class CodeSwitch {
...
@@ -68,8 +68,8 @@ public class CodeSwitch {
System
.
out
.
println
(
"labels in the source code are shown."
);
System
.
out
.
println
(
"labels in the source code are shown."
);
System
.
out
.
println
(
"-r+ recurse subdirectories (default)"
);
System
.
out
.
println
(
"-r+ recurse subdirectories (default)"
);
System
.
out
.
println
(
"-r- do not recurse subdirectories"
);
System
.
out
.
println
(
"-r- do not recurse subdirectories"
);
System
.
out
.
println
(
"Use +MODE to switch on
the things label
d MODE"
);
System
.
out
.
println
(
"Use +MODE to switch on
code labele
d MODE"
);
System
.
out
.
println
(
"Use -MODE to switch off
the things label
d MODE"
);
System
.
out
.
println
(
"Use -MODE to switch off
code labele
d MODE"
);
System
.
out
System
.
out
.
println
(
"Path: Any number of path or files may be specified."
);
.
println
(
"Path: Any number of path or files may be specified."
);
System
.
out
System
.
out
...
@@ -164,7 +164,7 @@ public class CodeSwitch {
...
@@ -164,7 +164,7 @@ public class CodeSwitch {
private
boolean
processFile
(
String
name
)
{
private
boolean
processFile
(
String
name
)
{
File
f
=
new
File
(
name
);
File
f
=
new
File
(
name
);
boolean
switch
off
=
false
;
boolean
off
=
false
;
boolean
working
=
false
;
boolean
working
=
false
;
int
state
=
0
;
int
state
=
0
;
try
{
try
{
...
@@ -233,11 +233,11 @@ public class CodeSwitch {
...
@@ -233,11 +233,11 @@ public class CodeSwitch {
}
}
if
(
switchedOn
)
{
if
(
switchedOn
)
{
working
=
true
;
working
=
true
;
switch
off
=
false
;
off
=
false
;
}
else
if
(
switchedOff
)
{
}
else
if
(
switchedOff
)
{
working
=
true
;
working
=
true
;
insertLine
(++
i
,
"/*"
+
endOfLine
);
insertLine
(++
i
,
"/*"
+
endOfLine
);
switch
off
=
true
;
off
=
true
;
}
}
if
(
switches
.
indexOf
(
s
)
==
-
1
)
{
if
(
switches
.
indexOf
(
s
)
==
-
1
)
{
switches
.
add
(
s
);
switches
.
add
(
s
);
...
@@ -249,12 +249,12 @@ public class CodeSwitch {
...
@@ -249,12 +249,12 @@ public class CodeSwitch {
}
}
state
=
2
;
state
=
2
;
if
(
working
)
{
if
(
working
)
{
if
(
switch
off
)
{
if
(
off
)
{
insertLine
(++
i
,
"*/"
+
endOfLine
);
insertLine
(++
i
,
"*/"
+
endOfLine
);
switch
off
=
false
;
off
=
false
;
}
else
{
}
else
{
insertLine
(++
i
,
"/*"
+
endOfLine
);
insertLine
(++
i
,
"/*"
+
endOfLine
);
switch
off
=
true
;
off
=
true
;
}
}
}
}
}
else
if
(
lineTrim
.
startsWith
(
"//#endif"
))
{
}
else
if
(
lineTrim
.
startsWith
(
"//#endif"
))
{
...
@@ -263,7 +263,7 @@ public class CodeSwitch {
...
@@ -263,7 +263,7 @@ public class CodeSwitch {
return
false
;
return
false
;
}
}
state
=
0
;
state
=
0
;
if
(
working
&&
switch
off
)
{
if
(
working
&&
off
)
{
insertLine
(
i
++,
"*/"
+
endOfLine
);
insertLine
(
i
++,
"*/"
+
endOfLine
);
}
}
working
=
false
;
working
=
false
;
...
@@ -275,18 +275,18 @@ public class CodeSwitch {
...
@@ -275,18 +275,18 @@ public class CodeSwitch {
return
false
;
return
false
;
}
}
if
(
changed
)
{
if
(
changed
)
{
File
f
n
ew
=
new
File
(
name
+
".new"
);
File
f
ileN
ew
=
new
File
(
name
+
".new"
);
FileWriter
write
=
new
FileWriter
(
f
n
ew
);
FileWriter
write
=
new
FileWriter
(
f
ileN
ew
);
for
(
int
i
=
0
;
i
<
lines
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
lines
.
size
();
i
++)
{
write
.
write
(
getLine
(
i
));
write
.
write
(
getLine
(
i
));
}
}
write
.
close
();
write
.
close
();
File
f
ba
k
=
new
File
(
name
+
".bak"
);
File
f
ileBac
k
=
new
File
(
name
+
".bak"
);
f
ba
k
.
delete
();
f
ileBac
k
.
delete
();
f
.
renameTo
(
f
ba
k
);
f
.
renameTo
(
f
ileBac
k
);
File
f
c
opy
=
new
File
(
name
);
File
f
ileC
opy
=
new
File
(
name
);
f
new
.
renameTo
(
fc
opy
);
f
ileNew
.
renameTo
(
fileC
opy
);
f
ba
k
.
delete
();
f
ileBac
k
.
delete
();
System
.
out
.
println
(
name
);
System
.
out
.
println
(
name
);
}
}
return
true
;
return
true
;
...
...
h2/src/tools/org/h2/tools/code/PropertiesToUTF8.java
浏览文件 @
0ea30d28
...
@@ -12,13 +12,15 @@ import java.io.OutputStreamWriter;
...
@@ -12,13 +12,15 @@ import java.io.OutputStreamWriter;
import
java.io.RandomAccessFile
;
import
java.io.RandomAccessFile
;
import
org.h2.server.web.PageParser
;
import
org.h2.server.web.PageParser
;
import
org.h2.tools.indexer.HtmlConverter
;
import
org.h2.util.IOUtils
;
import
org.h2.util.IOUtils
;
import
org.h2.util.StringUtils
;
import
org.h2.util.StringUtils
;
public
class
PropertiesToUTF8
{
public
class
PropertiesToUTF8
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
File
[]
list
=
new
File
(
"bin/org/h2/web/res"
).
listFiles
();
File
[]
list
=
new
File
(
"bin/org/h2/
server/
web/res"
).
listFiles
();
for
(
int
i
=
0
;
i
<
list
.
length
;
i
++)
{
for
(
int
i
=
0
;
list
!=
null
&&
i
<
list
.
length
;
i
++)
{
File
f
=
list
[
i
];
File
f
=
list
[
i
];
if
(!
f
.
getName
().
endsWith
(
".properties"
))
{
if
(!
f
.
getName
().
endsWith
(
".properties"
))
{
continue
;
continue
;
...
@@ -29,13 +31,14 @@ public class PropertiesToUTF8 {
...
@@ -29,13 +31,14 @@ public class PropertiesToUTF8 {
in
.
close
();
in
.
close
();
String
name
=
f
.
getName
();
String
name
=
f
.
getName
();
if
(
name
.
startsWith
(
"utf8"
))
{
if
(
name
.
startsWith
(
"utf8"
))
{
s
=
PageParser
.
escapeHtml
(
s
,
false
);
s
=
HtmlConverter
.
convertStringToHtml
(
s
);
RandomAccessFile
out
=
new
RandomAccessFile
(
name
.
substring
(
4
),
"rw"
);
RandomAccessFile
out
=
new
RandomAccessFile
(
name
.
substring
(
4
),
"rw"
);
out
.
write
(
s
.
getBytes
());
out
.
write
(
s
.
getBytes
());
out
.
close
();
out
.
close
();
}
else
{
}
else
{
new
CheckTextFiles
().
checkOrFixFile
(
f
,
false
,
false
);
new
CheckTextFiles
().
checkOrFixFile
(
f
,
false
,
false
);
s
=
unescapeHtml
(
s
);
s
=
HtmlConverter
.
convertHtmlToString
(
s
);
// s = unescapeHtml(s);
s
=
StringUtils
.
javaDecode
(
s
);
s
=
StringUtils
.
javaDecode
(
s
);
FileOutputStream
out
=
new
FileOutputStream
(
"utf8"
+
f
.
getName
());
FileOutputStream
out
=
new
FileOutputStream
(
"utf8"
+
f
.
getName
());
OutputStreamWriter
w
=
new
OutputStreamWriter
(
out
,
"UTF-8"
);
OutputStreamWriter
w
=
new
OutputStreamWriter
(
out
,
"UTF-8"
);
...
...
h2/src/tools/org/h2/tools/doc/GenerateDoc.java
浏览文件 @
0ea30d28
...
@@ -71,13 +71,13 @@ public class GenerateDoc {
...
@@ -71,13 +71,13 @@ public class GenerateDoc {
}
}
void
process
(
String
fileName
)
throws
Exception
{
void
process
(
String
fileName
)
throws
Exception
{
FileOutputStream
f
out
=
new
FileOutputStream
(
outDir
+
"/"
+
fileName
+
".html"
);
FileOutputStream
out
=
new
FileOutputStream
(
outDir
+
"/"
+
fileName
+
".html"
);
FileInputStream
f
in
=
new
FileInputStream
(
inDir
+
"/"
+
fileName
+
".jsp"
);
FileInputStream
in
=
new
FileInputStream
(
inDir
+
"/"
+
fileName
+
".jsp"
);
byte
[]
bytes
=
IOUtils
.
readBytesAndClose
(
f
in
,
0
);
byte
[]
bytes
=
IOUtils
.
readBytesAndClose
(
in
,
0
);
String
page
=
new
String
(
bytes
);
String
page
=
new
String
(
bytes
);
page
=
PageParser
.
parse
(
null
,
page
,
session
);
page
=
PageParser
.
parse
(
null
,
page
,
session
);
f
out
.
write
(
page
.
getBytes
());
out
.
write
(
page
.
getBytes
());
f
out
.
close
();
out
.
close
();
}
}
void
map
(
String
key
,
String
sql
)
throws
Exception
{
void
map
(
String
key
,
String
sql
)
throws
Exception
{
...
...
h2/src/tools/org/h2/tools/doc/LinkChecker.java
浏览文件 @
0ea30d28
...
@@ -163,7 +163,7 @@ public class LinkChecker {
...
@@ -163,7 +163,7 @@ public class LinkChecker {
}
else
if
(
type
.
equals
(
"name"
))
{
}
else
if
(
type
.
equals
(
"name"
))
{
targets
.
put
(
path
+
"#"
+
ref
,
"name"
);
targets
.
put
(
path
+
"#"
+
ref
,
"name"
);
}
else
{
}
else
{
error
(
fileName
,
"unsupported <a
xxx
: "
+
html
.
substring
(
idx
,
idx
+
100
));
error
(
fileName
,
"unsupported <a
?
: "
+
html
.
substring
(
idx
,
idx
+
100
));
}
}
}
}
}
}
...
...
h2/src/tools/org/h2/tools/doc/SpellChecker.java
浏览文件 @
0ea30d28
...
@@ -5,6 +5,7 @@ import java.io.FileReader;
...
@@ -5,6 +5,7 @@ import java.io.FileReader;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.Reader
;
import
java.io.Reader
;
import
java.io.StringWriter
;
import
java.io.StringWriter
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.Iterator
;
import
java.util.Iterator
;
...
@@ -18,6 +19,7 @@ public class SpellChecker {
...
@@ -18,6 +19,7 @@ public class SpellChecker {
private
HashSet
used
=
new
HashSet
();
private
HashSet
used
=
new
HashSet
();
private
HashMap
unknown
=
new
HashMap
();
private
HashMap
unknown
=
new
HashMap
();
private
boolean
debug
;
private
boolean
debug
;
private
boolean
printDictionary
;
private
boolean
addToDictionary
;
private
boolean
addToDictionary
;
private
static
final
String
[]
SUFFIX
=
new
String
[]{
"java"
,
"sql"
,
"cpp"
,
"txt"
,
"html"
,
"xml"
,
"jsp"
,
"css"
,
"bat"
,
"nsi"
,
"csv"
,
"xml"
,
"js"
,
"def"
,
"dev"
,
"h"
,
"Driver"
,
"properties"
,
"win"
,
"task"
,
"php"
,
""
};
private
static
final
String
[]
SUFFIX
=
new
String
[]{
"java"
,
"sql"
,
"cpp"
,
"txt"
,
"html"
,
"xml"
,
"jsp"
,
"css"
,
"bat"
,
"nsi"
,
"csv"
,
"xml"
,
"js"
,
"def"
,
"dev"
,
"h"
,
"Driver"
,
"properties"
,
"win"
,
"task"
,
"php"
,
""
};
private
static
final
String
[]
IGNORE
=
new
String
[]{
"gif"
,
"png"
,
"odg"
,
"ico"
,
"sxd"
,
"zip"
,
"bz2"
,
"rc"
,
"layout"
,
"res"
,
"dll"
,
"jar"
};
private
static
final
String
[]
IGNORE
=
new
String
[]{
"gif"
,
"png"
,
"odg"
,
"ico"
,
"sxd"
,
"zip"
,
"bz2"
,
"rc"
,
"layout"
,
"res"
,
"dll"
,
"jar"
};
...
@@ -30,13 +32,29 @@ public class SpellChecker {
...
@@ -30,13 +32,29 @@ public class SpellChecker {
private
void
run
(
String
dictionary
,
String
dir
)
throws
IOException
{
private
void
run
(
String
dictionary
,
String
dir
)
throws
IOException
{
process
(
new
File
(
dir
+
"/"
+
dictionary
));
process
(
new
File
(
dir
+
"/"
+
dictionary
));
process
(
new
File
(
dir
));
process
(
new
File
(
dir
));
System
.
out
.
println
(
"used words"
);
if
(
printDictionary
)
{
for
(
Iterator
it
=
used
.
iterator
();
it
.
hasNext
();)
{
System
.
out
.
println
(
"USED WORDS"
);
String
s
=
(
String
)
it
.
next
();
String
[]
list
=
new
String
[
used
.
size
()];
System
.
out
.
print
(
s
+
" "
);
used
.
toArray
(
list
);
Arrays
.
sort
(
list
);
StringBuffer
buff
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
list
.
length
;
i
++)
{
String
s
=
list
[
i
];
if
(
buff
.
length
()
>
0
)
{
if
(
buff
.
length
()
+
s
.
length
()
>
80
)
{
System
.
out
.
println
(
buff
.
toString
());
buff
.
setLength
(
0
);
}
else
{
buff
.
append
(
' '
);
}
}
buff
.
append
(
s
);
}
}
System
.
out
.
println
(
buff
.
toString
());
}
if
(
unknown
.
size
()
>
0
)
{
System
.
out
.
println
();
System
.
out
.
println
();
System
.
out
.
println
(
"ALL UNKNOWN ----------------------------
"
);
System
.
out
.
println
(
"UNKNOWN WORDS
"
);
for
(
Iterator
it
=
unknown
.
keySet
().
iterator
();
it
.
hasNext
();)
{
for
(
Iterator
it
=
unknown
.
keySet
().
iterator
();
it
.
hasNext
();)
{
String
s
=
(
String
)
it
.
next
();
String
s
=
(
String
)
it
.
next
();
int
count
=
((
Integer
)
unknown
.
get
(
s
)).
intValue
();
int
count
=
((
Integer
)
unknown
.
get
(
s
)).
intValue
();
...
@@ -45,7 +63,6 @@ public class SpellChecker {
...
@@ -45,7 +63,6 @@ public class SpellChecker {
}
}
}
}
System
.
out
.
println
();
System
.
out
.
println
();
if
(
unknown
.
size
()
>
0
)
{
throw
new
IOException
(
"spell check failed"
);
throw
new
IOException
(
"spell check failed"
);
}
}
}
}
...
@@ -57,9 +74,9 @@ public class SpellChecker {
...
@@ -57,9 +74,9 @@ public class SpellChecker {
}
}
int
removeThisLater
;
int
removeThisLater
;
if
(
name
.
indexOf
(
"\\test\\"
)
>=
0
)
{
//
if(name.indexOf("\\test\\") >= 0) {
return
;
//
return;
}
//
}
if
(
file
.
isDirectory
())
{
if
(
file
.
isDirectory
())
{
File
[]
list
=
file
.
listFiles
();
File
[]
list
=
file
.
listFiles
();
...
@@ -115,7 +132,7 @@ public class SpellChecker {
...
@@ -115,7 +132,7 @@ public class SpellChecker {
}
}
private
void
scan
(
String
fileName
,
String
text
)
{
private
void
scan
(
String
fileName
,
String
text
)
{
HashSet
not
f
ound
=
new
HashSet
();
HashSet
not
F
ound
=
new
HashSet
();
StringTokenizer
tokenizer
=
new
StringTokenizer
(
text
,
"\r\n \t+\"*%&/()='[]{},.-;:_<>\\!?$@#|~^`"
);
StringTokenizer
tokenizer
=
new
StringTokenizer
(
text
,
"\r\n \t+\"*%&/()='[]{},.-;:_<>\\!?$@#|~^`"
);
while
(
tokenizer
.
hasMoreTokens
())
{
while
(
tokenizer
.
hasMoreTokens
())
{
String
token
=
tokenizer
.
nextToken
();
String
token
=
tokenizer
.
nextToken
();
...
@@ -126,17 +143,17 @@ public class SpellChecker {
...
@@ -126,17 +143,17 @@ public class SpellChecker {
if
(!
addToDictionary
&&
debug
)
{
if
(!
addToDictionary
&&
debug
)
{
System
.
out
.
print
(
token
+
" "
);
System
.
out
.
print
(
token
+
" "
);
}
}
scanCombinedToken
(
not
f
ound
,
token
);
scanCombinedToken
(
not
F
ound
,
token
);
if
(!
addToDictionary
&&
debug
)
{
if
(!
addToDictionary
&&
debug
)
{
System
.
out
.
println
();
System
.
out
.
println
();
}
}
}
}
if
(
not
f
ound
.
isEmpty
())
{
if
(
not
F
ound
.
isEmpty
())
{
return
;
return
;
}
}
if
(
not
f
ound
.
size
()
>
0
)
{
if
(
not
F
ound
.
size
()
>
0
)
{
System
.
out
.
println
(
"file: "
+
fileName
);
System
.
out
.
println
(
"file: "
+
fileName
);
for
(
Iterator
it
=
not
f
ound
.
iterator
();
it
.
hasNext
();)
{
for
(
Iterator
it
=
not
F
ound
.
iterator
();
it
.
hasNext
();)
{
String
s
=
(
String
)
it
.
next
();
String
s
=
(
String
)
it
.
next
();
System
.
out
.
print
(
s
+
" "
);
System
.
out
.
print
(
s
+
" "
);
}
}
...
@@ -144,24 +161,24 @@ public class SpellChecker {
...
@@ -144,24 +161,24 @@ public class SpellChecker {
}
}
}
}
private
void
scanCombinedToken
(
HashSet
not
f
ound
,
String
token
)
{
private
void
scanCombinedToken
(
HashSet
not
F
ound
,
String
token
)
{
for
(
int
i
=
1
;
i
<
token
.
length
();
i
++)
{
for
(
int
i
=
1
;
i
<
token
.
length
();
i
++)
{
char
c
l
eft
=
token
.
charAt
(
i
-
1
);
char
c
harL
eft
=
token
.
charAt
(
i
-
1
);
char
c
r
ight
=
token
.
charAt
(
i
);
char
c
harR
ight
=
token
.
charAt
(
i
);
if
(
Character
.
isLowerCase
(
c
left
)
&&
Character
.
isUpperCase
(
cr
ight
))
{
if
(
Character
.
isLowerCase
(
c
harLeft
)
&&
Character
.
isUpperCase
(
charR
ight
))
{
scanToken
(
not
f
ound
,
token
.
substring
(
0
,
i
));
scanToken
(
not
F
ound
,
token
.
substring
(
0
,
i
));
token
=
token
.
substring
(
i
);
token
=
token
.
substring
(
i
);
i
=
1
;
i
=
1
;
}
else
if
(
Character
.
isUpperCase
(
c
left
)
&&
Character
.
isLowerCase
(
cr
ight
))
{
}
else
if
(
Character
.
isUpperCase
(
c
harLeft
)
&&
Character
.
isLowerCase
(
charR
ight
))
{
scanToken
(
not
f
ound
,
token
.
substring
(
0
,
i
-
1
));
scanToken
(
not
F
ound
,
token
.
substring
(
0
,
i
-
1
));
token
=
token
.
substring
(
i
-
1
);
token
=
token
.
substring
(
i
-
1
);
i
=
1
;
i
=
1
;
}
}
}
}
scanToken
(
not
f
ound
,
token
);
scanToken
(
not
F
ound
,
token
);
}
}
private
void
scanToken
(
HashSet
not
f
ound
,
String
token
)
{
private
void
scanToken
(
HashSet
not
F
ound
,
String
token
)
{
if
(
token
.
length
()
<
3
)
{
if
(
token
.
length
()
<
3
)
{
return
;
return
;
}
}
...
@@ -188,7 +205,7 @@ public class SpellChecker {
...
@@ -188,7 +205,7 @@ public class SpellChecker {
dictionary
.
add
(
token
);
dictionary
.
add
(
token
);
}
else
{
}
else
{
if
(!
dictionary
.
contains
(
token
))
{
if
(!
dictionary
.
contains
(
token
))
{
not
f
ound
.
add
(
token
);
not
F
ound
.
add
(
token
);
increment
(
unknown
,
token
);
increment
(
unknown
,
token
);
}
else
{
}
else
{
used
.
add
(
token
);
used
.
add
(
token
);
...
...
h2/src/tools/org/h2/tools/doc/XMLChecker.java
浏览文件 @
0ea30d28
...
@@ -89,7 +89,7 @@ public class XMLChecker {
...
@@ -89,7 +89,7 @@ public class XMLChecker {
private
static
void
checkXML
(
String
xml
,
boolean
html
)
throws
Exception
{
private
static
void
checkXML
(
String
xml
,
boolean
html
)
throws
Exception
{
String
lastElement
=
null
;
String
lastElement
=
null
;
String
[]
no
c
lose
=
new
String
[]{
String
[]
no
C
lose
=
new
String
[]{
"li"
,
"link"
,
"meta"
,
"br"
,
"img"
,
"input"
,
"hr"
,
"frame"
"li"
,
"link"
,
"meta"
,
"br"
,
"img"
,
"input"
,
"hr"
,
"frame"
};
};
XMLParser
parser
=
new
XMLParser
(
xml
);
XMLParser
parser
=
new
XMLParser
(
xml
);
...
@@ -110,8 +110,8 @@ public class XMLChecker {
...
@@ -110,8 +110,8 @@ public class XMLChecker {
if
(
html
&&
name
.
equals
(
"table"
)
&&
lastElement
.
trim
().
length
()
>
0
)
{
if
(
html
&&
name
.
equals
(
"table"
)
&&
lastElement
.
trim
().
length
()
>
0
)
{
throw
new
Exception
(
"Test before table: "
+
lastElement
);
throw
new
Exception
(
"Test before table: "
+
lastElement
);
}
}
for
(
int
i
=
0
;
html
&&
i
<
no
c
lose
.
length
;
i
++)
{
for
(
int
i
=
0
;
html
&&
i
<
no
C
lose
.
length
;
i
++)
{
if
(
name
.
equals
(
no
c
lose
[
i
]))
{
if
(
name
.
equals
(
no
C
lose
[
i
]))
{
name
=
null
;
name
=
null
;
break
;
break
;
}
}
...
@@ -121,8 +121,8 @@ public class XMLChecker {
...
@@ -121,8 +121,8 @@ public class XMLChecker {
}
}
}
else
if
(
event
==
XMLParser
.
END_ELEMENT
)
{
}
else
if
(
event
==
XMLParser
.
END_ELEMENT
)
{
String
name
=
parser
.
getName
();
String
name
=
parser
.
getName
();
for
(
int
i
=
0
;
html
&&
i
<
no
c
lose
.
length
;
i
++)
{
for
(
int
i
=
0
;
html
&&
i
<
no
C
lose
.
length
;
i
++)
{
if
(
name
.
equals
(
no
c
lose
[
i
]))
{
if
(
name
.
equals
(
no
C
lose
[
i
]))
{
throw
new
Exception
(
"Unnecessary closing element "
+
name
+
" at "
+
parser
.
getRemaining
());
throw
new
Exception
(
"Unnecessary closing element "
+
name
+
" at "
+
parser
.
getRemaining
());
}
}
}
}
...
...
h2/src/tools/org/h2/tools/doc/dictionary.txt
浏览文件 @
0ea30d28
差异被折叠。
点击展开。
h2/src/tools/org/h2/tools/indexer/HtmlConverter.java
浏览文件 @
0ea30d28
...
@@ -8,6 +8,7 @@ import java.util.HashMap;
...
@@ -8,6 +8,7 @@ import java.util.HashMap;
public
class
HtmlConverter
{
public
class
HtmlConverter
{
private
static
HashMap
charMap
=
new
HashMap
();
private
static
HashMap
charMap
=
new
HashMap
();
private
static
HashMap
codeMap
=
new
HashMap
();
private
static
final
String
[]
CHARS
=
{
private
static
final
String
[]
CHARS
=
{
"quot:34"
,
"amp:38"
,
"lt:60"
,
"gt:62"
,
"nbsp:160"
,
"iexcl:161"
,
"cent:162"
,
"quot:34"
,
"amp:38"
,
"lt:60"
,
"gt:62"
,
"nbsp:160"
,
"iexcl:161"
,
"cent:162"
,
...
@@ -58,11 +59,43 @@ public class HtmlConverter {
...
@@ -58,11 +59,43 @@ public class HtmlConverter {
int
idx
=
token
.
indexOf
(
':'
);
int
idx
=
token
.
indexOf
(
':'
);
String
key
=
token
.
substring
(
0
,
idx
);
String
key
=
token
.
substring
(
0
,
idx
);
int
ch
=
Integer
.
parseInt
(
token
.
substring
(
idx
+
1
));
int
ch
=
Integer
.
parseInt
(
token
.
substring
(
idx
+
1
));
charMap
.
put
(
key
,
new
Character
((
char
)
ch
));
Character
character
=
new
Character
((
char
)
ch
);
charMap
.
put
(
key
,
character
);
codeMap
.
put
(
character
,
key
);
}
}
}
}
public
static
String
convertHtml
(
String
html
)
{
public
static
String
convertStringToHtml
(
String
s
)
{
if
(
s
==
null
)
{
return
null
;
}
if
(
s
.
length
()
==
0
)
{
return
s
;
}
StringBuffer
buff
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
s
.
length
();
i
++)
{
char
ch
=
s
.
charAt
(
i
);
Character
c
=
new
Character
(
ch
);
String
token
=
(
String
)
codeMap
.
get
(
c
);
if
(
token
==
null
)
{
if
(
ch
<
128
)
{
buff
.
append
(
ch
);
}
else
{
buff
.
append
(
'&'
);
buff
.
append
(
'#'
);
buff
.
append
((
int
)
ch
);
buff
.
append
(
';'
);
}
}
else
{
buff
.
append
(
'&'
);
buff
.
append
(
token
);
buff
.
append
(
';'
);
}
}
return
buff
.
toString
();
}
public
static
String
convertHtmlToString
(
String
html
)
{
if
(
html
==
null
)
{
if
(
html
==
null
)
{
return
null
;
return
null
;
}
}
...
@@ -111,5 +144,4 @@ public class HtmlConverter {
...
@@ -111,5 +144,4 @@ public class HtmlConverter {
return
buff
.
toString
();
return
buff
.
toString
();
}
}
}
}
h2/src/tools/org/h2/tools/indexer/Indexer.java
浏览文件 @
0ea30d28
...
@@ -31,7 +31,7 @@ public class Indexer {
...
@@ -31,7 +31,7 @@ public class Indexer {
boolean
title
;
boolean
title
;
boolean
heading
;
boolean
heading
;
private
static
final
int
MIN_WORDSIZE
=
3
;
private
static
final
int
MIN_WORD
_
SIZE
=
3
;
private
static
final
int
MAX_RELATIONS
=
20
;
private
static
final
int
MAX_RELATIONS
=
20
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
...
@@ -222,7 +222,7 @@ public class Indexer {
...
@@ -222,7 +222,7 @@ public class Indexer {
// buff.append(weight.value);
// buff.append(weight.value);
}
}
}
}
// TODO optimization: could support "a name=" and go to _first_ occur
a
nce, or scan page and mark
// TODO optimization: could support "a name=" and go to _first_ occur
re
nce, or scan page and mark
output
.
println
(
"ref['"
+
convertUTF
(
first
)+
"']='"
+
buff
.
toString
()+
"';"
);
output
.
println
(
"ref['"
+
convertUTF
(
first
)+
"']='"
+
buff
.
toString
()+
"';"
);
output
.
println
(
"// totalRelations: "
+
totalRelations
);
output
.
println
(
"// totalRelations: "
+
totalRelations
);
}
}
...
@@ -290,7 +290,7 @@ public class Indexer {
...
@@ -290,7 +290,7 @@ public class Indexer {
}
}
void
process
(
String
text
)
{
void
process
(
String
text
)
{
text
=
HtmlConverter
.
convertHtml
(
text
);
text
=
HtmlConverter
.
convertHtml
ToString
(
text
);
if
(
title
)
{
if
(
title
)
{
if
(
page
.
title
==
null
)
{
if
(
page
.
title
==
null
)
{
page
.
title
=
text
;
page
.
title
=
text
;
...
@@ -312,7 +312,7 @@ public class Indexer {
...
@@ -312,7 +312,7 @@ public class Indexer {
false
);
false
);
while
(
t
.
hasMoreTokens
())
{
while
(
t
.
hasMoreTokens
())
{
String
token
=
t
.
nextToken
();
String
token
=
t
.
nextToken
();
if
(
token
.
length
()<
MIN_WORDSIZE
)
{
if
(
token
.
length
()<
MIN_WORD
_
SIZE
)
{
continue
;
continue
;
}
}
if
(
Character
.
isDigit
(
token
.
charAt
(
0
)))
{
if
(
Character
.
isDigit
(
token
.
charAt
(
0
)))
{
...
...
h2/src/tools/org/h2/tools/jpox/H2Adapter.java.txt
浏览文件 @
0ea30d28
...
@@ -47,7 +47,7 @@ class H2Adapter extends DatabaseAdapter
...
@@ -47,7 +47,7 @@ class H2Adapter extends DatabaseAdapter
private String schemaName;
private String schemaName;
/**
/**
* Constructs a H2 adapter based on the given JDBCmetadata.
* Constructs a H2 adapter based on the given JDBC
metadata.
* @param dictionary The Dictionary to use
* @param dictionary The Dictionary to use
* @param metadata the database metadata.
* @param metadata the database metadata.
*/
*/
...
@@ -75,7 +75,7 @@ class H2Adapter extends DatabaseAdapter
...
@@ -75,7 +75,7 @@ class H2Adapter extends DatabaseAdapter
}
}
/**
/**
*
Accesso
r for the vendor ID for this adapter.
*
Gette
r for the vendor ID for this adapter.
* @return The vendor ID
* @return The vendor ID
*/
*/
public String getVendorID()
public String getVendorID()
...
@@ -85,7 +85,7 @@ class H2Adapter extends DatabaseAdapter
...
@@ -85,7 +85,7 @@ class H2Adapter extends DatabaseAdapter
/**
/**
* Accessor for a Connection to the datastore.
* Accessor for a Connection to the datastore.
* @param ds The data source. Possible to have more than one data
source for fail
over
* @param ds The data source. Possible to have more than one data
source for fail
over
* @param userName The username for the datastore
* @param userName The username for the datastore
* @param password The password for the datastore
* @param password The password for the datastore
* @param isolationLevel The level of transaction isolation
* @param isolationLevel The level of transaction isolation
...
@@ -149,7 +149,7 @@ class H2Adapter extends DatabaseAdapter
...
@@ -149,7 +149,7 @@ class H2Adapter extends DatabaseAdapter
/**
/**
* Method to return the SQL to append to the SELECT clause of a SELECT statement to handle
* Method to return the SQL to append to the SELECT clause of a SELECT statement to handle
* restriction of ranges using the LIM
U
T keyword.
* restriction of ranges using the LIM
I
T keyword.
* @param offset The offset to return from
* @param offset The offset to return from
* @param count The number of items to return
* @param count The number of items to return
* @return The SQL to append to allow for ranges using LIMIT.
* @return The SQL to append to allow for ranges using LIMIT.
...
@@ -244,8 +244,8 @@ class H2Adapter extends DatabaseAdapter
...
@@ -244,8 +244,8 @@ class H2Adapter extends DatabaseAdapter
}
}
/**
/**
* Whether we support autoincrementing fields.
* Whether we support auto
incrementing fields.
* @return whether we support autoincrementing fields.
* @return whether we support auto
incrementing fields.
**/
**/
public boolean supportsAutoIncrementFields()
public boolean supportsAutoIncrementFields()
{
{
...
@@ -264,7 +264,7 @@ class H2Adapter extends DatabaseAdapter
...
@@ -264,7 +264,7 @@ class H2Adapter extends DatabaseAdapter
}
}
/**
/**
* Accessor for the auto-increment keyword for generating DDLs (CREATE TABLE
s
...).
* Accessor for the auto-increment keyword for generating DDLs (CREATE TABLE...).
* @return The keyword for a column using auto-increment
* @return The keyword for a column using auto-increment
**/
**/
public String getAutoIncrementKeyword()
public String getAutoIncrementKeyword()
...
@@ -273,7 +273,7 @@ class H2Adapter extends DatabaseAdapter
...
@@ -273,7 +273,7 @@ class H2Adapter extends DatabaseAdapter
}
}
/**
/**
* Method to retu
t
n the INSERT statement to use when inserting into a table that has no
* Method to retu
r
n the INSERT statement to use when inserting into a table that has no
* columns specified. This is the case when we have a single column in the table and that column
* columns specified. This is the case when we have a single column in the table and that column
* is autoincrement/identity (and so is assigned automatically in the datastore).
* is autoincrement/identity (and so is assigned automatically in the datastore).
* @param table The table
* @param table The table
...
@@ -298,7 +298,7 @@ class H2Adapter extends DatabaseAdapter
...
@@ -298,7 +298,7 @@ class H2Adapter extends DatabaseAdapter
* Whether this datastore supports the use of CHECK after the column
* Whether this datastore supports the use of CHECK after the column
* definitions in CREATE TABLE statements (DDL).
* definitions in CREATE TABLE statements (DDL).
* e.g.
* e.g.
* CREATE TABLE X
XX
* CREATE TABLE X
YZ
* (
* (
* COL_A int,
* COL_A int,
* COL_B char(1),
* COL_B char(1),
...
...
h2/src/tools/org/hibernate/dialect/H2Dialect.java.txt
浏览文件 @
0ea30d28
...
@@ -28,8 +28,8 @@ public class H2Dialect extends Dialect {
...
@@ -28,8 +28,8 @@ public class H2Dialect extends Dialect {
try {
try {
Class constants = ReflectHelper.classForName( "org.h2.engine.Constants" );
Class constants = ReflectHelper.classForName( "org.h2.engine.Constants" );
Integer build = (Integer)constants.getDeclaredField("BUILD_ID" ).get(null);
Integer build = (Integer)constants.getDeclaredField("BUILD_ID" ).get(null);
int build
i
d = build.intValue();
int build
I
d = build.intValue();
if(build
i
d < 32) {
if(build
I
d < 32) {
querySequenceString = "select name from information_schema.sequences";
querySequenceString = "select name from information_schema.sequences";
}
}
} catch(Throwable e) {
} catch(Throwable e) {
...
@@ -141,7 +141,7 @@ public class H2Dialect extends Dialect {
...
@@ -141,7 +141,7 @@ public class H2Dialect extends Dialect {
// registerFunction("minute", new StandardSQLFunction("minute", Hibernate.INTEGER));
// registerFunction("minute", new StandardSQLFunction("minute", Hibernate.INTEGER));
// registerFunction("month", new StandardSQLFunction("month", Hibernate.INTEGER));
// registerFunction("month", new StandardSQLFunction("month", Hibernate.INTEGER));
registerFunction("monthname", new StandardSQLFunction("monthname", Hibernate.STRING));
registerFunction("monthname", new StandardSQLFunction("monthname", Hibernate.STRING));
registerFunction("qua
ter", new StandardSQLFunction("qua
ter", Hibernate.INTEGER));
registerFunction("qua
rter", new StandardSQLFunction("quar
ter", Hibernate.INTEGER));
// registerFunction("second", new StandardSQLFunction("second", Hibernate.INTEGER));
// registerFunction("second", new StandardSQLFunction("second", Hibernate.INTEGER));
registerFunction("week", new StandardSQLFunction("week", Hibernate.INTEGER));
registerFunction("week", new StandardSQLFunction("week", Hibernate.INTEGER));
// registerFunction("year", new StandardSQLFunction("year", Hibernate.INTEGER));
// registerFunction("year", new StandardSQLFunction("year", Hibernate.INTEGER));
...
@@ -246,15 +246,15 @@ public class H2Dialect extends Dialect {
...
@@ -246,15 +246,15 @@ public class H2Dialect extends Dialect {
/**
/**
* Extract the name of the violated constraint from the given SQLException.
* Extract the name of the violated constraint from the given SQLException.
*
*
* @param
sql
e The exception that was the result of the constraint violation.
* @param e The exception that was the result of the constraint violation.
* @return The extracted constraint name.
* @return The extracted constraint name.
*/
*/
public String extractConstraintName(SQLException
sql
e) {
public String extractConstraintName(SQLException e) {
String constraintName = null;
String constraintName = null;
// 23000: Check constraint violation: {0}
// 23000: Check constraint violation: {0}
// 23001: Unique index or primary key violation: {0}
// 23001: Unique index or primary key violation: {0}
if(
sql
e.getSQLState().startsWith("23")) {
if(e.getSQLState().startsWith("23")) {
String message =
sql
e.getMessage();
String message = e.getMessage();
int idx = message.indexOf("violation: ");
int idx = message.indexOf("violation: ");
if(idx > 0) {
if(idx > 0) {
constraintName = message.substring(idx + "violation: ".length());
constraintName = message.substring(idx + "violation: ".length());
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论