Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
42e01bf9
提交
42e01bf9
authored
6月 19, 2007
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
a326829f
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
566 行增加
和
675 行删除
+566
-675
Function.java
h2/src/main/org/h2/expression/Function.java
+0
-3
SecureSocketFactory.java
h2/src/main/org/h2/security/SecureSocketFactory.java
+0
-2
AppServer.java
h2/src/main/org/h2/server/web/AppServer.java
+0
-223
WebServer.java
h2/src/main/org/h2/server/web/WebServer.java
+217
-24
WebServerSession.java
h2/src/main/org/h2/server/web/WebServerSession.java
+0
-42
WebServerThread.java
h2/src/main/org/h2/server/web/WebServerThread.java
+0
-292
WebSession.java
h2/src/main/org/h2/server/web/WebSession.java
+35
-5
WebThread.java
h2/src/main/org/h2/server/web/WebThread.java
+313
-59
DateTimeUtils.java
h2/src/main/org/h2/util/DateTimeUtils.java
+0
-4
FileUtils.java
h2/src/main/org/h2/util/FileUtils.java
+0
-5
StringUtils.java
h2/src/main/org/h2/util/StringUtils.java
+0
-15
DataType.java
h2/src/main/org/h2/value/DataType.java
+1
-1
没有找到文件。
h2/src/main/org/h2/expression/Function.java
浏览文件 @
42e01bf9
...
...
@@ -958,9 +958,6 @@ public class Function extends Expression implements FunctionCall {
int
nanos
=
d
.
getNanos
()
%
1000000
;
calendar
.
setTime
(
d
);
calendar
.
add
(
field
,
count
);
// TODO gcj: required so that the millis are calculated?
calendar
.
get
(
Calendar
.
YEAR
);
calendar
.
get
(
Calendar
.
HOUR_OF_DAY
);
long
t
=
calendar
.
getTime
().
getTime
();
Timestamp
ts
=
new
Timestamp
(
t
);
ts
.
setNanos
(
ts
.
getNanos
()
+
nanos
);
...
...
h2/src/main/org/h2/security/SecureSocketFactory.java
浏览文件 @
42e01bf9
...
...
@@ -133,8 +133,6 @@ public class SecureSocketFactory {
// See also: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4887561 (1.4.2 cannot read keystore written with 1.4.1)
// --- generated code start ---
// GCJ hack
//KeyStore store = KeyStore.getInstance("JKS");
KeyStore
store
=
KeyStore
.
getInstance
(
KeyStore
.
getDefaultType
());
store
.
load
(
null
,
password
.
toCharArray
());
...
...
h2/src/main/org/h2/server/web/AppServer.java
deleted
100644 → 0
浏览文件 @
a326829f
/*
* Copyright 2004-2006 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
server
.
web
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.sql.Connection
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Properties
;
import
org.h2.engine.Constants
;
import
org.h2.message.TraceSystem
;
import
org.h2.util.FileUtils
;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.MathUtils
;
public
class
AppServer
{
private
static
final
String
[]
GENERIC
=
new
String
[]
{
"Generic Firebird Server|org.firebirdsql.jdbc.FBDriver|jdbc:firebirdsql:localhost:c:/temp/firebird/test|sysdba"
,
"Generic OneDollarDB|in.co.daffodil.db.jdbc.DaffodilDBDriver|jdbc:daffodilDB_embedded:school;path=C:/temp;create=true|sa"
,
"Generic DB2|COM.ibm.db2.jdbc.net.DB2Driver|jdbc:db2://<host>/<db>|"
,
"Generic Oracle|oracle.jdbc.driver.OracleDriver|jdbc:oracle:thin:@<host>:1521:<instance>|scott"
,
"Generic PostgreSQL|org.postgresql.Driver|jdbc:postgresql:<db>|"
,
"Generic MS SQL Server|com.microsoft.jdbc.sqlserver.SQLServerDriver|jdbc:Microsoft:sqlserver://localhost:1433;DatabaseName=sqlexpress|sa"
,
"Generic MS SQL Server 2005|com.microsoft.sqlserver.jdbc.SQLServerDriver|jdbc:sqlserver://localhost;DatabaseName=test|sa"
,
"Generic MySQL|com.mysql.jdbc.Driver|jdbc:mysql://<host>:<port>/<db>|"
,
"Generic Derby (Embedded)|org.apache.derby.jdbc.EmbeddedDriver|jdbc:derby:test;create=true|sa"
,
"Generic Derby (Server)|org.apache.derby.jdbc.ClientDriver|jdbc:derby://localhost:1527/test;create=true|sa"
,
"Generic HSQLDB|org.hsqldb.jdbcDriver|jdbc:hsqldb:test;hsqldb.default_table_type=cached|sa"
,
"Generic H2|org.h2.Driver|jdbc:h2:test|sa"
,
};
// private URLClassLoader urlClassLoader;
private
String
driverList
;
private
static
int
ticker
;
private
int
port
;
private
boolean
allowOthers
;
private
boolean
ssl
;
private
HashMap
connInfoMap
=
new
HashMap
();
AppServer
(
String
[]
args
)
{
Properties
prop
=
loadProperties
();
driverList
=
prop
.
getProperty
(
"drivers"
);
port
=
FileUtils
.
getIntProperty
(
prop
,
"webPort"
,
Constants
.
DEFAULT_HTTP_PORT
);
ssl
=
FileUtils
.
getBooleanProperty
(
prop
,
"webSSL"
,
Constants
.
DEFAULT_HTTP_SSL
);
allowOthers
=
FileUtils
.
getBooleanProperty
(
prop
,
"webAllowOthers"
,
Constants
.
DEFAULT_HTTP_ALLOW_OTHERS
);
for
(
int
i
=
0
;
args
!=
null
&&
i
<
args
.
length
;
i
++)
{
if
(
"-webPort"
.
equals
(
args
[
i
]))
{
port
=
MathUtils
.
decodeInt
(
args
[++
i
]);
}
else
if
(
"-webSSL"
.
equals
(
args
[
i
]))
{
ssl
=
Boolean
.
valueOf
(
args
[++
i
]).
booleanValue
();
}
else
if
(
"-webAllowOthers"
.
equals
(
args
[
i
]))
{
allowOthers
=
Boolean
.
valueOf
(
args
[++
i
]).
booleanValue
();
// } else if("-baseDir".equals(args[i])) {
// String baseDir = args[++i];
}
}
// TODO gcj: don't load drivers in case of GCJ
// if(false) {
// if(driverList != null) {
// try {
// String[] drivers = StringUtils.arraySplit(driverList, ',', false);
// URL[] urls = new URL[drivers.length];
// for(int i=0; i<drivers.length; i++) {
// urls[i] = new URL(drivers[i]);
// }
// urlClassLoader = URLClassLoader.newInstance(urls);
// } catch (MalformedURLException e) {
// TraceSystem.traceThrowable(e);
// }
// }
// }
}
void
setAllowOthers
(
boolean
b
)
{
allowOthers
=
b
;
}
void
setSSL
(
boolean
b
)
{
ssl
=
b
;
}
void
setPort
(
int
port
)
{
this
.
port
=
port
;
}
boolean
getAllowOthers
()
{
return
allowOthers
;
}
boolean
getSSL
()
{
return
ssl
;
}
int
getPort
()
{
return
port
;
}
ConnectionInfo
getSetting
(
String
name
)
{
return
(
ConnectionInfo
)
connInfoMap
.
get
(
name
);
}
void
updateSetting
(
ConnectionInfo
info
)
{
connInfoMap
.
put
(
info
.
name
,
info
);
info
.
lastAccess
=
ticker
++;
}
void
removeSetting
(
String
name
)
{
connInfoMap
.
remove
(
name
);
}
private
String
getPropertiesFileName
()
{
// store the properties in the user directory
return
FileUtils
.
getFileInUserHome
(
Constants
.
SERVER_PROPERTIES_FILE
);
}
Properties
loadProperties
()
{
String
fileName
=
getPropertiesFileName
();
try
{
return
FileUtils
.
loadProperties
(
fileName
);
}
catch
(
IOException
e
)
{
// TODO log exception
return
new
Properties
();
}
}
String
[]
getSettingNames
()
{
ArrayList
list
=
getSettings
();
String
[]
names
=
new
String
[
list
.
size
()];
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
names
[
i
]
=
((
ConnectionInfo
)
list
.
get
(
i
)).
name
;
}
return
names
;
}
synchronized
ArrayList
getSettings
()
{
ArrayList
settings
=
new
ArrayList
();
if
(
connInfoMap
.
size
()
==
0
)
{
Properties
prop
=
loadProperties
();
if
(
prop
.
size
()
==
0
)
{
for
(
int
i
=
0
;
i
<
AppServer
.
GENERIC
.
length
;
i
++)
{
ConnectionInfo
info
=
new
ConnectionInfo
(
AppServer
.
GENERIC
[
i
]);
settings
.
add
(
info
);
updateSetting
(
info
);
}
}
else
{
for
(
int
i
=
0
;
;
i
++)
{
String
data
=
prop
.
getProperty
(
String
.
valueOf
(
i
));
if
(
data
==
null
)
{
break
;
}
ConnectionInfo
info
=
new
ConnectionInfo
(
data
);
settings
.
add
(
info
);
updateSetting
(
info
);
}
}
}
else
{
settings
.
addAll
(
connInfoMap
.
values
());
}
sortConnectionInfo
(
settings
);
return
settings
;
}
void
sortConnectionInfo
(
ArrayList
list
)
{
for
(
int
i
=
1
,
j
;
i
<
list
.
size
();
i
++)
{
ConnectionInfo
t
=
(
ConnectionInfo
)
list
.
get
(
i
);
for
(
j
=
i
-
1
;
j
>=
0
&&
(((
ConnectionInfo
)
list
.
get
(
j
)).
lastAccess
<
t
.
lastAccess
);
j
--)
{
list
.
set
(
j
+
1
,
list
.
get
(
j
));
}
list
.
set
(
j
+
1
,
t
);
}
}
synchronized
void
saveSettings
()
{
try
{
Properties
prop
=
new
Properties
();
if
(
driverList
!=
null
)
{
prop
.
setProperty
(
"drivers"
,
driverList
);
}
prop
.
setProperty
(
"webPort"
,
String
.
valueOf
(
port
));
prop
.
setProperty
(
"webAllowOthers"
,
String
.
valueOf
(
allowOthers
));
prop
.
setProperty
(
"webSSL"
,
String
.
valueOf
(
ssl
));
ArrayList
settings
=
getSettings
();
int
len
=
settings
.
size
();
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
ConnectionInfo
info
=
(
ConnectionInfo
)
settings
.
get
(
i
);
if
(
info
!=
null
)
{
prop
.
setProperty
(
String
.
valueOf
(
len
-
i
-
1
),
info
.
getString
());
}
}
OutputStream
out
=
FileUtils
.
openFileOutputStream
(
getPropertiesFileName
());
prop
.
store
(
out
,
Constants
.
SERVER_PROPERTIES_TITLE
);
out
.
close
();
}
catch
(
Exception
e
)
{
TraceSystem
.
traceThrowable
(
e
);
}
}
// TODO GCJ: if this method is synchronized, then the .exe file fails (probably does not unlock the object)
// and cannot go in here after a class was not found
Connection
getConnection
(
String
driver
,
String
url
,
String
user
,
String
password
)
throws
Exception
{
driver
=
driver
.
trim
();
url
=
url
.
trim
();
user
=
user
.
trim
();
password
=
password
.
trim
();
org
.
h2
.
Driver
.
load
();
// try {
// Driver dr = (Driver) urlClassLoader.loadClass(driver).newInstance();
// Properties p = new Properties();
// p.setProperty("user", user);
// p.setProperty("password", password);
// return dr.connect(url, p);
// } catch(ClassNotFoundException e2) {
// throw e2;
// }
return
JdbcUtils
.
getConnection
(
driver
,
url
,
user
,
password
);
}
}
h2/src/main/org/h2/server/web/WebServer.java
浏览文件 @
42e01bf9
差异被折叠。
点击展开。
h2/src/main/org/h2/server/web/WebServerSession.java
deleted
100644 → 0
浏览文件 @
a326829f
/*
* Copyright 2004-2006 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package
org
.
h2
.
server
.
web
;
import
java.sql.Timestamp
;
import
java.util.HashMap
;
import
java.util.Locale
;
public
class
WebServerSession
{
long
lastAccess
;
HashMap
map
=
new
HashMap
();
Locale
locale
;
WebServer
server
;
WebServerSession
(
WebServer
server
)
{
this
.
server
=
server
;
}
public
void
put
(
String
key
,
Object
value
)
{
map
.
put
(
key
,
value
);
}
public
Object
get
(
String
key
)
{
if
(
"sessions"
.
equals
(
key
))
{
return
server
.
getSessions
();
}
return
map
.
get
(
key
);
}
public
void
remove
(
String
key
)
{
map
.
remove
(
key
);
}
public
HashMap
getInfo
()
{
HashMap
m
=
new
HashMap
();
m
.
putAll
(
map
);
m
.
put
(
"lastAccess"
,
new
Timestamp
(
lastAccess
).
toString
());
return
m
;
}
}
h2/src/main/org/h2/server/web/WebServerThread.java
deleted
100644 → 0
浏览文件 @
a326829f
差异被折叠。
点击展开。
h2/src/main/org/h2/server/web/
App
Session.java
→
h2/src/main/org/h2/server/web/
Web
Session.java
浏览文件 @
42e01bf9
...
...
@@ -9,13 +9,20 @@ import java.sql.DatabaseMetaData;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Locale
;
import
org.h2.bnf.Bnf
;
import
org.h2.message.TraceSystem
;
public
class
AppSession
extends
WebServerSession
{
public
class
WebSession
{
long
lastAccess
;
HashMap
map
=
new
HashMap
();
Locale
locale
;
WebServer
server
;
private
static
final
int
MAX_HISTORY
=
1000
;
private
ArrayList
commandHistory
=
new
ArrayList
();
...
...
@@ -31,8 +38,23 @@ public class AppSession extends WebServerSession {
Statement
executingStatement
;
ResultSet
result
;
AppSession
(
WebServer
server
)
{
super
(
server
);
WebSession
(
WebServer
server
)
{
this
.
server
=
server
;
}
public
void
put
(
String
key
,
Object
value
)
{
map
.
put
(
key
,
value
);
}
public
Object
get
(
String
key
)
{
if
(
"sessions"
.
equals
(
key
))
{
return
server
.
getSessions
();
}
return
map
.
get
(
key
);
}
public
void
remove
(
String
key
)
{
map
.
remove
(
key
);
}
public
Bnf
getBnf
()
{
...
...
@@ -98,8 +120,16 @@ public class AppSession extends WebServerSession {
return
commandHistory
;
}
public
HashMap
getMainInfo
()
{
int
todoRefactorMergeWithGetInfo
;
HashMap
m
=
new
HashMap
();
m
.
putAll
(
map
);
m
.
put
(
"lastAccess"
,
new
Timestamp
(
lastAccess
).
toString
());
return
m
;
}
public
HashMap
getInfo
()
{
HashMap
m
=
super
.
get
Info
();
HashMap
m
=
getMain
Info
();
try
{
m
.
put
(
"url"
,
conn
==
null
?
"not connected"
:
conn
.
getMetaData
().
getURL
());
m
.
put
(
"user"
,
conn
==
null
?
"-"
:
conn
.
getMetaData
().
getUserName
());
...
...
@@ -132,5 +162,5 @@ public class AppSession extends WebServerSession {
public
DbContents
getContents
()
{
return
contents
;
}
}
h2/src/main/org/h2/server/web/
App
Thread.java
→
h2/src/main/org/h2/server/web/
Web
Thread.java
浏览文件 @
42e01bf9
差异被折叠。
点击展开。
h2/src/main/org/h2/util/DateTimeUtils.java
浏览文件 @
42e01bf9
...
...
@@ -33,8 +33,6 @@ public class DateTimeUtils {
public
static
Time
cloneAndNormalizeTime
(
Time
value
)
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
value
);
// TODO gcj: required so that the millis are calculated?
cal
.
get
(
Calendar
.
HOUR_OF_DAY
);
cal
.
set
(
1970
,
0
,
1
);
return
new
Time
(
cal
.
getTime
().
getTime
());
}
...
...
@@ -42,8 +40,6 @@ public class DateTimeUtils {
public
static
Date
cloneAndNormalizeDate
(
Date
value
)
{
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
value
);
// TODO gcj: required so that the millis are calculated?
cal
.
get
(
Calendar
.
YEAR
);
cal
.
set
(
Calendar
.
MILLISECOND
,
0
);
cal
.
set
(
Calendar
.
SECOND
,
0
);
cal
.
set
(
Calendar
.
MINUTE
,
0
);
...
...
h2/src/main/org/h2/util/FileUtils.java
浏览文件 @
42e01bf9
...
...
@@ -33,8 +33,6 @@ public class FileUtils {
// TODO detection of 'case in sensitive filesystem' could maybe implemented using some other means
private
static
final
boolean
isCaseInsensitiveFileSystem
=
(
File
.
separatorChar
==
'\\'
);
// TODO gcj: use our own UTF-8 encoder
public
static
RandomAccessFile
openRandomAccessFile
(
String
fileName
,
String
mode
)
throws
IOException
{
fileName
=
translateFileName
(
fileName
);
try
{
...
...
@@ -222,10 +220,7 @@ public class FileUtils {
wait
(
i
);
}
}
// TODO GCJ: it seems gcj throws 'CreateFile failed' if the file already exists?!
return
false
;
// TODO is this message used elsewhere?
// throw Message.getSQLException(Message.FILE_CREATION_FAILED_1, fileName);
}
public
static
void
delete
(
String
fileName
)
throws
SQLException
{
...
...
h2/src/main/org/h2/util/StringUtils.java
浏览文件 @
42e01bf9
...
...
@@ -23,21 +23,6 @@ import org.h2.message.Message;
public
class
StringUtils
{
// TODO hack for gcj
//#GCJHACK private static final Class[] gcjClasses = {
//#GCJHACK gnu.gcj.convert.Input_ASCII.class,
//#GCJHACK gnu.gcj.convert.Input_UTF8.class,
//#GCJHACK gnu.gcj.convert.Input_8859_1.class,
//#GCJHACK gnu.gcj.convert.Output_ASCII.class,
//#GCJHACK gnu.gcj.convert.Output_UTF8.class,
//#GCJHACK gnu.gcj.convert.UnicodeToBytes.class,
//#GCJHACK gnu.gcj.convert.BytesToUnicode.class,
//#GCJHACK gnu.java.locale.Calendar.class,
//#GCJHACK gnu.java.locale.LocaleInformation.class,
//#GCJHACK gnu.java.locale.LocaleInformation_de.class,
//#GCJHACK java.util.GregorianCalendar.class,
//#GCJHACK };
public
static
boolean
equals
(
String
a
,
String
b
)
{
if
(
a
==
null
)
{
return
b
==
null
;
...
...
h2/src/main/org/h2/value/DataType.java
浏览文件 @
42e01bf9
...
...
@@ -558,7 +558,7 @@ public class DataType {
}
else
if
(
Timestamp
.
class
.
isAssignableFrom
(
x
))
{
return
Value
.
TIMESTAMP
;
}
else
if
(
java
.
util
.
Date
.
class
.
isAssignableFrom
(
x
))
{
return
Value
.
DATE
;
return
Value
.
TIMESTAMP
;
}
else
if
(
java
.
io
.
Reader
.
class
.
isAssignableFrom
(
x
))
{
return
Value
.
CLOB
;
}
else
if
(
java
.
sql
.
Clob
.
class
.
isAssignableFrom
(
x
))
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论