Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
b2804693
提交
b2804693
authored
4月 12, 2008
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
78e7ad72
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
29 个修改的文件
包含
1768 行增加
和
1218 行删除
+1768
-1218
build.bat
h2/build.bat
+6
-0
build.xml
h2/build.xml
+20
-28
installation.html
h2/src/docsrc/html/installation.html
+4
-0
search.html
h2/src/docsrc/html/search.html
+1
-1
tutorial.html
h2/src/docsrc/html/tutorial.html
+12
-7
_docs_en.utf8.txt
h2/src/docsrc/text/_docs_en.utf8.txt
+310
-262
_docs_ja.utf8.txt
h2/src/docsrc/text/_docs_ja.utf8.txt
+385
-262
_docs_en.properties
h2/src/docsrc/textbase/_docs_en.properties
+279
-263
MANIFEST.MF
h2/src/main/META-INF/MANIFEST.MF
+7
-0
BackupCommand.java
h2/src/main/org/h2/command/dml/BackupCommand.java
+1
-0
Constants.java
h2/src/main/org/h2/engine/Constants.java
+4
-2
JdbcDatabaseMetaData.java
h2/src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
+2
-2
TraceObject.java
h2/src/main/org/h2/message/TraceObject.java
+1
-1
PgServer.java
h2/src/main/org/h2/server/pg/PgServer.java
+1
-1
PgServerThread.java
h2/src/main/org/h2/server/pg/PgServerThread.java
+7
-1
WebThread.java
h2/src/main/org/h2/server/web/WebThread.java
+6
-24
MetaTable.java
h2/src/main/org/h2/table/MetaTable.java
+1
-1
Console.java
h2/src/main/org/h2/tools/Console.java
+5
-7
Shell.java
h2/src/main/org/h2/tools/Shell.java
+1
-1
Resources.java
h2/src/main/org/h2/util/Resources.java
+36
-1
CsvSample.java
h2/src/test/org/h2/samples/CsvSample.java
+1
-0
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+47
-1
Build.java
h2/src/tools/org/h2/build/Build.java
+166
-0
BuildBase.java
h2/src/tools/org/h2/build/BuildBase.java
+443
-0
CheckTextFiles.java
h2/src/tools/org/h2/build/code/CheckTextFiles.java
+4
-3
CodeSwitch.java
h2/src/tools/org/h2/build/code/CodeSwitch.java
+0
-347
SpellChecker.java
h2/src/tools/org/h2/build/doc/SpellChecker.java
+1
-1
dictionary.txt
h2/src/tools/org/h2/build/doc/dictionary.txt
+4
-2
package.html
h2/src/tools/org/h2/build/package.html
+13
-0
没有找到文件。
h2/build.bat
0 → 100644
浏览文件 @
b2804693
@echo off
if exist bin/org/h2/build/Build.class goto buildOK
if not exist bin mkdir bin
javac -sourcepath src/tools -d bin src/tools/org/h2/build/*.java
:buildOK
java -cp "bin;target;%JAVA_HOME%/lib/tools.jar" org.h2.build.Build %1
\ No newline at end of file
h2/build.xml
浏览文件 @
b2804693
...
...
@@ -44,20 +44,8 @@
</delete>
</target>
<target
name=
"compileResources"
depends=
"clean"
>
<javac
executable=
"${javac}"
srcdir=
"src/main"
destdir=
"bin"
debug=
"true"
includes=
"org/h2/util/Resources.java"
/>
<java
classname=
"org.h2.util.Resources"
classpath=
"bin"
/>
<delete>
<fileset
dir=
"bin"
includes=
"org/h2/util/ResourceData.class"
/>
</delete>
<javac
executable=
"${javac}"
srcdir=
"bin"
destdir=
"bin"
debug=
"true"
includes=
"org/h2/util/ResourceData.java"
/>
<delete>
<fileset
dir=
"bin"
includes=
"org/h2/util/ResourceData.java"
/>
</delete>
</target>
<target
name=
"compile"
depends=
"compileResources, switchSourceAuto, downloadServletJar, downloadLuceneJar"
>
<javac
executable=
"${javac}"
destdir=
"bin"
debug=
"true"
>
<target
name=
"compile"
depends=
"switchSourceAuto, resources, downloadServletJar, downloadLuceneJar"
>
<javac
executable=
"${javac}"
destdir=
"bin"
debug=
"true"
debuglevel=
"lines,source"
>
<classpath
location=
"ext/servlet-api-2.4.jar"
/>
<classpath
location=
"ext/lucene-core-2.2.0.jar"
/>
<src
path=
"src/main"
/>
...
...
@@ -65,13 +53,9 @@
<src
path=
"src/tools"
/>
</javac>
<copy
todir=
"bin"
overwrite=
"true"
>
<fileset
dir=
"src/main"
includes=
"META-INF/**/*"
/>
<fileset
dir=
"src/main"
includes=
"**/*.png"
/>
<fileset
dir=
"src/main"
includes=
"**/*.sql"
/>
<fileset
dir=
"src/main"
includes=
"META-INF/services/*"
/>
<fileset
dir=
"src/installer"
includes=
"*.bat"
/>
<fileset
dir=
"src/test"
includes=
"**/*.txt"
/>
<fileset
dir=
"src/test"
includes=
"**/*.sql"
/>
<fileset
dir=
"src/test"
includes=
"**/*.properties"
/>
<fileset
dir=
"src/test"
excludes=
"**/*.java,**/package.html"
/>
</copy>
</target>
...
...
@@ -82,7 +66,7 @@
<java
classname=
"org.h2.test.coverage.Coverage"
classpath=
"."
dir=
"bin"
fork=
"true"
>
<arg
line=
"-r org/h2"
/>
</java>
<javac
executable=
"${javac}"
srcdir=
"bin"
destdir=
"bin"
debug=
"true"
includes=
"org/h2/**"
/>
<javac
executable=
"${javac}"
srcdir=
"bin"
destdir=
"bin"
debug=
"true"
debuglevel=
"lines,source"
includes=
"org/h2/**"
/>
</target>
<target
name=
"docs"
depends=
"clean, javadoc, compile"
>
...
...
@@ -132,8 +116,8 @@
</jar>
</target>
<target
name=
"jarClient"
depends=
"
compileR
esources, manifest"
>
<javac
executable=
"${javac}"
srcdir=
"src/main"
destdir=
"bin"
debug=
"true"
>
<target
name=
"jarClient"
depends=
"
r
esources, manifest"
>
<javac
executable=
"${javac}"
srcdir=
"src/main"
destdir=
"bin"
debug=
"true"
debuglevel=
"lines,source"
>
<include
name=
"org/h2/*"
/>
<include
name=
"org/h2/jdbc/**"
/>
<include
name=
"org/h2/jdbcx/**"
/>
...
...
@@ -144,7 +128,7 @@
</jar>
</target>
<target
name=
"jarDb"
depends=
"
compileR
esources, manifest"
>
<target
name=
"jarDb"
depends=
"
r
esources, manifest"
>
<javac
executable=
"${javac}"
srcdir=
"src/main"
destdir=
"bin"
debug=
"false"
>
<include
name=
"org/h2/*"
/>
<include
name=
"org/h2/engine/**"
/>
...
...
@@ -158,9 +142,9 @@
</target>
<target
name=
"javadoc"
>
<javac
executable=
"${javac}"
srcdir=
"src/main"
destdir=
"bin"
debug=
"true"
includes=
"org/h2/util/StringUtils.java"
/>
<javac
executable=
"${javac}"
srcdir=
"src/test"
destdir=
"bin"
debug=
"true"
includes=
"org/h2/test/bnf/*.java"
/>
<javac
executable=
"${javac}"
srcdir=
"src/tools"
destdir=
"bin"
debug=
"true"
includes=
"org/h2/build/doclet/*.java"
/>
<javac
executable=
"${javac}"
srcdir=
"src/main"
destdir=
"bin"
debug=
"true"
debuglevel=
"lines,source"
includes=
"org/h2/util/StringUtils.java"
/>
<javac
executable=
"${javac}"
srcdir=
"src/test"
destdir=
"bin"
debug=
"true"
debuglevel=
"lines,source"
includes=
"org/h2/test/bnf/*.java"
/>
<javac
executable=
"${javac}"
srcdir=
"src/tools"
destdir=
"bin"
debug=
"true"
debuglevel=
"lines,source"
includes=
"org/h2/build/doclet/*.java"
/>
<mkdir
dir=
"docs/javadoc"
/>
<javadoc
sourcepath=
"src/main"
...
...
@@ -240,8 +224,16 @@
</exec>
</target>
<target
name=
"resources"
depends=
"clean"
>
<mkdir
dir=
"bin/org/h2/util"
/>
<zip
destfile=
"bin/org/h2/util/data.zip"
basedir=
"src/main"
compress=
"false"
excludes=
"**/*.java,**/package.html,**/java.sql.Driver"
/>
</target>
<target
name=
"switchSourcePrepare"
depends=
"clean"
>
<javac
executable=
"${javac}"
srcdir=
"src/tools"
destdir=
"bin"
debug=
"true"
includes=
"org/h2/build/code/SwitchSource.java"
/>
<javac
executable=
"${javac}"
srcdir=
"src/tools"
destdir=
"bin"
debug=
"true"
debuglevel=
"lines,source"
includes=
"org/h2/build/code/SwitchSource.java"
/>
</target>
<target
name=
"switchSourceAndroid"
depends=
"switchSourcePrepare"
>
...
...
h2/src/docsrc/html/installation.html
浏览文件 @
b2804693
...
...
@@ -76,6 +76,10 @@ After installing, you should get the following directory structure:
<td>
docs/javadoc
</td>
<td>
Javadoc files
</td>
</tr>
<tr>
<td>
ext
</td>
<td>
External dependencies (downloaded when building)
</td>
</tr>
<tr>
<td>
service
</td>
<td>
Tools to run the database as a Windows Service
</td>
...
...
h2/src/docsrc/html/search.html
浏览文件 @
b2804693
...
...
@@ -12,7 +12,7 @@ Initial Developer: H2 Group
<script
type=
"text/javascript"
src=
"search.js"
></script>
<script
type=
"text/javascript"
src=
"navigation.js"
></script>
</head>
<body
style=
"margin: 10px 0px 0px
0
px;"
onload=
"frameMe('menu');"
>
<body
style=
"margin: 10px 0px 0px
4
px;"
onload=
"frameMe('menu');"
>
<div
class=
"menu"
>
<img
border=
"0"
src=
"images/h2-logo.png"
alt=
"H2 Logo"
onclick=
"document.location='main.html'"
/>
...
...
h2/src/docsrc/html/tutorial.html
浏览文件 @
b2804693
...
...
@@ -413,13 +413,16 @@ SELECT * FROM CSVREAD('test.csv');
The CSV tool can be used in a Java application even when not using a database at all.
Example:
<pre>
import org.h2.tools.Csv;
import org.h2.tools.SimpleResultSet;
...
SimpleResultSet rs = new SimpleResultSet();
rs.addColumn("NAME", Types.VARCHAR, 255, 0);
rs.addColumn("EMAIL", Types.VARCHAR, 255, 0);
rs.addColumn("PHONE", Types.VARCHAR, 255, 0);
rs.addRow(new String[]
{"Bob Meier", "bob.meier@abcde.abc", "+41123456789"
});
rs.addRow(new String[]
{"John Jones", "john.jones@abcde.abc", "+41976543210"
});
Csv.
write("
test.csv", rs, null);
rs.addRow(new String[]
{ "Bob Meier", "bob.meier@abcde.abc", "+41123456789"
});
rs.addRow(new String[]
{ "John Jones", "john.jones@abcde.abc", "+41976543210"
});
Csv.
getInstance().write("data/
test.csv", rs, null);
</pre>
</p>
...
...
@@ -428,11 +431,13 @@ Csv.write("test.csv", rs, null);
It is possible to read a CSV file without opening a database.
Example:
<pre>
ResultSet rs = Csv.read("test.csv", null, null);
import org.h2.tools.Csv;
...
ResultSet rs = Csv.getInstance().read("data/test.csv", null, null);
ResultSetMetaData meta = rs.getMetaData();
while(rs.next()) {
for
(int i=0; i
<
meta.getColumnCount(); i++) {
System.out.println(meta.getColumnLabel(i
+1) + ": " + rs.getString(i+
1));
while
(rs.next()) {
for
(int i = 0; i
<
meta.getColumnCount(); i++) {
System.out.println(meta.getColumnLabel(i
+ 1) + ": " + rs.getString(i +
1));
}
System.out.println();
}
...
...
h2/src/docsrc/text/_docs_en.utf8.txt
浏览文件 @
b2804693
差异被折叠。
点击展开。
h2/src/docsrc/text/_docs_ja.utf8.txt
浏览文件 @
b2804693
差异被折叠。
点击展开。
h2/src/docsrc/textbase/_docs_en.properties
浏览文件 @
b2804693
差异被折叠。
点击展开。
h2/src/main/META-INF/MANIFEST.MF
0 → 100644
浏览文件 @
b2804693
Manifest-Version: 1.0
Implementation-Title: H2 Database Engine
Implementation-URL: http://www.h2database.com
Implementation-Version: ${version}
Build-Jdk: ${buildJdk}
Created-By: ${createdBy}
${mainClassTag}
h2/src/main/org/h2/command/dml/BackupCommand.java
浏览文件 @
b2804693
...
...
@@ -150,6 +150,7 @@ public class BackupCommand extends Prepared {
}
return
f
;
}
public
boolean
needRecompile
()
{
return
false
;
}
...
...
h2/src/main/org/h2/engine/Constants.java
浏览文件 @
b2804693
...
...
@@ -87,6 +87,8 @@ public class Constants {
public
static
final
int
VERSION_MAJOR
=
1
;
public
static
final
int
VERSION_MINOR
=
0
;
public
static
final
String
VERSION
=
VERSION_MAJOR
+
"."
+
VERSION_MINOR
+
"."
+
BUILD_ID
;
public
static
final
int
FILE_BLOCK_SIZE
=
16
;
public
static
final
String
MAGIC_FILE_HEADER_TEXT
=
"-- H2 0.5/T -- "
.
substring
(
0
,
FILE_BLOCK_SIZE
-
1
)
+
"\n"
;
...
...
@@ -95,8 +97,8 @@ public class Constants {
public
static
final
int
VERSION_JDBC_MAJOR
=
3
;
public
static
final
int
VERSION_JDBC_MINOR
=
0
;
public
static
String
getVersion
()
{
return
VERSION
_MAJOR
+
"."
+
VERSION_MINOR
+
"."
+
BUILD_ID
+
" ("
+
BUILD
+
")"
;
public
static
String
get
Full
Version
()
{
return
VERSION
+
" ("
+
BUILD
+
")"
;
}
public
static
final
int
DEFAULT_SERVER_PORT
=
9092
;
// this is also in the docs
...
...
h2/src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
浏览文件 @
b2804693
...
...
@@ -65,7 +65,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
*/
public
String
getDatabaseProductVersion
()
{
debugCodeCall
(
"getDatabaseProductVersion"
);
return
Constants
.
getVersion
();
return
Constants
.
get
Full
Version
();
}
/**
...
...
@@ -86,7 +86,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
*/
public
String
getDriverVersion
()
{
debugCodeCall
(
"getDriverVersion"
);
return
Constants
.
getVersion
();
return
Constants
.
get
Full
Version
();
}
/**
...
...
h2/src/main/org/h2/message/TraceObject.java
浏览文件 @
b2804693
...
...
@@ -216,7 +216,7 @@ public class TraceObject {
buff
.
append
(
i
+
1
);
buff
.
append
(
": "
);
ParameterInterface
p
=
(
ParameterInterface
)
params
.
get
(
i
);
if
(
p
==
null
)
{
if
(
p
==
null
||
p
.
getParamValue
()
==
null
)
{
buff
.
append
(
"unset"
);
}
else
{
buff
.
append
(
p
.
getParamValue
().
getSQL
());
...
...
h2/src/main/org/h2/server/pg/PgServer.java
浏览文件 @
b2804693
...
...
@@ -262,7 +262,7 @@ public class PgServer implements Service {
}
public
static
String
getVersion
()
{
return
"PostgreSQL 8.1.4 server protocol using H2 "
+
Constants
.
getVersion
();
return
"PostgreSQL 8.1.4 server protocol using H2 "
+
Constants
.
get
Full
Version
();
}
public
static
Timestamp
getStartTime
()
{
...
...
h2/src/main/org/h2/server/pg/PgServerThread.java
浏览文件 @
b2804693
...
...
@@ -32,9 +32,11 @@ import java.util.HashSet;
import
org.h2.constant.SysProperties
;
import
org.h2.engine.ConnectionInfo
;
import
org.h2.jdbc.JdbcConnection
;
import
org.h2.message.Message
;
import
org.h2.util.IOUtils
;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.ObjectUtils
;
import
org.h2.util.Resources
;
import
org.h2.util.ScriptReader
;
/**
...
...
@@ -605,7 +607,11 @@ public class PgServerThread implements Runnable {
}
}
}
r
=
new
InputStreamReader
(
PgServerThread
.
class
.
getResourceAsStream
(
"pg_catalog.sql"
));
try
{
r
=
new
InputStreamReader
(
new
ByteArrayInputStream
(
Resources
.
get
(
"/org/h2/server/pg/pg_catalog.sql"
)));
}
catch
(
IOException
e
)
{
throw
Message
.
convertIOException
(
e
,
"Can not read pg_catalog resource"
);
}
ScriptReader
reader
=
new
ScriptReader
(
new
BufferedReader
(
r
));
while
(
true
)
{
String
sql
=
reader
.
readStatement
();
...
...
h2/src/main/org/h2/server/web/WebThread.java
浏览文件 @
b2804693
...
...
@@ -1033,7 +1033,7 @@ class WebThread extends Thread implements DatabaseEventListener {
writer
.
println
(
"<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\" /></head>"
);
writer
.
println
(
"<body><h2>Opening Database</h2>URL: "
+
PageParser
.
escapeHtml
(
url
)
+
"<br />"
);
writer
.
println
(
"User: "
+
PageParser
.
escapeHtml
(
user
)
+
"<br />"
);
writer
.
println
(
"Version: "
+
Constants
.
getVersion
()
+
"<br /><br />"
);
writer
.
println
(
"Version: "
+
Constants
.
get
Full
Version
()
+
"<br /><br />"
);
writer
.
flush
();
log
(
"Start..."
);
}
...
...
@@ -1168,7 +1168,7 @@ class WebThread extends Thread implements DatabaseEventListener {
result
=
getStackTrace
(
0
,
t
,
false
);
}
}
else
{
result
=
"Executing Java code is not allowed, use command line parameter
s -webScript true
"
;
result
=
"Executing Java code is not allowed, use command line parameter
-webScript
"
;
}
}
else
if
(
"@AUTOCOMMIT TRUE"
.
equals
(
sql
))
{
conn
.
setAutoCommit
(
true
);
...
...
@@ -1266,28 +1266,10 @@ class WebThread extends Thread implements DatabaseEventListener {
out
.
println
(
importCode
);
out
.
println
(
"public class Java { public static Object run() throws Throwable {"
+
code
+
"}}"
);
out
.
close
();
Process
p
=
Runtime
.
getRuntime
().
exec
(
"javac Java.java"
);
InputStream
processIn
=
p
.
getInputStream
();
InputStream
processErrorIn
=
p
.
getErrorStream
();
StringBuffer
buff
=
new
StringBuffer
();
while
(
true
)
{
int
c
=
processIn
.
read
();
if
(
c
==
-
1
)
{
break
;
}
buff
.
append
((
char
)
c
);
}
while
(
true
)
{
int
c
=
processErrorIn
.
read
();
if
(
c
==
-
1
)
{
break
;
}
buff
.
append
((
char
)
c
);
}
String
error
=
buff
.
toString
().
trim
();
if
(
error
.
length
()
>
0
)
{
throw
new
Exception
(
"Error compiling: "
+
error
);
}
Class
javacClass
=
Class
.
forName
(
"com.sun.tools.javac.Main"
);
Method
compile
=
javacClass
.
getMethod
(
"compile"
,
new
Class
[]
{
String
[].
class
});
Object
javac
=
javacClass
.
newInstance
();
compile
.
invoke
(
javac
,
new
Object
[]
{
new
String
[]{
"Java.java"
}});
byte
[]
data
=
new
byte
[(
int
)
classFile
.
length
()];
DataInputStream
in
=
new
DataInputStream
(
new
FileInputStream
(
classFile
));
in
.
readFully
(
data
);
...
...
h2/src/main/org/h2/table/MetaTable.java
浏览文件 @
b2804693
...
...
@@ -696,7 +696,7 @@ public class MetaTable extends Table {
add
(
rows
,
new
String
[]{
"info.BUILD_ID"
,
""
+
Constants
.
BUILD_ID
});
add
(
rows
,
new
String
[]{
"info.VERSION_MAJOR"
,
""
+
Constants
.
VERSION_MAJOR
});
add
(
rows
,
new
String
[]{
"info.VERSION_MINOR"
,
""
+
Constants
.
VERSION_MINOR
});
add
(
rows
,
new
String
[]{
"info.VERSION"
,
""
+
Constants
.
getVersion
()});
add
(
rows
,
new
String
[]{
"info.VERSION"
,
""
+
Constants
.
get
Full
Version
()});
if
(
session
.
getUser
().
getAdmin
())
{
String
[]
settings
=
new
String
[]{
"java.runtime.version"
,
...
...
h2/src/main/org/h2/tools/Console.java
浏览文件 @
b2804693
...
...
@@ -28,10 +28,9 @@ import java.awt.event.MouseEvent;
import
java.awt.event.MouseListener
;
import
java.awt.event.WindowAdapter
;
import
java.awt.event.WindowEvent
;
import
org.h2.util.
IOUtil
s
;
import
org.h2.util.
Resource
s
;
import
java.io.IOException
;
import
java.io.InputStream
;
//## AWT end ##
import
java.sql.SQLException
;
...
...
@@ -142,12 +141,11 @@ ShutdownHandler {
}
private
Image
loadImage
(
String
name
)
throws
IOException
{
InputStream
in
=
Console
.
class
.
getResourceAsStream
(
name
);
if
(
in
!=
null
)
{
byte
[]
imageData
=
IOUtils
.
readBytesAndClose
(
in
,
-
1
);
return
Toolkit
.
getDefaultToolkit
().
createImage
(
imageData
);
byte
[]
imageData
=
Resources
.
get
(
name
);
if
(
imageData
==
null
)
{
return
null
;
}
return
null
;
return
Toolkit
.
getDefaultToolkit
().
createImage
(
imageData
)
;
}
/**
...
...
h2/src/main/org/h2/tools/Shell.java
浏览文件 @
b2804693
...
...
@@ -113,7 +113,7 @@ public class Shell {
private
void
promptLoop
()
{
out
.
println
();
out
.
println
(
"Welcome to H2 Shell "
+
Constants
.
getVersion
());
out
.
println
(
"Welcome to H2 Shell "
+
Constants
.
get
Full
Version
());
out
.
println
(
"Exit with Ctrl+C"
);
if
(
conn
!=
null
)
{
showHelp
();
...
...
h2/src/main/org/h2/util/Resources.java
浏览文件 @
b2804693
...
...
@@ -6,6 +6,7 @@
package
org
.
h2
.
util
;
import
java.io.BufferedWriter
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileWriter
;
...
...
@@ -13,6 +14,8 @@ import java.io.IOException;
import
java.io.InputStream
;
import
java.io.PrintWriter
;
import
java.util.HashMap
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipInputStream
;
/**
* This class is responsible to read resources and generate the
...
...
@@ -23,8 +26,40 @@ public class Resources {
private
static
final
HashMap
FILES
=
new
HashMap
();
static
{
ResourceData
.
load
();
if
(!
loadFromZip
())
{
ResourceData
.
load
();
}
}
private
static
boolean
loadFromZip
()
{
InputStream
in
=
Resources
.
class
.
getResourceAsStream
(
"data.zip"
);
if
(
in
==
null
)
{
return
false
;
}
ZipInputStream
zipIn
=
new
ZipInputStream
(
in
);
try
{
while
(
true
)
{
ZipEntry
entry
=
zipIn
.
getNextEntry
();
if
(
entry
==
null
)
{
break
;
}
String
entryName
=
entry
.
getName
();
if
(!
entryName
.
startsWith
(
"/"
))
{
entryName
=
"/"
+
entryName
;
}
ByteArrayOutputStream
out
=
new
ByteArrayOutputStream
();
IOUtils
.
copy
(
zipIn
,
out
);
zipIn
.
closeEntry
();
FILES
.
put
(
entryName
,
out
.
toByteArray
());
}
zipIn
.
close
();
}
catch
(
IOException
e
)
{
// if this happens we have a real problem
e
.
printStackTrace
();
}
return
true
;
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
inDir
=
args
.
length
>
0
?
args
[
0
]
:
null
;
...
...
h2/src/test/org/h2/samples/CsvSample.java
浏览文件 @
b2804693
...
...
@@ -17,6 +17,7 @@ import org.h2.tools.SimpleResultSet;
* This sample application shows how to use the CSV tool
* to write CSV (comma separated values) files, and
* how to use the tool to read such files.
* See also the section CSV (Comma Separated Values) Support in the Tutorial.
*/
public
class
CsvSample
{
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
b2804693
...
...
@@ -159,6 +159,42 @@ java org.h2.test.TestAll timer
/*
build.sh
run.sh
jdbc:h2:zip:source.zip!/source
The database is read only [90097-69] 90097/90097 (Help)
org.h2.jdbc.JdbcSQLException: The database is read only [90097-69]
at org.h2.message.Message.getSQLException(Message.java:91)
at org.h2.message.Message.getSQLException(Message.java:95)
at org.h2.message.Message.getSQLException(Message.java:73)
at org.h2.message.Message.getSQLException(Message.java:116)
at org.h2.engine.Database.checkWritingAllowed(Database.java:1401)
at org.h2.log.LogSystem.add(LogSystem.java:410)
at org.h2.store.DiskFile.addRecord(DiskFile.java:867)
at org.h2.store.Storage.addRecord(Storage.java:141)
at org.h2.index.ScanIndex.add(ScanIndex.java:115)
at org.h2.table.TableData.addRow(TableData.java:97)
at org.h2.engine.Database.addMeta(Database.java:685)
at org.h2.engine.Database.addDatabaseObject(Database.java:759)
at org.h2.engine.Database.setMasterUser(Database.java:1364)
at org.h2.engine.Engine.openSession(Engine.java:63)
at org.h2.engine.Engine.getSession(Engine.java:104)
at org.h2.engine.Session.createSession(Session.java:203)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:976)
timebomb should interrupt all threads
Thread[] list = new Thread[1000];
Thread.currentThread().getThreadGroup().enumerate(list);
for (int i = 0; i < list.length; i++) {
Thread t = list[i];
if (t != null && t != Thread.currentThread()) {
System.out.println("interrupting " + t.toString());
t.interrupt();
test case for out of memory (try to corrupt the database using out of memory)
Caused by: java.lang.Error: read len -1170950400
at org.h2.message.Message.getInternalError(Message.java:128)
at org.h2.store.FileStore.readFully(FileStore.java:210)
...
...
@@ -233,9 +269,19 @@ Add where required // TODO: change in version 1.1
http://www.w3schools.com/sql/
History:
The servlet and lucene jar files are now automatically downloaded
in the build
.
The servlet and lucene jar files are now automatically downloaded
when building
.
The code switch tool has been replaced by a simpler tool called
SwitchSource that just uses find and replace.
Started to write a Ant replacement ('JAnt') that uses pure Java
build definitions. Advantages: ability to debug the build, extensible,
flexible, no XML, a bit faster. Future plan: support creating custom h2
distributions (for embedded use). Maybe create a new project 'Jant'
or 'Javen' if other people are interested.
The jar file is now about 10% smaller because the variable debugging info
is no longer included. The source file and line number debugging info
is still included. If required, the jar file size of the full version can
be further reduced to about 720 KB using 'build jarSmall' or even
more by removing unneeded components.
Roadmap:
...
...
h2/src/tools/org/h2/build/Build.java
0 → 100644
浏览文件 @
b2804693
/*
* Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
* (license2)
* Initial Developer: H2 Group
*/
package
org
.
h2
.
build
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.List
;
import
org.h2.build.code.SwitchSource
;
/**
* The implementation of the pure Java build.
*/
public
class
Build
extends
BuildBase
{
public
static
void
main
(
String
[]
args
)
{
new
Build
().
run
(
args
);
}
public
void
all
()
{
jarSmall
();
javadoc
();
docs
();
}
public
void
docs
()
{
copy
(
"docs"
,
getFiles
(
"src/docsrc/index.html"
),
"src/docsrc"
);
java
(
"org.h2.build.code.CheckJavadoc"
,
null
);
java
(
"org.h2.build.code.CheckTextFiles"
,
null
);
java
(
"org.h2.build.doc.GenerateDoc"
,
null
);
java
(
"org.h2.build.i18n.PrepareTranslation"
,
null
);
java
(
"org.h2.build.i18n.PrepareTranslation"
,
null
);
java
(
"org.h2.build.indexer.Indexer"
,
null
);
java
(
"org.h2.build.doc.MergeDocs"
,
null
);
java
(
"org.h2.build.doc.WebSite"
,
null
);
java
(
"org.h2.build.doc.LinkChecker"
,
null
);
java
(
"org.h2.build.doc.XMLChecker"
,
null
);
java
(
"org.h2.build.doc.SpellChecker"
,
null
);
}
public
void
javadoc
()
{
delete
(
"docs"
);
mkdir
(
"docs/javadoc"
);
javadoc
(
new
String
[]
{
"-sourcepath"
,
"src/main"
,
"org.h2.jdbc"
,
"org.h2.jdbcx"
,
"org.h2.tools"
,
"org.h2.api"
,
"org.h2.constant"
,
"-doclet"
,
"org.h2.build.doclet.Doclet"
});
copy
(
"docs/javadoc"
,
getFiles
(
"src/docsrc/javadoc"
),
"src/docsrc/javadoc"
);
}
public
void
resources
()
{
List
files
=
getFiles
(
"src/main"
);
files
=
filterFiles
(
files
,
false
,
"*.java"
);
files
=
filterFiles
(
files
,
false
,
"*/package.html"
);
files
=
filterFiles
(
files
,
false
,
"*/java.sql.Driver"
);
zip
(
"target/org/h2/util/data.zip"
,
"src/main"
,
files
,
true
,
false
);
}
private
void
manifest
(
String
mainClassName
)
{
String
manifest
=
new
String
(
readFile
(
new
File
(
"src/main/META-INF/MANIFEST.MF"
)));
String
version
=
getStaticField
(
"org.h2.engine.Constants"
,
"VERSION"
);
manifest
=
replaceAll
(
manifest
,
"${version}"
,
version
);
manifest
=
replaceAll
(
manifest
,
"${buildJdk}"
,
getJavaSpecVersion
());
String
createdBy
=
System
.
getProperty
(
"java.runtime.version"
)
+
" ("
+
System
.
getProperty
(
"java.vm.vendor"
)
+
")"
;
manifest
=
replaceAll
(
manifest
,
"${createdBy}"
,
createdBy
);
String
mainClassTag
=
manifest
==
null
?
""
:
"Main-Class: "
+
mainClassName
;
manifest
=
replaceAll
(
manifest
,
"${mainClassTag}"
,
mainClassTag
);
writeFile
(
new
File
(
"target/META-INF/MANIFEST.MF"
),
manifest
.
getBytes
());
}
public
void
jar
()
{
compile
();
manifest
(
"org.h2.tools.Console"
);
List
files
=
getFiles
(
"target"
);
files
=
filterFiles
(
files
,
false
,
"target/org/h2/dev/*"
);
files
=
filterFiles
(
files
,
false
,
"target/org/h2/build/*"
);
files
=
filterFiles
(
files
,
false
,
"target/org/h2/samples/*"
);
files
=
filterFiles
(
files
,
false
,
"target/org/h2/test/*"
);
files
=
filterFiles
(
files
,
false
,
"*.bat"
);
files
=
filterFiles
(
files
,
false
,
"*.txt"
);
jar
(
"target/h2.jar"
,
"target"
,
files
);
}
public
void
jarSmall
()
{
compile
(
false
);
List
files
=
getFiles
(
"target"
);
files
=
filterFiles
(
files
,
false
,
"target/org/h2/dev/*"
);
files
=
filterFiles
(
files
,
false
,
"target/org/h2/build/*"
);
files
=
filterFiles
(
files
,
false
,
"target/org/h2/samples/*"
);
files
=
filterFiles
(
files
,
false
,
"target/org/h2/test/*"
);
files
=
filterFiles
(
files
,
false
,
"*.bat"
);
files
=
filterFiles
(
files
,
false
,
"*.txt"
);
files
=
filterFiles
(
files
,
false
,
"target/META-INF/*"
);
zip
(
"target/h2classes.zip"
,
"target"
,
files
,
true
,
true
);
manifest
(
"org.h2.tools.Console\nClass-Path: h2classes.zip"
);
files
=
getFiles
(
"target/h2classes.zip"
);
files
.
addAll
(
getFiles
(
"target/META-INF"
));
jar
(
"target/h2small.jar"
,
"target"
,
files
);
}
public
void
download
()
{
download
(
"ext/servlet-api-2.4.jar"
,
"http://repo1.maven.org/maven2/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar"
,
"3fc542fe8bb8164e8d3e840fe7403bc0518053c0"
);
download
(
"ext/lucene-core-2.2.0.jar"
,
"http://repo1.maven.org/maven2/org/apache/lucene/lucene-core/2.2.0/lucene-core-2.2.0.jar"
,
"47b6eee2e17bd68911e7045896a1c09de0b2dda8"
);
}
public
void
compile
()
{
compile
(
true
);
}
private
void
compile
(
boolean
debugInfo
)
{
try
{
SwitchSource
.
main
(
new
String
[]
{
"-dir"
,
"src"
,
"-auto"
});
}
catch
(
IOException
e
)
{
throw
new
Error
(
e
);
}
clean
();
resources
();
download
();
String
classpath
=
"target"
+
File
.
pathSeparatorChar
+
"ext/servlet-api-2.4.jar"
+
File
.
pathSeparatorChar
+
"ext/lucene-core-2.2.0.jar"
+
File
.
pathSeparator
+
System
.
getProperty
(
"java.home"
)
+
"/../lib/tools.jar"
;
List
files
=
getFiles
(
"src/main"
);
if
(
debugInfo
)
{
javac
(
new
String
[]
{
"-d"
,
"target"
,
"-sourcepath"
,
"src/main"
,
"-classpath"
,
classpath
},
files
);
}
else
{
javac
(
new
String
[]
{
"-g:none"
,
"-d"
,
"target"
,
"-sourcepath"
,
"src/main"
,
"-classpath"
,
classpath
},
files
);
}
files
=
getFiles
(
"src/test"
);
files
.
addAll
(
getFiles
(
"src/tools"
));
javac
(
new
String
[]
{
"-d"
,
"target"
,
"-sourcepath"
,
"src/test"
+
File
.
pathSeparator
+
"src/tools"
,
"-classpath"
,
classpath
},
files
);
files
=
getFiles
(
"src/main/META-INF/services"
);
copy
(
"target"
,
files
,
"src/main"
);
files
=
getFiles
(
"src/installer"
);
files
=
filterFiles
(
files
,
true
,
"*.bat"
);
copy
(
"target"
,
files
,
"src/installer"
);
files
=
getFiles
(
"src/test"
);
files
=
filterFiles
(
files
,
false
,
"*.java"
);
files
=
filterFiles
(
files
,
false
,
"*/package.html"
);
copy
(
"target"
,
files
,
"src/test"
);
}
public
void
clean
()
{
delete
(
"target"
);
delete
(
"docs"
);
mkdir
(
"target"
);
mkdir
(
"docs"
);
}
public
void
test
()
{
}
}
h2/src/tools/org/h2/build/BuildBase.java
0 → 100644
浏览文件 @
b2804693
差异被折叠。
点击展开。
h2/src/tools/org/h2/build/code/CheckTextFiles.java
浏览文件 @
b2804693
...
...
@@ -21,9 +21,10 @@ public class CheckTextFiles {
new
CheckTextFiles
().
run
();
}
String
[]
suffixCheck
=
new
String
[]
{
"html"
,
"jsp"
,
"js"
,
"css"
,
"bat"
,
"nsi"
,
"java"
,
"txt"
,
"properties"
,
"sql"
,
"xml"
,
"csv"
,
"Driver"
};
String
[]
suffixIgnore
=
new
String
[]
{
"gif"
,
"png"
,
"odg"
,
"ico"
,
"sxd"
,
"layout"
,
"res"
,
"win"
,
"jar"
,
"task"
,
"svg"
};
String
[]
suffixCheck
=
new
String
[]
{
"html"
,
"jsp"
,
"js"
,
"css"
,
"bat"
,
"nsi"
,
"java"
,
"txt"
,
"properties"
,
"sql"
,
"xml"
,
"csv"
,
"Driver"
};
String
[]
suffixIgnore
=
new
String
[]
{
"gif"
,
"png"
,
"odg"
,
"ico"
,
"sxd"
,
"layout"
,
"res"
,
"win"
,
"jar"
,
"task"
,
"svg"
,
"MF"
};
boolean
failOnError
;
boolean
allowTab
,
allowCR
=
true
,
allowTrailingSpaces
=
true
;
int
spacesPerTab
=
4
;
...
...
h2/src/tools/org/h2/build/code/CodeSwitch.java
deleted
100644 → 0
浏览文件 @
78e7ad72
差异被折叠。
点击展开。
h2/src/tools/org/h2/build/doc/SpellChecker.java
浏览文件 @
b2804693
...
...
@@ -33,7 +33,7 @@ public class SpellChecker {
private
boolean
printDictionary
=
false
;
private
boolean
addToDictionary
;
private
static
final
String
[]
SUFFIX
=
new
String
[]
{
"html"
,
"java"
,
"sql"
,
"txt"
,
"xml"
,
"jsp"
,
"css"
,
"bat"
,
"csv"
,
"xml"
,
"js"
,
"Driver"
,
"properties"
,
"task"
,
""
};
"csv"
,
"xml"
,
"js"
,
"Driver"
,
"properties"
,
"task"
,
"
MF"
,
"
"
};
private
static
final
String
[]
IGNORE
=
new
String
[]
{
"dev"
,
"nsi"
,
"gif"
,
"png"
,
"odg"
,
"ico"
,
"sxd"
,
"zip"
,
"bz2"
,
"rc"
,
"layout"
,
"res"
,
"dll"
,
"jar"
,
"svg"
};
private
static
final
String
PREFIX_IGNORE
=
"abc"
;
...
...
h2/src/tools/org/h2/build/doc/dictionary.txt
浏览文件 @
b2804693
...
...
@@ -64,7 +64,7 @@ classes classification classloader classloaders classpath clause clazz clean
cleaned cleaner clear cleared clearing clearly clears cleartext click clicked
clicking client clients clientside clob clock clone close closed closely closer
closes closing clubs cluster clustered clustering cmd cmu cnt coalesce code
codebase codebook coded codehaus codes codist coffee col coldrick coll
codebase codebook coded codehaus codes cod
eswitch cod
ist coffee col coldrick coll
collaborative collapse collateral collation collations collator collators collect
collected collecting collection collections collector colon color cols colspan
column columnlist columns com combination combinations combinatorics combine
...
...
@@ -490,4 +490,6 @@ hider ikvmc invert recycle filtering lesser recycled assertion runner teradata
christian lgpl elapsed ncr disposed heureuse tera years retrieves unlocked
selecting vista everywhere locations zones fragment svg thought constructors
doubles validating matched established accu accum stats resetting parallel
delays guess downloaded jars
\ No newline at end of file
delays guess downloaded jars advantages interrupt javen sourcepath unneeded
compressibility ext crc enumerate components mkdir jant downloading mismatch
timebomb
\ No newline at end of file
h2/src/tools/org/h2/build/package.html
0 → 100644
浏览文件 @
b2804693
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
Initial Developer: H2 Group
-->
<html
xmlns=
"http://www.w3.org/1999/xhtml"
lang=
"en"
xml:lang=
"en"
>
<head><meta
http-equiv=
"Content-Type"
content=
"text/html;charset=utf-8"
/><title>
Javadoc package documentation
</title></head><body
style=
"font: 9pt/130% Tahoma, Arial, Helvetica, sans-serif; font-weight: normal;"
>
The pure Java build system and implementation.
</body></html>
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论