Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
70ba94a0
Unverified
提交
70ba94a0
authored
5月 14, 2018
作者:
Evgenij Ryazanov
提交者:
GitHub
5月 14, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1136 from katzyn/misc
Assorted minor optimizations
上级
685dd6b6
7770c6ad
显示空白字符变更
内嵌
并排
正在显示
23 个修改的文件
包含
65 行增加
和
69 行删除
+65
-69
Function.java
h2/src/main/org/h2/expression/Function.java
+1
-1
JdbcConnection.java
h2/src/main/org/h2/jdbc/JdbcConnection.java
+2
-3
JdbcDataSource.java
h2/src/main/org/h2/jdbcx/JdbcDataSource.java
+1
-1
Sequence.java
h2/src/main/org/h2/schema/Sequence.java
+3
-3
WebApp.java
h2/src/main/org/h2/server/web/WebApp.java
+1
-1
WebServer.java
h2/src/main/org/h2/server/web/WebServer.java
+2
-2
FileLock.java
h2/src/main/org/h2/store/FileLock.java
+1
-1
MetaTable.java
h2/src/main/org/h2/table/MetaTable.java
+15
-15
ConvertTraceFile.java
h2/src/main/org/h2/tools/ConvertTraceFile.java
+1
-1
Recover.java
h2/src/main/org/h2/tools/Recover.java
+1
-1
Shell.java
h2/src/main/org/h2/tools/Shell.java
+1
-1
DateTimeFunctions.java
h2/src/main/org/h2/util/DateTimeFunctions.java
+1
-1
StringUtils.java
h2/src/main/org/h2/util/StringUtils.java
+2
-3
ValueByte.java
h2/src/main/org/h2/value/ValueByte.java
+2
-2
ValueDouble.java
h2/src/main/org/h2/value/ValueDouble.java
+1
-1
ValueFloat.java
h2/src/main/org/h2/value/ValueFloat.java
+1
-1
ValueInt.java
h2/src/main/org/h2/value/ValueInt.java
+2
-2
ValueLong.java
h2/src/main/org/h2/value/ValueLong.java
+21
-23
ValueShort.java
h2/src/main/org/h2/value/ValueShort.java
+2
-2
Function.java
h2/src/test/org/h2/samples/Function.java
+1
-1
BenchCRandom.java
h2/src/test/org/h2/test/bench/BenchCRandom.java
+1
-1
FtpControl.java
h2/src/tools/org/h2/dev/ftp/server/FtpControl.java
+1
-1
FtpServer.java
h2/src/tools/org/h2/dev/ftp/server/FtpServer.java
+1
-1
没有找到文件。
h2/src/main/org/h2/expression/Function.java
浏览文件 @
70ba94a0
...
@@ -146,7 +146,7 @@ public class Function extends Expression implements FunctionCall {
...
@@ -146,7 +146,7 @@ public class Function extends Expression implements FunctionCall {
private
static
final
int
VAR_ARGS
=
-
1
;
private
static
final
int
VAR_ARGS
=
-
1
;
private
static
final
long
PRECISION_UNKNOWN
=
-
1
;
private
static
final
long
PRECISION_UNKNOWN
=
-
1
;
private
static
final
HashMap
<
String
,
FunctionInfo
>
FUNCTIONS
=
new
HashMap
<>();
private
static
final
HashMap
<
String
,
FunctionInfo
>
FUNCTIONS
=
new
HashMap
<>(
256
);
private
static
final
char
[]
SOUNDEX_INDEX
=
new
char
[
128
];
private
static
final
char
[]
SOUNDEX_INDEX
=
new
char
[
128
];
protected
Expression
[]
args
;
protected
Expression
[]
args
;
...
...
h2/src/main/org/h2/jdbc/JdbcConnection.java
浏览文件 @
70ba94a0
...
@@ -1866,10 +1866,9 @@ public class JdbcConnection extends TraceObject
...
@@ -1866,10 +1866,9 @@ public class JdbcConnection extends TraceObject
}
}
}
}
p
.
setProperty
(
NUM_SERVERS
,
String
.
valueOf
(
serverList
.
size
()));
p
.
setProperty
(
NUM_SERVERS
,
Integer
.
toString
(
serverList
.
size
()));
for
(
int
i
=
0
;
i
<
serverList
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
serverList
.
size
();
i
++)
{
p
.
setProperty
(
PREFIX_SERVER
+
String
.
valueOf
(
i
),
p
.
setProperty
(
PREFIX_SERVER
+
i
,
serverList
.
get
(
i
));
serverList
.
get
(
i
));
}
}
return
p
;
return
p
;
...
...
h2/src/main/org/h2/jdbcx/JdbcDataSource.java
浏览文件 @
70ba94a0
...
@@ -335,7 +335,7 @@ public class JdbcDataSource extends TraceObject implements XADataSource,
...
@@ -335,7 +335,7 @@ public class JdbcDataSource extends TraceObject implements XADataSource,
ref
.
add
(
new
StringRefAddr
(
"url"
,
url
));
ref
.
add
(
new
StringRefAddr
(
"url"
,
url
));
ref
.
add
(
new
StringRefAddr
(
"user"
,
userName
));
ref
.
add
(
new
StringRefAddr
(
"user"
,
userName
));
ref
.
add
(
new
StringRefAddr
(
"password"
,
convertToString
(
passwordChars
)));
ref
.
add
(
new
StringRefAddr
(
"password"
,
convertToString
(
passwordChars
)));
ref
.
add
(
new
StringRefAddr
(
"loginTimeout"
,
String
.
valueOf
(
loginTimeout
)));
ref
.
add
(
new
StringRefAddr
(
"loginTimeout"
,
Integer
.
toString
(
loginTimeout
)));
ref
.
add
(
new
StringRefAddr
(
"description"
,
description
));
ref
.
add
(
new
StringRefAddr
(
"description"
,
description
));
return
ref
;
return
ref
;
}
}
...
...
h2/src/main/org/h2/schema/Sequence.java
浏览文件 @
70ba94a0
...
@@ -83,9 +83,9 @@ public class Sequence extends SchemaObjectBase {
...
@@ -83,9 +83,9 @@ public class Sequence extends SchemaObjectBase {
this
.
belongsToTable
=
belongsToTable
;
this
.
belongsToTable
=
belongsToTable
;
if
(!
isValid
(
this
.
value
,
this
.
minValue
,
this
.
maxValue
,
this
.
increment
))
{
if
(!
isValid
(
this
.
value
,
this
.
minValue
,
this
.
maxValue
,
this
.
increment
))
{
throw
DbException
.
get
(
ErrorCode
.
SEQUENCE_ATTRIBUTES_INVALID
,
name
,
throw
DbException
.
get
(
ErrorCode
.
SEQUENCE_ATTRIBUTES_INVALID
,
name
,
String
.
valueOf
(
this
.
value
),
String
.
valueOf
(
this
.
minValue
),
Long
.
toString
(
this
.
value
),
Long
.
toString
(
this
.
minValue
),
String
.
valueOf
(
this
.
maxValue
),
Long
.
toString
(
this
.
maxValue
),
String
.
valueOf
(
this
.
increment
));
Long
.
toString
(
this
.
increment
));
}
}
}
}
...
...
h2/src/main/org/h2/server/web/WebApp.java
浏览文件 @
70ba94a0
...
@@ -349,7 +349,7 @@ public class WebApp {
...
@@ -349,7 +349,7 @@ public class WebApp {
try
{
try
{
Properties
prop
=
new
SortedProperties
();
Properties
prop
=
new
SortedProperties
();
int
port
=
Integer
.
decode
((
String
)
attributes
.
get
(
"port"
));
int
port
=
Integer
.
decode
((
String
)
attributes
.
get
(
"port"
));
prop
.
setProperty
(
"webPort"
,
String
.
valueOf
(
port
));
prop
.
setProperty
(
"webPort"
,
Integer
.
toString
(
port
));
server
.
setPort
(
port
);
server
.
setPort
(
port
);
boolean
allowOthers
=
Utils
.
parseBoolean
((
String
)
attributes
.
get
(
"allowOthers"
),
false
,
false
);
boolean
allowOthers
=
Utils
.
parseBoolean
((
String
)
attributes
.
get
(
"allowOthers"
),
false
,
false
);
prop
.
setProperty
(
"webAllowOthers"
,
String
.
valueOf
(
allowOthers
));
prop
.
setProperty
(
"webAllowOthers"
,
String
.
valueOf
(
allowOthers
));
...
...
h2/src/main/org/h2/server/web/WebServer.java
浏览文件 @
70ba94a0
...
@@ -645,7 +645,7 @@ public class WebServer implements Service {
...
@@ -645,7 +645,7 @@ public class WebServer implements Service {
}
}
}
else
{
}
else
{
for
(
int
i
=
0
;;
i
++)
{
for
(
int
i
=
0
;;
i
++)
{
String
data
=
prop
.
getProperty
(
String
.
valueOf
(
i
));
String
data
=
prop
.
getProperty
(
Integer
.
toString
(
i
));
if
(
data
==
null
)
{
if
(
data
==
null
)
{
break
;
break
;
}
}
...
@@ -689,7 +689,7 @@ public class WebServer implements Service {
...
@@ -689,7 +689,7 @@ public class WebServer implements Service {
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
ConnectionInfo
info
=
settings
.
get
(
i
);
ConnectionInfo
info
=
settings
.
get
(
i
);
if
(
info
!=
null
)
{
if
(
info
!=
null
)
{
prop
.
setProperty
(
String
.
valueOf
(
len
-
i
-
1
),
info
.
getString
());
prop
.
setProperty
(
Integer
.
toString
(
len
-
i
-
1
),
info
.
getString
());
}
}
}
}
if
(!
"null"
.
equals
(
serverPropertiesDir
))
{
if
(!
"null"
.
equals
(
serverPropertiesDir
))
{
...
...
h2/src/main/org/h2/store/FileLock.java
浏览文件 @
70ba94a0
...
@@ -401,7 +401,7 @@ public class FileLock implements Runnable {
...
@@ -401,7 +401,7 @@ public class FileLock implements Runnable {
serverSocket
=
NetUtils
.
createServerSocket
(
0
,
false
);
serverSocket
=
NetUtils
.
createServerSocket
(
0
,
false
);
int
port
=
serverSocket
.
getLocalPort
();
int
port
=
serverSocket
.
getLocalPort
();
properties
.
setProperty
(
"ipAddress"
,
ipAddress
);
properties
.
setProperty
(
"ipAddress"
,
ipAddress
);
properties
.
setProperty
(
"port"
,
String
.
valueOf
(
port
));
properties
.
setProperty
(
"port"
,
Integer
.
toString
(
port
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
trace
.
debug
(
e
,
"lock"
);
trace
.
debug
(
e
,
"lock"
);
serverSocket
=
null
;
serverSocket
=
null
;
...
...
h2/src/main/org/h2/table/MetaTable.java
浏览文件 @
70ba94a0
...
@@ -843,7 +843,7 @@ public class MetaTable extends Table {
...
@@ -843,7 +843,7 @@ public class MetaTable extends Table {
// COLUMN_NAME
// COLUMN_NAME
identifier
(
c
.
getName
()),
identifier
(
c
.
getName
()),
// ORDINAL_POSITION
// ORDINAL_POSITION
String
.
valueOf
(
j
+
1
),
Integer
.
toString
(
j
+
1
),
// COLUMN_DEFAULT
// COLUMN_DEFAULT
c
.
getDefaultSQL
(),
c
.
getDefaultSQL
(),
// IS_NULLABLE
// IS_NULLABLE
...
@@ -1104,9 +1104,9 @@ public class MetaTable extends Table {
...
@@ -1104,9 +1104,9 @@ public class MetaTable extends Table {
// TYPE_NAME
// TYPE_NAME
t
.
name
,
t
.
name
,
// DATA_TYPE
// DATA_TYPE
String
.
valueOf
(
t
.
sqlType
),
Integer
.
toString
(
t
.
sqlType
),
// PRECISION
// PRECISION
String
.
valueOf
(
MathUtils
.
convertLongToInt
(
t
.
maxPrecision
)),
Integer
.
toString
(
MathUtils
.
convertLongToInt
(
t
.
maxPrecision
)),
// PREFIX
// PREFIX
t
.
prefix
,
t
.
prefix
,
// SUFFIX
// SUFFIX
...
@@ -1116,13 +1116,13 @@ public class MetaTable extends Table {
...
@@ -1116,13 +1116,13 @@ public class MetaTable extends Table {
// AUTO_INCREMENT
// AUTO_INCREMENT
String
.
valueOf
(
t
.
autoIncrement
),
String
.
valueOf
(
t
.
autoIncrement
),
// MINIMUM_SCALE
// MINIMUM_SCALE
String
.
valueOf
(
t
.
minScale
),
Integer
.
toString
(
t
.
minScale
),
// MAXIMUM_SCALE
// MAXIMUM_SCALE
String
.
valueOf
(
t
.
maxScale
),
Integer
.
toString
(
t
.
maxScale
),
// RADIX
// RADIX
t
.
decimal
?
"10"
:
null
,
t
.
decimal
?
"10"
:
null
,
// POS
// POS
String
.
valueOf
(
t
.
sqlTypePos
),
Integer
.
toString
(
t
.
sqlTypePos
),
// CASE_SENSITIVE
// CASE_SENSITIVE
String
.
valueOf
(
t
.
caseSensitive
),
String
.
valueOf
(
t
.
caseSensitive
),
// NULLABLE
// NULLABLE
...
@@ -1145,7 +1145,7 @@ public class MetaTable extends Table {
...
@@ -1145,7 +1145,7 @@ public class MetaTable extends Table {
for
(
int
i
=
0
;
rs
.
next
();
i
++)
{
for
(
int
i
=
0
;
rs
.
next
();
i
++)
{
add
(
rows
,
add
(
rows
,
// ID
// ID
String
.
valueOf
(
i
),
Integer
.
toString
(
i
),
// SECTION
// SECTION
rs
.
getString
(
1
).
trim
(),
rs
.
getString
(
1
).
trim
(),
// TOPIC
// TOPIC
...
@@ -1173,19 +1173,19 @@ public class MetaTable extends Table {
...
@@ -1173,19 +1173,19 @@ public class MetaTable extends Table {
// SEQUENCE_NAME
// SEQUENCE_NAME
identifier
(
s
.
getName
()),
identifier
(
s
.
getName
()),
// CURRENT_VALUE
// CURRENT_VALUE
String
.
valueOf
(
s
.
getCurrentValue
()),
Long
.
toString
(
s
.
getCurrentValue
()),
// INCREMENT
// INCREMENT
String
.
valueOf
(
s
.
getIncrement
()),
Long
.
toString
(
s
.
getIncrement
()),
// IS_GENERATED
// IS_GENERATED
s
.
getBelongsToTable
()
?
"TRUE"
:
"FALSE"
,
s
.
getBelongsToTable
()
?
"TRUE"
:
"FALSE"
,
// REMARKS
// REMARKS
replaceNullWithEmpty
(
s
.
getComment
()),
replaceNullWithEmpty
(
s
.
getComment
()),
// CACHE
// CACHE
String
.
valueOf
(
s
.
getCacheSize
()),
Long
.
toString
(
s
.
getCacheSize
()),
// MIN_VALUE
// MIN_VALUE
String
.
valueOf
(
s
.
getMinValue
()),
Long
.
toString
(
s
.
getMinValue
()),
// MAX_VALUE
// MAX_VALUE
String
.
valueOf
(
s
.
getMaxValue
()),
Long
.
toString
(
s
.
getMaxValue
()),
// IS_CYCLE
// IS_CYCLE
s
.
getCycle
()
?
"TRUE"
:
"FALSE"
,
s
.
getCycle
()
?
"TRUE"
:
"FALSE"
,
// ID
// ID
...
@@ -1627,11 +1627,11 @@ public class MetaTable extends Table {
...
@@ -1627,11 +1627,11 @@ public class MetaTable extends Table {
// FKCOLUMN_NAME
// FKCOLUMN_NAME
identifier
(
cols
[
j
].
column
.
getName
()),
identifier
(
cols
[
j
].
column
.
getName
()),
// ORDINAL_POSITION
// ORDINAL_POSITION
String
.
valueOf
(
j
+
1
),
Integer
.
toString
(
j
+
1
),
// UPDATE_RULE SMALLINT
// UPDATE_RULE SMALLINT
String
.
valueOf
(
update
),
Integer
.
toString
(
update
),
// DELETE_RULE SMALLINT
// DELETE_RULE SMALLINT
String
.
valueOf
(
delete
),
Integer
.
toString
(
delete
),
// FK_NAME
// FK_NAME
identifier
(
ref
.
getName
()),
identifier
(
ref
.
getName
()),
// PK_NAME
// PK_NAME
...
...
h2/src/main/org/h2/tools/ConvertTraceFile.java
浏览文件 @
70ba94a0
...
@@ -207,7 +207,7 @@ public class ConvertTraceFile extends Tool {
...
@@ -207,7 +207,7 @@ public class ConvertTraceFile extends Tool {
}
}
private
static
String
padNumberLeft
(
long
number
,
int
digits
)
{
private
static
String
padNumberLeft
(
long
number
,
int
digits
)
{
return
StringUtils
.
pad
(
String
.
valueOf
(
number
),
digits
,
" "
,
false
);
return
StringUtils
.
pad
(
Long
.
toString
(
number
),
digits
,
" "
,
false
);
}
}
private
void
addToStats
(
String
sql
,
int
resultCount
,
long
time
)
{
private
void
addToStats
(
String
sql
,
int
resultCount
,
long
time
)
{
...
...
h2/src/main/org/h2/tools/Recover.java
浏览文件 @
70ba94a0
...
@@ -1070,7 +1070,7 @@ public class Recover extends Tool implements DataHandler {
...
@@ -1070,7 +1070,7 @@ public class Recover extends Tool implements DataHandler {
private
String
setStorage
(
int
storageId
)
{
private
String
setStorage
(
int
storageId
)
{
this
.
storageId
=
storageId
;
this
.
storageId
=
storageId
;
this
.
storageName
=
"O_"
+
String
.
valueOf
(
storageId
).
replace
(
'-'
,
'M'
);
this
.
storageName
=
"O_"
+
Integer
.
toString
(
storageId
).
replace
(
'-'
,
'M'
);
return
storageName
;
return
storageName
;
}
}
...
...
h2/src/main/org/h2/tools/Shell.java
浏览文件 @
70ba94a0
...
@@ -333,7 +333,7 @@ public class Shell extends Tool implements Runnable {
...
@@ -333,7 +333,7 @@ public class Shell extends Tool implements Runnable {
String
data
=
null
;
String
data
=
null
;
boolean
found
=
false
;
boolean
found
=
false
;
for
(
int
i
=
0
;;
i
++)
{
for
(
int
i
=
0
;;
i
++)
{
String
d
=
prop
.
getProperty
(
String
.
valueOf
(
i
));
String
d
=
prop
.
getProperty
(
Integer
.
toString
(
i
));
if
(
d
==
null
)
{
if
(
d
==
null
)
{
break
;
break
;
}
}
...
...
h2/src/main/org/h2/util/DateTimeFunctions.java
浏览文件 @
70ba94a0
...
@@ -49,7 +49,7 @@ import org.h2.value.ValueTimestampTimeZone;
...
@@ -49,7 +49,7 @@ import org.h2.value.ValueTimestampTimeZone;
* Date and time functions.
* Date and time functions.
*/
*/
public
final
class
DateTimeFunctions
{
public
final
class
DateTimeFunctions
{
private
static
final
HashMap
<
String
,
Integer
>
DATE_PART
=
new
HashMap
<>();
private
static
final
HashMap
<
String
,
Integer
>
DATE_PART
=
new
HashMap
<>(
128
);
/**
/**
* English names of months and week days.
* English names of months and week days.
...
...
h2/src/main/org/h2/util/StringUtils.java
浏览文件 @
70ba94a0
...
@@ -22,8 +22,7 @@ import org.h2.message.DbException;
...
@@ -22,8 +22,7 @@ import org.h2.message.DbException;
*/
*/
public
class
StringUtils
{
public
class
StringUtils
{
private
static
SoftReference
<
String
[]>
softCache
=
private
static
SoftReference
<
String
[]>
softCache
;
new
SoftReference
<>(
null
);
private
static
long
softCacheCreatedNs
;
private
static
long
softCacheCreatedNs
;
private
static
final
char
[]
HEX
=
"0123456789abcdef"
.
toCharArray
();
private
static
final
char
[]
HEX
=
"0123456789abcdef"
.
toCharArray
();
...
@@ -902,7 +901,7 @@ public class StringUtils {
...
@@ -902,7 +901,7 @@ public class StringUtils {
* Clear the cache. This method is used for testing.
* Clear the cache. This method is used for testing.
*/
*/
public
static
void
clearCache
()
{
public
static
void
clearCache
()
{
softCache
=
n
ew
SoftReference
<>(
null
)
;
softCache
=
n
ull
;
}
}
/**
/**
...
...
h2/src/main/org/h2/value/ValueByte.java
浏览文件 @
70ba94a0
...
@@ -40,7 +40,7 @@ public class ValueByte extends Value {
...
@@ -40,7 +40,7 @@ public class ValueByte extends Value {
}
}
private
static
ValueByte
checkRange
(
int
x
)
{
private
static
ValueByte
checkRange
(
int
x
)
{
if
(
x
<
Byte
.
MIN_VALUE
||
x
>
Byte
.
MAX_VALUE
)
{
if
(
(
byte
)
x
!=
x
)
{
throw
DbException
.
get
(
ErrorCode
.
NUMERIC_VALUE_OUT_OF_RANGE_1
,
throw
DbException
.
get
(
ErrorCode
.
NUMERIC_VALUE_OUT_OF_RANGE_1
,
Integer
.
toString
(
x
));
Integer
.
toString
(
x
));
}
}
...
@@ -115,7 +115,7 @@ public class ValueByte extends Value {
...
@@ -115,7 +115,7 @@ public class ValueByte extends Value {
@Override
@Override
public
String
getString
()
{
public
String
getString
()
{
return
String
.
valueOf
(
value
);
return
Integer
.
toString
(
value
);
}
}
@Override
@Override
...
...
h2/src/main/org/h2/value/ValueDouble.java
浏览文件 @
70ba94a0
...
@@ -118,7 +118,7 @@ public class ValueDouble extends Value {
...
@@ -118,7 +118,7 @@ public class ValueDouble extends Value {
@Override
@Override
public
String
getString
()
{
public
String
getString
()
{
return
String
.
valueOf
(
value
);
return
Double
.
toString
(
value
);
}
}
@Override
@Override
...
...
h2/src/main/org/h2/value/ValueFloat.java
浏览文件 @
70ba94a0
...
@@ -119,7 +119,7 @@ public class ValueFloat extends Value {
...
@@ -119,7 +119,7 @@ public class ValueFloat extends Value {
@Override
@Override
public
String
getString
()
{
public
String
getString
()
{
return
String
.
valueOf
(
value
);
return
Float
.
toString
(
value
);
}
}
@Override
@Override
...
...
h2/src/main/org/h2/value/ValueInt.java
浏览文件 @
70ba94a0
...
@@ -70,7 +70,7 @@ public class ValueInt extends Value {
...
@@ -70,7 +70,7 @@ public class ValueInt extends Value {
}
}
private
static
ValueInt
checkRange
(
long
x
)
{
private
static
ValueInt
checkRange
(
long
x
)
{
if
(
x
<
Integer
.
MIN_VALUE
||
x
>
Integer
.
MAX_VALUE
)
{
if
(
(
int
)
x
!=
x
)
{
throw
DbException
.
get
(
ErrorCode
.
NUMERIC_VALUE_OUT_OF_RANGE_1
,
Long
.
toString
(
x
));
throw
DbException
.
get
(
ErrorCode
.
NUMERIC_VALUE_OUT_OF_RANGE_1
,
Long
.
toString
(
x
));
}
}
return
ValueInt
.
get
((
int
)
x
);
return
ValueInt
.
get
((
int
)
x
);
...
@@ -148,7 +148,7 @@ public class ValueInt extends Value {
...
@@ -148,7 +148,7 @@ public class ValueInt extends Value {
@Override
@Override
public
String
getString
()
{
public
String
getString
()
{
return
String
.
valueOf
(
value
);
return
Integer
.
toString
(
value
);
}
}
@Override
@Override
...
...
h2/src/main/org/h2/value/ValueLong.java
浏览文件 @
70ba94a0
...
@@ -61,20 +61,18 @@ public class ValueLong extends Value {
...
@@ -61,20 +61,18 @@ public class ValueLong extends Value {
@Override
@Override
public
Value
add
(
Value
v
)
{
public
Value
add
(
Value
v
)
{
ValueLong
other
=
(
ValueLong
)
v
;
long
x
=
value
;
long
result
=
value
+
other
.
value
;
long
y
=
((
ValueLong
)
v
).
value
;
int
sv
=
Long
.
signum
(
value
);
long
result
=
x
+
y
;
int
so
=
Long
.
signum
(
other
.
value
);
/*
int
sr
=
Long
.
signum
(
result
);
* If signs of both summands are different from the sign of the sum there is an
// if the operands have different signs overflow can not occur
* overflow.
// if the operands have the same sign,
*/
// and the result has a different sign, then it is an overflow
if
(((
x
^
result
)
&
(
y
^
result
))
<
0
)
{
// it can not be an overflow when one of the operands is 0
if
(
sv
!=
so
||
sr
==
so
||
sv
==
0
||
so
==
0
)
{
return
ValueLong
.
get
(
result
);
}
throw
getOverflow
();
throw
getOverflow
();
}
}
return
ValueLong
.
get
(
result
);
}
@Override
@Override
public
int
getSignum
()
{
public
int
getSignum
()
{
...
@@ -96,17 +94,17 @@ public class ValueLong extends Value {
...
@@ -96,17 +94,17 @@ public class ValueLong extends Value {
@Override
@Override
public
Value
subtract
(
Value
v
)
{
public
Value
subtract
(
Value
v
)
{
ValueLong
other
=
(
ValueLong
)
v
;
long
x
=
value
;
int
sv
=
Long
.
signum
(
value
);
long
y
=
((
ValueLong
)
v
).
value
;
int
so
=
Long
.
signum
(
other
.
value
);
long
result
=
x
-
y
;
// if the operands have the same sign, then overflow can not occur
/*
// if the second operand is 0, then overflow can not occur
* If minuend and subtrahend have different signs and minuend and difference
if
(
sv
==
so
||
so
==
0
)
{
* have different signs there is an overflow.
return
ValueLong
.
get
(
value
-
other
.
value
);
*/
if
(((
x
^
y
)
&
(
x
^
result
))
<
0
)
{
throw
getOverflow
();
}
}
// now, if the other value is Long.MIN_VALUE, it must be an overflow
return
ValueLong
.
get
(
result
);
// x - Long.MIN_VALUE overflows for x>=0
return
add
(
other
.
negate
());
}
}
@Override
@Override
...
@@ -170,7 +168,7 @@ public class ValueLong extends Value {
...
@@ -170,7 +168,7 @@ public class ValueLong extends Value {
@Override
@Override
public
String
getString
()
{
public
String
getString
()
{
return
String
.
valueOf
(
value
);
return
Long
.
toString
(
value
);
}
}
@Override
@Override
...
...
h2/src/main/org/h2/value/ValueShort.java
浏览文件 @
70ba94a0
...
@@ -40,7 +40,7 @@ public class ValueShort extends Value {
...
@@ -40,7 +40,7 @@ public class ValueShort extends Value {
}
}
private
static
ValueShort
checkRange
(
int
x
)
{
private
static
ValueShort
checkRange
(
int
x
)
{
if
(
x
<
Short
.
MIN_VALUE
||
x
>
Short
.
MAX_VALUE
)
{
if
(
(
short
)
x
!=
x
)
{
throw
DbException
.
get
(
ErrorCode
.
NUMERIC_VALUE_OUT_OF_RANGE_1
,
throw
DbException
.
get
(
ErrorCode
.
NUMERIC_VALUE_OUT_OF_RANGE_1
,
Integer
.
toString
(
x
));
Integer
.
toString
(
x
));
}
}
...
@@ -115,7 +115,7 @@ public class ValueShort extends Value {
...
@@ -115,7 +115,7 @@ public class ValueShort extends Value {
@Override
@Override
public
String
getString
()
{
public
String
getString
()
{
return
String
.
valueOf
(
value
);
return
Integer
.
toString
(
value
);
}
}
@Override
@Override
...
...
h2/src/test/org/h2/samples/Function.java
浏览文件 @
70ba94a0
...
@@ -102,7 +102,7 @@ public class Function {
...
@@ -102,7 +102,7 @@ public class Function {
* @return true if it is a prime number
* @return true if it is a prime number
*/
*/
public
static
boolean
isPrime
(
int
value
)
{
public
static
boolean
isPrime
(
int
value
)
{
return
new
BigInteger
(
String
.
valueOf
(
value
)
).
isProbablePrime
(
100
);
return
BigInteger
.
valueOf
(
value
).
isProbablePrime
(
100
);
}
}
/**
/**
...
...
h2/src/test/org/h2/test/bench/BenchCRandom.java
浏览文件 @
70ba94a0
...
@@ -157,7 +157,7 @@ public class BenchCRandom {
...
@@ -157,7 +157,7 @@ public class BenchCRandom {
* @return the big decimal object
* @return the big decimal object
*/
*/
BigDecimal
getBigDecimal
(
int
value
,
int
scale
)
{
BigDecimal
getBigDecimal
(
int
value
,
int
scale
)
{
return
new
BigDecimal
(
new
BigInteger
(
String
.
valueOf
(
value
)
),
scale
);
return
new
BigDecimal
(
BigInteger
.
valueOf
(
value
),
scale
);
}
}
/**
/**
...
...
h2/src/tools/org/h2/dev/ftp/server/FtpControl.java
浏览文件 @
70ba94a0
...
@@ -304,7 +304,7 @@ public class FtpControl extends Thread {
...
@@ -304,7 +304,7 @@ public class FtpControl extends Thread {
}
else
if
(
"SIZE"
.
equals
(
command
))
{
}
else
if
(
"SIZE"
.
equals
(
command
))
{
param
=
getFileName
(
param
);
param
=
getFileName
(
param
);
if
(
FileUtils
.
exists
(
param
)
&&
!
FileUtils
.
isDirectory
(
param
))
{
if
(
FileUtils
.
exists
(
param
)
&&
!
FileUtils
.
isDirectory
(
param
))
{
reply
(
250
,
String
.
valueOf
(
FileUtils
.
size
(
param
)));
reply
(
250
,
Long
.
toString
(
FileUtils
.
size
(
param
)));
}
else
{
}
else
{
reply
(
500
,
"Failed"
);
reply
(
500
,
"Failed"
);
}
}
...
...
h2/src/tools/org/h2/dev/ftp/server/FtpServer.java
浏览文件 @
70ba94a0
...
@@ -230,7 +230,7 @@ public class FtpServer extends Tool implements Service {
...
@@ -230,7 +230,7 @@ public class FtpServer extends Tool implements Service {
buff
.
append
(
'r'
);
buff
.
append
(
'r'
);
buff
.
append
(
FileUtils
.
canWrite
(
fileName
)
?
'w'
:
'-'
);
buff
.
append
(
FileUtils
.
canWrite
(
fileName
)
?
'w'
:
'-'
);
buff
.
append
(
"------- 1 owner group "
);
buff
.
append
(
"------- 1 owner group "
);
String
size
=
String
.
valueOf
(
FileUtils
.
size
(
fileName
));
String
size
=
Long
.
toString
(
FileUtils
.
size
(
fileName
));
for
(
int
i
=
size
.
length
();
i
<
15
;
i
++)
{
for
(
int
i
=
size
.
length
();
i
<
15
;
i
++)
{
buff
.
append
(
' '
);
buff
.
append
(
' '
);
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论