Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
7190dd29
提交
7190dd29
authored
7月 23, 2007
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
--no commit message
上级
a3b0faf5
显示空白字符变更
内嵌
并排
正在显示
21 个修改的文件
包含
138 行增加
和
48 行删除
+138
-48
Driver.java
h2/src/main/org/h2/Driver.java
+1
-0
Bnf.java
h2/src/main/org/h2/bnf/Bnf.java
+1
-1
Session.java
h2/src/main/org/h2/engine/Session.java
+2
-1
Aggregate.java
h2/src/main/org/h2/expression/Aggregate.java
+2
-1
Function.java
h2/src/main/org/h2/expression/Function.java
+15
-14
FullText.java
h2/src/main/org/h2/fulltext/FullText.java
+4
-3
FullTextSettings.java
h2/src/main/org/h2/fulltext/FullTextSettings.java
+4
-2
HashIndex.java
h2/src/main/org/h2/index/HashIndex.java
+2
-1
JdbcArray.java
h2/src/main/org/h2/jdbc/JdbcArray.java
+2
-1
TraceObject.java
h2/src/main/org/h2/message/TraceObject.java
+1
-1
OdbcServerThread.java
h2/src/main/org/h2/server/OdbcServerThread.java
+5
-4
WebThread.java
h2/src/main/org/h2/server/web/WebThread.java
+3
-2
LogSystem.java
h2/src/main/org/h2/store/LogSystem.java
+7
-6
Recover.java
h2/src/main/org/h2/tools/Recover.java
+4
-3
RunScript.java
h2/src/main/org/h2/tools/RunScript.java
+2
-1
ObjectUtils.java
h2/src/main/org/h2/util/ObjectUtils.java
+71
-0
SmallMap.java
h2/src/main/org/h2/util/SmallMap.java
+3
-3
DataType.java
h2/src/main/org/h2/value/DataType.java
+3
-2
ValueInt.java
h2/src/main/org/h2/value/ValueInt.java
+2
-1
ValueLong.java
h2/src/main/org/h2/value/ValueLong.java
+2
-1
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+2
-0
没有找到文件。
h2/src/main/org/h2/Driver.java
浏览文件 @
7190dd29
...
...
@@ -104,6 +104,7 @@ public class Driver implements java.sql.Driver {
* INTERNAL
*/
public
static
void
load
()
{
// does nothing, but calling it loads the class
}
}
h2/src/main/org/h2/bnf/Bnf.java
浏览文件 @
7190dd29
...
...
@@ -21,7 +21,7 @@ import org.h2.util.StringUtils;
public
class
Bnf
{
static
boolean
COMBINE_KEYWORDS
;
static
final
boolean
COMBINE_KEYWORDS
=
false
;
private
static
final
String
SEPARATORS
=
" [](){}|.,\r\n<>:-+*/=<\">!'"
;
private
static
final
long
MAX_PARSE_TIME
=
100
;
...
...
h2/src/main/org/h2/engine/Session.java
浏览文件 @
7190dd29
...
...
@@ -27,6 +27,7 @@ import org.h2.store.LogSystem;
import
org.h2.store.UndoLog
;
import
org.h2.store.UndoLogRecord
;
import
org.h2.table.Table
;
import
org.h2.util.ObjectUtils
;
import
org.h2.util.ObjectArray
;
import
org.h2.value.Value
;
import
org.h2.value.ValueLong
;
...
...
@@ -377,7 +378,7 @@ public class Session implements SessionInterface {
if
(
savepoints
==
null
)
{
savepoints
=
new
HashMap
();
}
savepoints
.
put
(
name
,
new
Integer
(
getLogId
()));
savepoints
.
put
(
name
,
ObjectUtils
.
get
Integer
(
getLogId
()));
}
public
void
rollbackToSavepoint
(
String
name
)
throws
SQLException
{
...
...
h2/src/main/org/h2/expression/Aggregate.java
浏览文件 @
7190dd29
...
...
@@ -20,6 +20,7 @@ import org.h2.table.Column;
import
org.h2.table.ColumnResolver
;
import
org.h2.table.Table
;
import
org.h2.table.TableFilter
;
import
org.h2.util.ObjectUtils
;
import
org.h2.util.ObjectArray
;
import
org.h2.util.StringUtils
;
import
org.h2.value.DataType
;
...
...
@@ -87,7 +88,7 @@ public class Aggregate extends Expression {
}
private
static
void
addAggregate
(
String
name
,
int
type
)
{
aggregates
.
put
(
name
,
new
Integer
(
type
));
aggregates
.
put
(
name
,
ObjectUtils
.
get
Integer
(
type
));
}
public
static
int
getAggregateType
(
String
name
)
{
...
...
h2/src/main/org/h2/expression/Function.java
浏览文件 @
7190dd29
...
...
@@ -31,6 +31,7 @@ import org.h2.table.TableFilter;
import
org.h2.tools.CompressTool
;
import
org.h2.tools.Csv
;
import
org.h2.tools.SimpleResultSet
;
import
org.h2.util.ObjectUtils
;
import
org.h2.util.MathUtils
;
import
org.h2.util.MemoryUtils
;
import
org.h2.util.ObjectArray
;
...
...
@@ -116,20 +117,20 @@ public class Function extends Expression implements FunctionCall {
static
{
datePart
=
new
HashMap
();
datePart
.
put
(
"YY"
,
new
Integer
(
Calendar
.
YEAR
));
datePart
.
put
(
"YEAR"
,
new
Integer
(
Calendar
.
YEAR
));
datePart
.
put
(
"MM"
,
new
Integer
(
Calendar
.
MONTH
));
datePart
.
put
(
"MONTH"
,
new
Integer
(
Calendar
.
MONTH
));
datePart
.
put
(
"DD"
,
new
Integer
(
Calendar
.
DATE
));
datePart
.
put
(
"DAY"
,
new
Integer
(
Calendar
.
DATE
));
datePart
.
put
(
"HH"
,
new
Integer
(
Calendar
.
HOUR
));
datePart
.
put
(
"HOUR"
,
new
Integer
(
Calendar
.
HOUR
));
datePart
.
put
(
"MI"
,
new
Integer
(
Calendar
.
MINUTE
));
datePart
.
put
(
"MINUTE"
,
new
Integer
(
Calendar
.
MINUTE
));
datePart
.
put
(
"SS"
,
new
Integer
(
Calendar
.
SECOND
));
datePart
.
put
(
"SECOND"
,
new
Integer
(
Calendar
.
SECOND
));
datePart
.
put
(
"MS"
,
new
Integer
(
Calendar
.
MILLISECOND
));
datePart
.
put
(
"MILLISECOND"
,
new
Integer
(
Calendar
.
MILLISECOND
));
datePart
.
put
(
"YY"
,
ObjectUtils
.
get
Integer
(
Calendar
.
YEAR
));
datePart
.
put
(
"YEAR"
,
ObjectUtils
.
get
Integer
(
Calendar
.
YEAR
));
datePart
.
put
(
"MM"
,
ObjectUtils
.
get
Integer
(
Calendar
.
MONTH
));
datePart
.
put
(
"MONTH"
,
ObjectUtils
.
get
Integer
(
Calendar
.
MONTH
));
datePart
.
put
(
"DD"
,
ObjectUtils
.
get
Integer
(
Calendar
.
DATE
));
datePart
.
put
(
"DAY"
,
ObjectUtils
.
get
Integer
(
Calendar
.
DATE
));
datePart
.
put
(
"HH"
,
ObjectUtils
.
get
Integer
(
Calendar
.
HOUR
));
datePart
.
put
(
"HOUR"
,
ObjectUtils
.
get
Integer
(
Calendar
.
HOUR
));
datePart
.
put
(
"MI"
,
ObjectUtils
.
get
Integer
(
Calendar
.
MINUTE
));
datePart
.
put
(
"MINUTE"
,
ObjectUtils
.
get
Integer
(
Calendar
.
MINUTE
));
datePart
.
put
(
"SS"
,
ObjectUtils
.
get
Integer
(
Calendar
.
SECOND
));
datePart
.
put
(
"SECOND"
,
ObjectUtils
.
get
Integer
(
Calendar
.
SECOND
));
datePart
.
put
(
"MS"
,
ObjectUtils
.
get
Integer
(
Calendar
.
MILLISECOND
));
datePart
.
put
(
"MILLISECOND"
,
ObjectUtils
.
get
Integer
(
Calendar
.
MILLISECOND
));
}
static
{
...
...
h2/src/main/org/h2/fulltext/FullText.java
浏览文件 @
7190dd29
...
...
@@ -21,6 +21,7 @@ import java.util.StringTokenizer;
import
org.h2.api.Trigger
;
import
org.h2.tools.SimpleResultSet
;
import
org.h2.util.ByteUtils
;
import
org.h2.util.ObjectUtils
;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.StringUtils
;
import
org.h2.value.DataType
;
...
...
@@ -217,7 +218,7 @@ public class FullText implements Trigger {
long
id
=
rs
.
getLong
(
"ID"
);
word
=
setting
.
convertWord
(
word
);
if
(
word
!=
null
)
{
map
.
put
(
word
,
new
Long
(
id
));
map
.
put
(
word
,
ObjectUtils
.
get
Long
(
id
));
}
}
}
...
...
@@ -477,7 +478,7 @@ public class FullText implements Trigger {
ResultSet
rs
=
JdbcUtils
.
getGeneratedKeys
(
prepInsertWord
);
rs
.
next
();
wordId
=
rs
.
getInt
(
1
);
allWords
.
put
(
word
,
new
Integer
(
wordId
));
allWords
.
put
(
word
,
ObjectUtils
.
get
Integer
(
wordId
));
}
else
{
wordId
=
wId
.
intValue
();
}
...
...
@@ -560,7 +561,7 @@ public class FullText implements Trigger {
prepSelectMapByWordId
.
setInt
(
1
,
wId
.
intValue
());
ResultSet
rs
=
prepSelectMapByWordId
.
executeQuery
();
while
(
rs
.
next
())
{
Long
rId
=
new
Long
(
rs
.
getLong
(
1
));
Long
rId
=
ObjectUtils
.
get
Long
(
rs
.
getLong
(
1
));
if
(
lastRowIds
==
null
||
lastRowIds
.
contains
(
rId
))
{
rIds
.
add
(
rId
);
}
...
...
h2/src/main/org/h2/fulltext/FullTextSettings.java
浏览文件 @
7190dd29
...
...
@@ -12,6 +12,8 @@ import java.sql.Statement;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
org.h2.util.ObjectUtils
;
public
class
FullTextSettings
{
private
static
HashMap
settings
=
new
HashMap
();
...
...
@@ -34,11 +36,11 @@ public class FullTextSettings {
}
IndexInfo
getIndexInfo
(
long
indexId
)
{
return
(
IndexInfo
)
indexes
.
get
(
new
Long
(
indexId
));
return
(
IndexInfo
)
indexes
.
get
(
ObjectUtils
.
get
Long
(
indexId
));
}
void
addIndexInfo
(
IndexInfo
index
)
{
indexes
.
put
(
new
Long
(
index
.
id
),
index
);
indexes
.
put
(
ObjectUtils
.
get
Long
(
index
.
id
),
index
);
}
public
String
convertWord
(
String
word
)
{
...
...
h2/src/main/org/h2/index/HashIndex.java
浏览文件 @
7190dd29
...
...
@@ -13,6 +13,7 @@ import org.h2.result.SearchRow;
import
org.h2.table.Column
;
import
org.h2.table.TableData
;
import
org.h2.util.IntIntHashMap
;
import
org.h2.util.ObjectUtils
;
import
org.h2.util.ValueHashMap
;
import
org.h2.value.Value
;
import
org.h2.value.ValueArray
;
...
...
@@ -63,7 +64,7 @@ public class HashIndex extends Index {
// TODO index duplicate key for hash indexes: is this allowed?
throw
getDuplicateKeyException
();
}
Integer
pos
=
new
Integer
(
row
.
getPos
());
Integer
pos
=
ObjectUtils
.
get
Integer
(
row
.
getPos
());
rows
.
put
(
getKey
(
row
),
pos
);
}
rowCount
++;
...
...
h2/src/main/org/h2/jdbc/JdbcArray.java
浏览文件 @
7190dd29
...
...
@@ -14,6 +14,7 @@ import org.h2.engine.SessionInterface;
import
org.h2.message.Message
;
import
org.h2.message.TraceObject
;
import
org.h2.tools.SimpleResultSet
;
import
org.h2.util.ObjectUtils
;
import
org.h2.value.Value
;
/**
...
...
@@ -232,7 +233,7 @@ public class JdbcArray extends TraceObject implements Array {
rs
.
addColumn
(
"VALUE"
,
Types
.
NULL
,
0
,
0
);
for
(
int
i
=
0
;
i
<
array
.
length
;
i
++)
{
Object
[]
row
=
new
Object
[
2
];
row
[
0
]
=
new
Long
(
offset
+
i
+
1
);
row
[
0
]
=
ObjectUtils
.
get
Long
(
offset
+
i
+
1
);
row
[
1
]
=
array
[
i
];
rs
.
addRow
(
row
);
}
...
...
h2/src/main/org/h2/message/TraceObject.java
浏览文件 @
7190dd29
...
...
@@ -23,7 +23,7 @@ public class TraceObject {
PARAMETER_META_DATA
=
11
;
public
static
final
int
DATA_SOURCE
=
12
,
XA_DATA_SOURCE
=
13
,
XID
=
14
,
ARRAY
=
15
;
private
static
int
LAST
=
ARRAY
+
1
;
private
static
final
int
LAST
=
ARRAY
+
1
;
private
Trace
trace
;
private
static
final
int
[]
ID
=
new
int
[
LAST
];
private
static
final
String
[]
PREFIX
=
{
...
...
h2/src/main/org/h2/server/OdbcServerThread.java
浏览文件 @
7190dd29
...
...
@@ -25,6 +25,7 @@ import java.util.HashMap;
import
org.h2.engine.ConnectionInfo
;
import
org.h2.message.Message
;
import
org.h2.util.ObjectUtils
;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.StringUtils
;
import
org.h2.value.DataType
;
...
...
@@ -55,7 +56,7 @@ public class OdbcServerThread implements Runnable {
private
int
addObject
(
Object
o
)
{
int
id
=
nextId
++;
server
.
log
(
"addObj "
+
id
+
" "
+
o
);
object
.
put
(
new
Integer
(
id
),
o
);
object
.
put
(
ObjectUtils
.
get
Integer
(
id
),
o
);
cacheId
=
id
;
cache
=
o
;
return
id
;
...
...
@@ -66,7 +67,7 @@ public class OdbcServerThread implements Runnable {
cacheId
=
-
1
;
cache
=
null
;
}
object
.
remove
(
new
Integer
(
id
));
object
.
remove
(
ObjectUtils
.
get
Integer
(
id
));
}
private
Object
getObject
(
int
id
)
{
...
...
@@ -74,8 +75,8 @@ public class OdbcServerThread implements Runnable {
server
.
log
(
"getObj "
+
id
+
" "
+
cache
);
return
cache
;
}
server
.
log
(
"getObj "
+
id
+
" "
+
object
.
get
(
new
Integer
(
id
)));
return
object
.
get
(
new
Integer
(
id
));
server
.
log
(
"getObj "
+
id
+
" "
+
object
.
get
(
ObjectUtils
.
get
Integer
(
id
)));
return
object
.
get
(
ObjectUtils
.
get
Integer
(
id
));
}
public
void
run
()
{
...
...
h2/src/main/org/h2/server/web/WebThread.java
浏览文件 @
7190dd29
...
...
@@ -34,6 +34,7 @@ import java.util.Map.Entry;
import
org.h2.bnf.Bnf
;
import
org.h2.message.TraceSystem
;
import
org.h2.tools.SimpleResultSet
;
import
org.h2.util.ObjectUtils
;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.MathUtils
;
import
org.h2.util.MemoryUtils
;
...
...
@@ -1261,10 +1262,10 @@ class WebThread extends Thread {
break
;
}
if
(
sql
.
substring
(
idx
).
startsWith
(
"?/*RND*/"
))
{
params
.
add
(
new
Integer
(
1
));
params
.
add
(
ObjectUtils
.
get
Integer
(
1
));
sql
=
sql
.
substring
(
0
,
idx
)
+
"?"
+
sql
.
substring
(
idx
+
"/*RND*/"
.
length
()+
1
);
}
else
{
params
.
add
(
new
Integer
(
0
));
params
.
add
(
ObjectUtils
.
get
Integer
(
0
));
}
idx
++;
}
...
...
h2/src/main/org/h2/store/LogSystem.java
浏览文件 @
7190dd29
...
...
@@ -14,6 +14,7 @@ import org.h2.engine.Database;
import
org.h2.engine.Session
;
import
org.h2.message.Trace
;
import
org.h2.util.FileUtils
;
import
org.h2.util.ObjectUtils
;
import
org.h2.util.ObjectArray
;
/**
...
...
@@ -190,7 +191,7 @@ public class LogSystem {
for
(
int
i
=
undo
.
size
()
-
1
;
i
>=
0
&&
sessions
.
size
()
>
0
;
i
--)
{
database
.
setProgress
(
DatabaseEventListener
.
STATE_RECOVER
,
null
,
undo
.
size
()
-
1
-
i
,
undo
.
size
());
LogRecord
record
=
(
LogRecord
)
undo
.
get
(
i
);
if
(
sessions
.
get
(
new
Integer
(
record
.
sessionId
))
!=
null
)
{
if
(
sessions
.
get
(
ObjectUtils
.
get
Integer
(
record
.
sessionId
))
!=
null
)
{
// undo only if the session is not yet committed
record
.
log
.
undo
(
record
.
logRecordId
);
database
.
getDataFile
().
flushRedoLog
();
...
...
@@ -255,7 +256,7 @@ public class LogSystem {
}
else
{
dataFile
=
true
;
}
Integer
i
=
new
Integer
(
id
);
Integer
i
=
ObjectUtils
.
get
Integer
(
id
);
Storage
storage
=
(
Storage
)
storages
.
get
(
i
);
if
(
storage
==
null
)
{
storage
=
database
.
getStorage
(
null
,
id
,
dataFile
);
...
...
@@ -265,7 +266,7 @@ public class LogSystem {
}
boolean
isSessionCommitted
(
int
sessionId
,
int
logId
,
int
pos
)
{
Integer
key
=
new
Integer
(
sessionId
);
Integer
key
=
ObjectUtils
.
get
Integer
(
sessionId
);
SessionState
state
=
(
SessionState
)
sessions
.
get
(
key
);
if
(
state
==
null
)
{
return
true
;
...
...
@@ -274,7 +275,7 @@ public class LogSystem {
}
void
setLastCommitForSession
(
int
sessionId
,
int
logId
,
int
pos
)
{
Integer
key
=
new
Integer
(
sessionId
);
Integer
key
=
ObjectUtils
.
get
Integer
(
sessionId
);
SessionState
state
=
(
SessionState
)
sessions
.
get
(
key
);
if
(
state
==
null
)
{
state
=
new
SessionState
();
...
...
@@ -287,7 +288,7 @@ public class LogSystem {
}
void
setPreparedCommitForSession
(
LogFile
log
,
int
sessionId
,
int
pos
,
String
transaction
,
int
blocks
)
{
Integer
key
=
new
Integer
(
sessionId
);
Integer
key
=
ObjectUtils
.
get
Integer
(
sessionId
);
SessionState
state
=
(
SessionState
)
sessions
.
get
(
key
);
if
(
state
==
null
)
{
state
=
new
SessionState
();
...
...
@@ -304,7 +305,7 @@ public class LogSystem {
}
void
removeSession
(
int
sessionId
)
{
sessions
.
remove
(
new
Integer
(
sessionId
));
sessions
.
remove
(
ObjectUtils
.
get
Integer
(
sessionId
));
}
public
void
prepareCommit
(
Session
session
,
String
transaction
)
throws
SQLException
{
...
...
h2/src/main/org/h2/tools/Recover.java
浏览文件 @
7190dd29
...
...
@@ -38,6 +38,7 @@ import org.h2.store.LogFile;
import
org.h2.util.ByteUtils
;
import
org.h2.util.FileUtils
;
import
org.h2.util.IOUtils
;
import
org.h2.util.ObjectUtils
;
import
org.h2.util.ObjectArray
;
import
org.h2.util.RandomUtils
;
import
org.h2.value.Value
;
...
...
@@ -701,8 +702,8 @@ public class Recover implements DataHandler {
writeDataError
(
writer
,
"out of memory"
,
s
.
getBytes
(),
blockCount
);
continue
;
}
if
(!
objectIdSet
.
contains
(
new
Integer
(
storageId
)))
{
objectIdSet
.
add
(
new
Integer
(
storageId
));
if
(!
objectIdSet
.
contains
(
ObjectUtils
.
get
Integer
(
storageId
)))
{
objectIdSet
.
add
(
ObjectUtils
.
get
Integer
(
storageId
));
StringBuffer
sb
=
new
StringBuffer
();
sb
.
append
(
"CREATE TABLE O_"
+
storageId
+
"("
);
for
(
int
i
=
0
;
i
<
recordLength
;
i
++)
{
...
...
@@ -749,7 +750,7 @@ public class Recover implements DataHandler {
if
(
end
>=
0
)
{
int
start
=
sql
.
lastIndexOf
(
' '
,
end
);
String
name
=
sql
.
substring
(
start
,
end
).
trim
();
tableMap
.
put
(
new
Integer
(
meta
.
getId
()),
name
);
tableMap
.
put
(
ObjectUtils
.
get
Integer
(
meta
.
getId
()),
name
);
}
}
}
catch
(
Throwable
t
)
{
...
...
h2/src/main/org/h2/tools/RunScript.java
浏览文件 @
7190dd29
...
...
@@ -22,6 +22,7 @@ import org.h2.engine.Constants;
import
org.h2.message.Message
;
import
org.h2.util.ClassUtils
;
import
org.h2.util.FileUtils
;
import
org.h2.util.ObjectUtils
;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.ScriptReader
;
import
org.h2.util.StringUtils
;
...
...
@@ -183,7 +184,7 @@ public class RunScript {
execute
(
conn
,
threadMap
,
sql
,
continueOnError
,
charsetName
);
}
else
if
(
MULTI_THREAD
&&
sql
.
startsWith
(
"/*"
))
{
int
idx
=
sql
.
indexOf
(
']'
);
Integer
id
=
new
Integer
(
Integer
.
parseInt
(
sql
.
substring
(
"/*"
.
length
(),
idx
)));
Integer
id
=
ObjectUtils
.
get
Integer
(
Integer
.
parseInt
(
sql
.
substring
(
"/*"
.
length
(),
idx
)));
RunScriptThread
thread
=
(
RunScriptThread
)
threadMap
.
get
(
id
);
if
(
thread
==
null
)
{
Connection
c
=
DriverManager
.
getConnection
(
conn
.
getMetaData
().
getURL
());
...
...
h2/src/main/org/h2/util/ObjectUtils.java
0 → 100644
浏览文件 @
7190dd29
package
org
.
h2
.
util
;
public
class
ObjectUtils
{
public
static
Integer
getInteger
(
int
x
)
{
//#ifdef JDK16
/*
return Integer.valueOf(x);
*/
//#endif
//#ifdef JDK14
return
new
Integer
(
x
);
//#endif
}
public
static
Long
getLong
(
long
x
)
{
//#ifdef JDK16
/*
return Long.valueOf(x);
*/
//#endif
//#ifdef JDK14
return
new
Long
(
x
);
//#endif
}
public
static
Short
getShort
(
short
x
)
{
//#ifdef JDK16
/*
return Short.valueOf(x);
*/
//#endif
//#ifdef JDK14
return
new
Short
(
x
);
//#endif
}
public
static
Byte
getByte
(
byte
x
)
{
//#ifdef JDK16
/*
return Byte.valueOf(x);
*/
//#endif
//#ifdef JDK14
return
new
Byte
(
x
);
//#endif
}
public
static
Float
getFloat
(
float
x
)
{
//#ifdef JDK16
/*
return Float.valueOf(x);
*/
//#endif
//#ifdef JDK14
return
new
Float
(
x
);
//#endif
}
public
static
Double
getDouble
(
double
x
)
{
//#ifdef JDK16
/*
return Double.valueOf(x);
*/
//#endif
//#ifdef JDK14
return
new
Double
(
x
);
//#endif
}
}
h2/src/main/org/h2/util/SmallMap.java
浏览文件 @
7190dd29
...
...
@@ -34,7 +34,7 @@ public class SmallMap {
if
(
id
>
lastId
)
{
lastId
=
id
;
}
map
.
put
(
new
Integer
(
id
),
o
);
map
.
put
(
ObjectUtils
.
get
Integer
(
id
),
o
);
cacheId
=
id
;
cache
=
o
;
return
id
;
...
...
@@ -45,14 +45,14 @@ public class SmallMap {
cacheId
=
-
1
;
cache
=
null
;
}
map
.
remove
(
new
Integer
(
id
));
map
.
remove
(
ObjectUtils
.
get
Integer
(
id
));
}
public
Object
getObject
(
int
id
,
boolean
ifAvailable
)
throws
SQLException
{
if
(
id
==
cacheId
)
{
return
cache
;
}
Object
obj
=
map
.
get
(
new
Integer
(
id
));
Object
obj
=
map
.
get
(
ObjectUtils
.
get
Integer
(
id
));
if
(
obj
==
null
&&
!
ifAvailable
)
{
throw
Message
.
getSQLException
(
Message
.
OBJECT_CLOSED
);
}
...
...
h2/src/main/org/h2/value/DataType.java
浏览文件 @
7190dd29
...
...
@@ -25,6 +25,7 @@ import org.h2.jdbc.JdbcConnection;
import
org.h2.jdbc.JdbcSQLException
;
import
org.h2.message.Message
;
import
org.h2.util.ByteUtils
;
import
org.h2.util.ObjectUtils
;
import
org.h2.util.ObjectArray
;
import
org.h2.util.StringUtils
;
...
...
@@ -678,9 +679,9 @@ public class DataType {
}
else
if
(
clazz
==
Short
.
TYPE
)
{
return
new
Short
((
short
)
0
);
}
else
if
(
clazz
==
Integer
.
TYPE
)
{
return
new
Integer
(
0
);
return
ObjectUtils
.
get
Integer
(
0
);
}
else
if
(
clazz
==
Long
.
TYPE
)
{
return
new
Long
(
0
);
return
ObjectUtils
.
get
Long
(
0
);
}
else
if
(
clazz
==
Float
.
TYPE
)
{
return
new
Float
(
0
);
}
else
if
(
clazz
==
Double
.
TYPE
)
{
...
...
h2/src/main/org/h2/value/ValueInt.java
浏览文件 @
7190dd29
...
...
@@ -9,6 +9,7 @@ import java.sql.SQLException;
import
org.h2.engine.Constants
;
import
org.h2.message.Message
;
import
org.h2.util.ObjectUtils
;
/**
* @author Thomas
...
...
@@ -131,7 +132,7 @@ public class ValueInt extends Value {
}
public
Object
getObject
()
{
return
new
Integer
(
value
);
return
ObjectUtils
.
get
Integer
(
value
);
}
public
void
set
(
PreparedStatement
prep
,
int
parameterIndex
)
throws
SQLException
{
...
...
h2/src/main/org/h2/value/ValueLong.java
浏览文件 @
7190dd29
...
...
@@ -10,6 +10,7 @@ import java.sql.SQLException;
import
org.h2.engine.Constants
;
import
org.h2.message.Message
;
import
org.h2.util.ObjectUtils
;
public
class
ValueLong
extends
Value
{
...
...
@@ -155,7 +156,7 @@ public class ValueLong extends Value {
}
public
Object
getObject
()
{
return
new
Long
(
value
);
return
ObjectUtils
.
get
Long
(
value
);
}
public
void
set
(
PreparedStatement
prep
,
int
parameterIndex
)
throws
SQLException
{
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
7190dd29
...
...
@@ -94,6 +94,8 @@ java -Xmx512m -Xrunhprof:cpu=samples,depth=8 org.h2.tools.RunScript -url jdbc:h2
/*
replace new Byte, Double, Float, Long, Byte, Short with ObjectUtils.get
set read-committed as the default
SELECT rolcreaterole, rolcreatedb FROM pg_roles WHERE rolname = current_user;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论