Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
4389e581
Unverified
提交
4389e581
authored
7 年前
作者:
Noel Grandin
提交者:
GitHub
7 年前
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #787 from katzyn/misc
Assorted changes
上级
66b00c96
c27872f3
隐藏空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
63 行增加
和
81 行删除
+63
-81
Parser.java
h2/src/main/org/h2/command/Parser.java
+2
-2
Mode.java
h2/src/main/org/h2/engine/Mode.java
+6
-5
MVDelegateIndex.java
h2/src/main/org/h2/mvstore/db/MVDelegateIndex.java
+3
-5
MVPrimaryIndex.java
h2/src/main/org/h2/mvstore/db/MVPrimaryIndex.java
+2
-12
MVSecondaryIndex.java
h2/src/main/org/h2/mvstore/db/MVSecondaryIndex.java
+3
-3
Value.java
h2/src/main/org/h2/value/Value.java
+6
-18
ValueLong.java
h2/src/main/org/h2/value/ValueLong.java
+13
-3
FunctionMultiReturn.java
h2/src/test/org/h2/samples/FunctionMultiReturn.java
+1
-1
TestOptimizations.java
h2/src/test/org/h2/test/db/TestOptimizations.java
+1
-1
SupportedTypes.java
h2/src/test/org/h2/test/jaqu/SupportedTypes.java
+7
-7
TestPreparedStatement.java
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
+13
-18
TestResultSet.java
h2/src/test/org/h2/test/jdbc/TestResultSet.java
+5
-5
TestCrashAPI.java
h2/src/test/org/h2/test/synth/TestCrashAPI.java
+1
-1
没有找到文件。
h2/src/main/org/h2/command/Parser.java
浏览文件 @
4389e581
...
@@ -3186,7 +3186,7 @@ public class Parser {
...
@@ -3186,7 +3186,7 @@ public class Parser {
.
compareTo
(
ValueLong
.
MIN_BD
)
==
0
)
{
.
compareTo
(
ValueLong
.
MIN_BD
)
==
0
)
{
// convert Long.MIN_VALUE to type 'long'
// convert Long.MIN_VALUE to type 'long'
// (Long.MAX_VALUE+1 is of type 'decimal')
// (Long.MAX_VALUE+1 is of type 'decimal')
r
=
ValueExpression
.
get
(
ValueLong
.
get
(
Long
.
MIN_VALUE
)
);
r
=
ValueExpression
.
get
(
ValueLong
.
MIN
);
}
}
read
();
read
();
}
else
{
}
else
{
...
@@ -3813,7 +3813,7 @@ public class Parser {
...
@@ -3813,7 +3813,7 @@ public class Parser {
checkLiterals
(
false
);
checkLiterals
(
false
);
if
(!
containsE
&&
sub
.
indexOf
(
'.'
)
<
0
)
{
if
(!
containsE
&&
sub
.
indexOf
(
'.'
)
<
0
)
{
BigInteger
bi
=
new
BigInteger
(
sub
);
BigInteger
bi
=
new
BigInteger
(
sub
);
if
(
bi
.
compareTo
(
ValueLong
.
MAX
)
<=
0
)
{
if
(
bi
.
compareTo
(
ValueLong
.
MAX
_BI
)
<=
0
)
{
// parse constants like "10000000L"
// parse constants like "10000000L"
if
(
chars
[
i
]
==
'L'
)
{
if
(
chars
[
i
]
==
'L'
)
{
parseIndex
++;
parseIndex
++;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Mode.java
浏览文件 @
4389e581
...
@@ -27,19 +27,20 @@ public class Mode {
...
@@ -27,19 +27,20 @@ public class Mode {
*/
*/
public
enum
UniqueIndexNullsHandling
{
public
enum
UniqueIndexNullsHandling
{
/**
/**
* Multiple
identical indexed columns with at least one {@code NULL} value ar
e
* Multiple
rows with identical values in indexed columns with at least on
e
* allowed in unique index.
*
indexed {@code NULL} value are
allowed in unique index.
*/
*/
ALLOW_DUPLICATES_WITH_ANY_NULL
,
ALLOW_DUPLICATES_WITH_ANY_NULL
,
/**
/**
* Multiple
identical indexed columns with all {@code NULL} values are allow
ed
* Multiple
rows with identical values in indexed columns with all index
ed
* in unique index.
*
{@code NULL} values are allowed
in unique index.
*/
*/
ALLOW_DUPLICATES_WITH_ALL_NULLS
,
ALLOW_DUPLICATES_WITH_ALL_NULLS
,
/**
/**
* Multiple identical indexed columns are not allowed in unique index.
* Multiple rows with identical values in indexed columns are not allowed in
* unique index.
*/
*/
FORBID_ANY_DUPLICATES
;
FORBID_ANY_DUPLICATES
;
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/db/MVDelegateIndex.java
浏览文件 @
4389e581
...
@@ -66,12 +66,10 @@ public class MVDelegateIndex extends BaseIndex implements MVIndex {
...
@@ -66,12 +66,10 @@ public class MVDelegateIndex extends BaseIndex implements MVIndex {
@Override
@Override
public
Cursor
find
(
Session
session
,
SearchRow
first
,
SearchRow
last
)
{
public
Cursor
find
(
Session
session
,
SearchRow
first
,
SearchRow
last
)
{
ValueLong
min
=
mainIndex
.
getKey
(
first
,
ValueLong
min
=
mainIndex
.
getKey
(
first
,
ValueLong
.
MIN
,
ValueLong
.
MIN
);
MVPrimaryIndex
.
MIN
,
MVPrimaryIndex
.
MIN
);
// ifNull is MIN as well, because the column is never NULL
// ifNull is MIN_VALUE as well, because the column is never NULL
// so avoid returning all rows (returning one row is OK)
// so avoid returning all rows (returning one row is OK)
ValueLong
max
=
mainIndex
.
getKey
(
last
,
ValueLong
max
=
mainIndex
.
getKey
(
last
,
ValueLong
.
MAX
,
ValueLong
.
MIN
);
MVPrimaryIndex
.
MAX
,
MVPrimaryIndex
.
MIN
);
return
mainIndex
.
find
(
session
,
min
,
max
);
return
mainIndex
.
find
(
session
,
min
,
max
);
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/db/MVPrimaryIndex.java
浏览文件 @
4389e581
...
@@ -37,16 +37,6 @@ import org.h2.value.ValueNull;
...
@@ -37,16 +37,6 @@ import org.h2.value.ValueNull;
*/
*/
public
class
MVPrimaryIndex
extends
BaseIndex
{
public
class
MVPrimaryIndex
extends
BaseIndex
{
/**
* The minimum long value.
*/
static
final
ValueLong
MIN
=
ValueLong
.
get
(
Long
.
MIN_VALUE
);
/**
* The maximum long value.
*/
static
final
ValueLong
MAX
=
ValueLong
.
get
(
Long
.
MAX_VALUE
);
private
final
MVTable
mvTable
;
private
final
MVTable
mvTable
;
private
final
String
mapName
;
private
final
String
mapName
;
private
final
TransactionMap
<
Value
,
Value
>
dataMap
;
private
final
TransactionMap
<
Value
,
Value
>
dataMap
;
...
@@ -172,7 +162,7 @@ public class MVPrimaryIndex extends BaseIndex {
...
@@ -172,7 +162,7 @@ public class MVPrimaryIndex extends BaseIndex {
public
Cursor
find
(
Session
session
,
SearchRow
first
,
SearchRow
last
)
{
public
Cursor
find
(
Session
session
,
SearchRow
first
,
SearchRow
last
)
{
ValueLong
min
,
max
;
ValueLong
min
,
max
;
if
(
first
==
null
)
{
if
(
first
==
null
)
{
min
=
MIN
;
min
=
ValueLong
.
MIN
;
}
else
if
(
mainIndexColumn
<
0
)
{
}
else
if
(
mainIndexColumn
<
0
)
{
min
=
ValueLong
.
get
(
first
.
getKey
());
min
=
ValueLong
.
get
(
first
.
getKey
());
}
else
{
}
else
{
...
@@ -184,7 +174,7 @@ public class MVPrimaryIndex extends BaseIndex {
...
@@ -184,7 +174,7 @@ public class MVPrimaryIndex extends BaseIndex {
}
}
}
}
if
(
last
==
null
)
{
if
(
last
==
null
)
{
max
=
MAX
;
max
=
ValueLong
.
MAX
;
}
else
if
(
mainIndexColumn
<
0
)
{
}
else
if
(
mainIndexColumn
<
0
)
{
max
=
ValueLong
.
get
(
last
.
getKey
());
max
=
ValueLong
.
get
(
last
.
getKey
());
}
else
{
}
else
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/db/MVSecondaryIndex.java
浏览文件 @
4389e581
...
@@ -140,7 +140,7 @@ public final class MVSecondaryIndex extends BaseIndex implements MVIndex {
...
@@ -140,7 +140,7 @@ public final class MVSecondaryIndex extends BaseIndex implements MVIndex {
Value
[]
array
=
rowData
.
getList
();
Value
[]
array
=
rowData
.
getList
();
// don't change the original value
// don't change the original value
array
=
array
.
clone
();
array
=
array
.
clone
();
array
[
keyColumns
-
1
]
=
ValueLong
.
get
(
Long
.
MIN_VALUE
)
;
array
[
keyColumns
-
1
]
=
ValueLong
.
MIN
;
ValueArray
unique
=
ValueArray
.
get
(
array
);
ValueArray
unique
=
ValueArray
.
get
(
array
);
SearchRow
row
=
convertToSearchRow
(
rowData
);
SearchRow
row
=
convertToSearchRow
(
rowData
);
if
(!
mayHaveNullDuplicates
(
row
))
{
if
(!
mayHaveNullDuplicates
(
row
))
{
...
@@ -194,7 +194,7 @@ public final class MVSecondaryIndex extends BaseIndex implements MVIndex {
...
@@ -194,7 +194,7 @@ public final class MVSecondaryIndex extends BaseIndex implements MVIndex {
if
(
indexType
.
isUnique
())
{
if
(
indexType
.
isUnique
())
{
// this will detect committed entries only
// this will detect committed entries only
unique
=
convertToKey
(
row
);
unique
=
convertToKey
(
row
);
unique
.
getList
()[
keyColumns
-
1
]
=
ValueLong
.
get
(
Long
.
MIN_VALUE
)
;
unique
.
getList
()[
keyColumns
-
1
]
=
ValueLong
.
MIN
;
if
(
mayHaveNullDuplicates
(
row
))
{
if
(
mayHaveNullDuplicates
(
row
))
{
// No further unique checks required
// No further unique checks required
unique
=
null
;
unique
=
null
;
...
@@ -261,7 +261,7 @@ public final class MVSecondaryIndex extends BaseIndex implements MVIndex {
...
@@ -261,7 +261,7 @@ public final class MVSecondaryIndex extends BaseIndex implements MVIndex {
private
Cursor
find
(
Session
session
,
SearchRow
first
,
boolean
bigger
,
SearchRow
last
)
{
private
Cursor
find
(
Session
session
,
SearchRow
first
,
boolean
bigger
,
SearchRow
last
)
{
ValueArray
min
=
convertToKey
(
first
);
ValueArray
min
=
convertToKey
(
first
);
if
(
min
!=
null
)
{
if
(
min
!=
null
)
{
min
.
getList
()[
keyColumns
-
1
]
=
ValueLong
.
get
(
Long
.
MIN_VALUE
)
;
min
.
getList
()[
keyColumns
-
1
]
=
ValueLong
.
MIN
;
}
}
TransactionMap
<
Value
,
Value
>
map
=
getMap
(
session
);
TransactionMap
<
Value
,
Value
>
map
=
getMap
(
session
);
if
(
bigger
&&
min
!=
null
)
{
if
(
bigger
&&
min
!=
null
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/Value.java
浏览文件 @
4389e581
...
@@ -890,26 +890,14 @@ public abstract class Value {
...
@@ -890,26 +890,14 @@ public abstract class Value {
});
});
}
}
case
INT:
{
case
INT:
{
int
x
=
getInt
();
byte
[]
b
=
new
byte
[
4
];
return
ValueBytes
.
getNoCopy
(
new
byte
[]{
Bits
.
writeInt
(
b
,
0
,
getInt
());
(
byte
)
(
x
>>
24
),
return
ValueBytes
.
getNoCopy
(
b
);
(
byte
)
(
x
>>
16
),
(
byte
)
(
x
>>
8
),
(
byte
)
x
});
}
}
case
LONG:
{
case
LONG:
{
long
x
=
getLong
();
byte
[]
b
=
new
byte
[
8
];
return
ValueBytes
.
getNoCopy
(
new
byte
[]{
Bits
.
writeLong
(
b
,
0
,
getLong
());
(
byte
)
(
x
>>
56
),
return
ValueBytes
.
getNoCopy
(
b
);
(
byte
)
(
x
>>
48
),
(
byte
)
(
x
>>
40
),
(
byte
)
(
x
>>
32
),
(
byte
)
(
x
>>
24
),
(
byte
)
(
x
>>
16
),
(
byte
)
(
x
>>
8
),
(
byte
)
x
});
}
}
case
ENUM:
case
ENUM:
case
TIMESTAMP_TZ:
case
TIMESTAMP_TZ:
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/ValueLong.java
浏览文件 @
4389e581
...
@@ -18,10 +18,20 @@ import org.h2.message.DbException;
...
@@ -18,10 +18,20 @@ import org.h2.message.DbException;
*/
*/
public
class
ValueLong
extends
Value
{
public
class
ValueLong
extends
Value
{
/**
* The smallest {@code ValueLong} value.
*/
public
static
final
ValueLong
MIN
=
get
(
Long
.
MIN_VALUE
);
/**
* The largest {@code ValueLong} value.
*/
public
static
final
ValueLong
MAX
=
get
(
Long
.
MAX_VALUE
);
/**
/**
* The largest Long value, as a BigInteger.
* The largest Long value, as a BigInteger.
*/
*/
public
static
final
BigInteger
MAX
=
BigInteger
.
valueOf
(
Long
.
MAX_VALUE
);
public
static
final
BigInteger
MAX
_BI
=
BigInteger
.
valueOf
(
Long
.
MAX_VALUE
);
/**
/**
* The smallest Long value, as a BigDecimal.
* The smallest Long value, as a BigDecimal.
...
@@ -39,7 +49,7 @@ public class ValueLong extends Value {
...
@@ -39,7 +49,7 @@ public class ValueLong extends Value {
*/
*/
public
static
final
int
DISPLAY_SIZE
=
20
;
public
static
final
int
DISPLAY_SIZE
=
20
;
private
static
final
BigInteger
MIN
=
BigInteger
.
valueOf
(
Long
.
MIN_VALUE
);
private
static
final
BigInteger
MIN
_BI
=
BigInteger
.
valueOf
(
Long
.
MIN_VALUE
);
private
static
final
int
STATIC_SIZE
=
100
;
private
static
final
int
STATIC_SIZE
=
100
;
private
static
final
ValueLong
[]
STATIC_CACHE
;
private
static
final
ValueLong
[]
STATIC_CACHE
;
...
@@ -128,7 +138,7 @@ public class ValueLong extends Value {
...
@@ -128,7 +138,7 @@ public class ValueLong extends Value {
BigInteger
bv
=
BigInteger
.
valueOf
(
value
);
BigInteger
bv
=
BigInteger
.
valueOf
(
value
);
BigInteger
bo
=
BigInteger
.
valueOf
(
other
.
value
);
BigInteger
bo
=
BigInteger
.
valueOf
(
other
.
value
);
BigInteger
br
=
bv
.
multiply
(
bo
);
BigInteger
br
=
bv
.
multiply
(
bo
);
if
(
br
.
compareTo
(
MIN
)
<
0
||
br
.
compareTo
(
MAX
)
>
0
)
{
if
(
br
.
compareTo
(
MIN
_BI
)
<
0
||
br
.
compareTo
(
MAX_BI
)
>
0
)
{
throw
getOverflow
();
throw
getOverflow
();
}
}
return
ValueLong
.
get
(
br
.
longValue
());
return
ValueLong
.
get
(
br
.
longValue
());
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/samples/FunctionMultiReturn.java
浏览文件 @
4389e581
...
@@ -127,7 +127,7 @@ public class FunctionMultiReturn {
...
@@ -127,7 +127,7 @@ public class FunctionMultiReturn {
public
static
Object
[]
polar2CartesianArray
(
Double
r
,
Double
alpha
)
{
public
static
Object
[]
polar2CartesianArray
(
Double
r
,
Double
alpha
)
{
double
x
=
r
.
doubleValue
()
*
Math
.
cos
(
alpha
.
doubleValue
());
double
x
=
r
.
doubleValue
()
*
Math
.
cos
(
alpha
.
doubleValue
());
double
y
=
r
.
doubleValue
()
*
Math
.
sin
(
alpha
.
doubleValue
());
double
y
=
r
.
doubleValue
()
*
Math
.
sin
(
alpha
.
doubleValue
());
return
new
Object
[]{
new
Double
(
x
),
new
Double
(
y
)
};
return
new
Object
[]{
x
,
y
};
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestOptimizations.java
浏览文件 @
4389e581
...
@@ -876,7 +876,7 @@ public class TestOptimizations extends TestBase {
...
@@ -876,7 +876,7 @@ public class TestOptimizations extends TestBase {
case
5
:
case
5
:
if
(
random
.
nextInt
(
1000
)
==
1
)
{
if
(
random
.
nextInt
(
1000
)
==
1
)
{
stat
.
execute
(
"insert into test values("
+
i
+
", null)"
);
stat
.
execute
(
"insert into test values("
+
i
+
", null)"
);
map
.
put
(
new
Integer
(
i
)
,
null
);
map
.
put
(
i
,
null
);
}
else
{
}
else
{
int
value
=
random
.
nextInt
();
int
value
=
random
.
nextInt
();
stat
.
execute
(
"insert into test values("
+
i
+
", "
+
value
+
")"
);
stat
.
execute
(
"insert into test values("
+
i
+
", "
+
value
+
")"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jaqu/SupportedTypes.java
浏览文件 @
4389e581
...
@@ -74,13 +74,13 @@ public class SupportedTypes {
...
@@ -74,13 +74,13 @@ public class SupportedTypes {
static
SupportedTypes
randomValue
()
{
static
SupportedTypes
randomValue
()
{
Random
rand
=
new
Random
();
Random
rand
=
new
Random
();
SupportedTypes
s
=
new
SupportedTypes
();
SupportedTypes
s
=
new
SupportedTypes
();
s
.
myBool
=
Boolean
.
valueOf
(
rand
.
nextBoolean
()
);
s
.
myBool
=
rand
.
nextBoolean
(
);
s
.
myByte
=
new
Byte
((
byte
)
rand
.
nextInt
(
Byte
.
MAX_VALUE
)
);
s
.
myByte
=
(
byte
)
rand
.
nextInt
(
Byte
.
MAX_VALUE
);
s
.
myShort
=
new
Short
((
short
)
rand
.
nextInt
(
Short
.
MAX_VALUE
)
);
s
.
myShort
=
(
short
)
rand
.
nextInt
(
Short
.
MAX_VALUE
);
s
.
myInteger
=
new
Integer
(
rand
.
nextInt
()
);
s
.
myInteger
=
rand
.
nextInt
(
);
s
.
myLong
=
new
Long
(
rand
.
nextLong
()
);
s
.
myLong
=
rand
.
nextLong
(
);
s
.
myFloat
=
new
Float
(
rand
.
nextFloat
()
);
s
.
myFloat
=
rand
.
nextFloat
(
);
s
.
myDouble
=
new
Double
(
rand
.
nextDouble
()
);
s
.
myDouble
=
rand
.
nextDouble
(
);
s
.
myBigDecimal
=
new
BigDecimal
(
rand
.
nextDouble
());
s
.
myBigDecimal
=
new
BigDecimal
(
rand
.
nextDouble
());
s
.
myString
=
Long
.
toHexString
(
rand
.
nextLong
());
s
.
myString
=
Long
.
toHexString
(
rand
.
nextLong
());
s
.
myUtilDate
=
new
java
.
util
.
Date
(
rand
.
nextLong
());
s
.
myUtilDate
=
new
java
.
util
.
Date
(
rand
.
nextLong
());
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
浏览文件 @
4389e581
...
@@ -986,7 +986,7 @@ public class TestPreparedStatement extends TestBase {
...
@@ -986,7 +986,7 @@ public class TestPreparedStatement extends TestBase {
prep
.
setString
(
2
,
"-1"
);
prep
.
setString
(
2
,
"-1"
);
prep
.
executeUpdate
();
prep
.
executeUpdate
();
prep
.
setInt
(
1
,
7
);
prep
.
setInt
(
1
,
7
);
prep
.
setObject
(
2
,
new
Integer
(
3
)
);
prep
.
setObject
(
2
,
3
);
prep
.
executeUpdate
();
prep
.
executeUpdate
();
prep
.
setObject
(
1
,
"8"
);
prep
.
setObject
(
1
,
"8"
);
// should throw an exception
// should throw an exception
...
@@ -1132,12 +1132,12 @@ public class TestPreparedStatement extends TestBase {
...
@@ -1132,12 +1132,12 @@ public class TestPreparedStatement extends TestBase {
prep
.
setObject
(
1
,
Boolean
.
TRUE
);
prep
.
setObject
(
1
,
Boolean
.
TRUE
);
prep
.
setObject
(
2
,
"Abc"
);
prep
.
setObject
(
2
,
"Abc"
);
prep
.
setObject
(
3
,
new
BigDecimal
(
"10.2"
));
prep
.
setObject
(
3
,
new
BigDecimal
(
"10.2"
));
prep
.
setObject
(
4
,
new
Byte
((
byte
)
0xff
)
);
prep
.
setObject
(
4
,
(
byte
)
0xff
);
prep
.
setObject
(
5
,
new
Short
(
Short
.
MAX_VALUE
)
);
prep
.
setObject
(
5
,
Short
.
MAX_VALUE
);
prep
.
setObject
(
6
,
new
Integer
(
Integer
.
MIN_VALUE
)
);
prep
.
setObject
(
6
,
Integer
.
MIN_VALUE
);
prep
.
setObject
(
7
,
new
Long
(
Long
.
MAX_VALUE
)
);
prep
.
setObject
(
7
,
Long
.
MAX_VALUE
);
prep
.
setObject
(
8
,
new
Float
(
Float
.
MAX_VALUE
)
);
prep
.
setObject
(
8
,
Float
.
MAX_VALUE
);
prep
.
setObject
(
9
,
new
Double
(
Double
.
MAX_VALUE
)
);
prep
.
setObject
(
9
,
Double
.
MAX_VALUE
);
prep
.
setObject
(
10
,
java
.
sql
.
Date
.
valueOf
(
"2001-02-03"
));
prep
.
setObject
(
10
,
java
.
sql
.
Date
.
valueOf
(
"2001-02-03"
));
prep
.
setObject
(
11
,
java
.
sql
.
Time
.
valueOf
(
"04:05:06"
));
prep
.
setObject
(
11
,
java
.
sql
.
Time
.
valueOf
(
"04:05:06"
));
prep
.
setObject
(
12
,
java
.
sql
.
Timestamp
.
valueOf
(
prep
.
setObject
(
12
,
java
.
sql
.
Timestamp
.
valueOf
(
...
@@ -1145,7 +1145,7 @@ public class TestPreparedStatement extends TestBase {
...
@@ -1145,7 +1145,7 @@ public class TestPreparedStatement extends TestBase {
prep
.
setObject
(
13
,
new
java
.
util
.
Date
(
java
.
sql
.
Date
.
valueOf
(
prep
.
setObject
(
13
,
new
java
.
util
.
Date
(
java
.
sql
.
Date
.
valueOf
(
"2001-02-03"
).
getTime
()));
"2001-02-03"
).
getTime
()));
prep
.
setObject
(
14
,
new
byte
[]
{
10
,
20
,
30
});
prep
.
setObject
(
14
,
new
byte
[]
{
10
,
20
,
30
});
prep
.
setObject
(
15
,
new
Character
(
'a'
)
,
Types
.
OTHER
);
prep
.
setObject
(
15
,
'a'
,
Types
.
OTHER
);
prep
.
setObject
(
16
,
"2001-01-02"
,
Types
.
DATE
);
prep
.
setObject
(
16
,
"2001-01-02"
,
Types
.
DATE
);
// converting to null seems strange...
// converting to null seems strange...
prep
.
setObject
(
17
,
"2001-01-02"
,
Types
.
NULL
);
prep
.
setObject
(
17
,
"2001-01-02"
,
Types
.
NULL
);
...
@@ -1163,14 +1163,10 @@ public class TestPreparedStatement extends TestBase {
...
@@ -1163,14 +1163,10 @@ public class TestPreparedStatement extends TestBase {
(
Object
)
Byte
.
valueOf
((
byte
)
0xff
)
:
(
Object
)
Integer
.
valueOf
(-
1
)));
(
Object
)
Byte
.
valueOf
((
byte
)
0xff
)
:
(
Object
)
Integer
.
valueOf
(-
1
)));
assertTrue
(
rs
.
getObject
(
5
).
equals
(
SysProperties
.
OLD_RESULT_SET_GET_OBJECT
?
assertTrue
(
rs
.
getObject
(
5
).
equals
(
SysProperties
.
OLD_RESULT_SET_GET_OBJECT
?
(
Object
)
Short
.
valueOf
(
Short
.
MAX_VALUE
)
:
(
Object
)
Integer
.
valueOf
(
Short
.
MAX_VALUE
)));
(
Object
)
Short
.
valueOf
(
Short
.
MAX_VALUE
)
:
(
Object
)
Integer
.
valueOf
(
Short
.
MAX_VALUE
)));
assertTrue
(
rs
.
getObject
(
6
).
equals
(
assertTrue
(
rs
.
getObject
(
6
).
equals
(
Integer
.
MIN_VALUE
));
new
Integer
(
Integer
.
MIN_VALUE
)));
assertTrue
(
rs
.
getObject
(
7
).
equals
(
Long
.
MAX_VALUE
));
assertTrue
(
rs
.
getObject
(
7
).
equals
(
assertTrue
(
rs
.
getObject
(
8
).
equals
(
Float
.
MAX_VALUE
));
new
Long
(
Long
.
MAX_VALUE
)));
assertTrue
(
rs
.
getObject
(
9
).
equals
(
Double
.
MAX_VALUE
));
assertTrue
(
rs
.
getObject
(
8
).
equals
(
new
Float
(
Float
.
MAX_VALUE
)));
assertTrue
(
rs
.
getObject
(
9
).
equals
(
new
Double
(
Double
.
MAX_VALUE
)));
assertTrue
(
rs
.
getObject
(
10
).
equals
(
assertTrue
(
rs
.
getObject
(
10
).
equals
(
java
.
sql
.
Date
.
valueOf
(
"2001-02-03"
)));
java
.
sql
.
Date
.
valueOf
(
"2001-02-03"
)));
assertEquals
(
"04:05:06"
,
rs
.
getObject
(
11
).
toString
());
assertEquals
(
"04:05:06"
,
rs
.
getObject
(
11
).
toString
());
...
@@ -1185,8 +1181,7 @@ public class TestPreparedStatement extends TestBase {
...
@@ -1185,8 +1181,7 @@ public class TestPreparedStatement extends TestBase {
assertTrue
(
rs
.
getObject
(
16
).
equals
(
assertTrue
(
rs
.
getObject
(
16
).
equals
(
java
.
sql
.
Date
.
valueOf
(
"2001-01-02"
)));
java
.
sql
.
Date
.
valueOf
(
"2001-01-02"
)));
assertTrue
(
rs
.
getObject
(
17
)
==
null
&&
rs
.
wasNull
());
assertTrue
(
rs
.
getObject
(
17
)
==
null
&&
rs
.
wasNull
());
assertTrue
(
rs
.
getObject
(
18
).
equals
(
assertTrue
(
rs
.
getObject
(
18
).
equals
(
3.725d
));
new
Double
(
3.725
)));
assertTrue
(
rs
.
getObject
(
19
).
equals
(
assertTrue
(
rs
.
getObject
(
19
).
equals
(
java
.
sql
.
Time
.
valueOf
(
"23:22:21"
)));
java
.
sql
.
Time
.
valueOf
(
"23:22:21"
)));
assertTrue
(
rs
.
getObject
(
20
).
equals
(
assertTrue
(
rs
.
getObject
(
20
).
equals
(
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/jdbc/TestResultSet.java
浏览文件 @
4389e581
...
@@ -1205,19 +1205,19 @@ public class TestResultSet extends TestBase {
...
@@ -1205,19 +1205,19 @@ public class TestResultSet extends TestBase {
o
=
rs
.
getObject
(
2
);
o
=
rs
.
getObject
(
2
);
trace
(
o
.
getClass
().
getName
());
trace
(
o
.
getClass
().
getName
());
assertTrue
(
o
instanceof
Double
);
assertTrue
(
o
instanceof
Double
);
assertTrue
(((
Double
)
o
).
compareTo
(
new
Double
(
"-1.00"
)
)
==
0
);
assertTrue
(((
Double
)
o
).
compareTo
(
-
1
d
)
==
0
);
o
=
rs
.
getObject
(
2
,
Double
.
class
);
o
=
rs
.
getObject
(
2
,
Double
.
class
);
trace
(
o
.
getClass
().
getName
());
trace
(
o
.
getClass
().
getName
());
assertTrue
(
o
instanceof
Double
);
assertTrue
(
o
instanceof
Double
);
assertTrue
(((
Double
)
o
).
compareTo
(
new
Double
(
"-1.00"
)
)
==
0
);
assertTrue
(((
Double
)
o
).
compareTo
(
-
1
d
)
==
0
);
o
=
rs
.
getObject
(
3
);
o
=
rs
.
getObject
(
3
);
trace
(
o
.
getClass
().
getName
());
trace
(
o
.
getClass
().
getName
());
assertTrue
(
o
instanceof
Float
);
assertTrue
(
o
instanceof
Float
);
assertTrue
(((
Float
)
o
).
compareTo
(
new
Float
(
"-1.00"
)
)
==
0
);
assertTrue
(((
Float
)
o
).
compareTo
(
-
1
f
)
==
0
);
o
=
rs
.
getObject
(
3
,
Float
.
class
);
o
=
rs
.
getObject
(
3
,
Float
.
class
);
trace
(
o
.
getClass
().
getName
());
trace
(
o
.
getClass
().
getName
());
assertTrue
(
o
instanceof
Float
);
assertTrue
(
o
instanceof
Float
);
assertTrue
(((
Float
)
o
).
compareTo
(
new
Float
(
"-1.00"
)
)
==
0
);
assertTrue
(((
Float
)
o
).
compareTo
(
-
1
f
)
==
0
);
rs
.
next
();
rs
.
next
();
assertTrue
(
rs
.
getInt
(
1
)
==
2
);
assertTrue
(
rs
.
getInt
(
1
)
==
2
);
assertTrue
(!
rs
.
wasNull
());
assertTrue
(!
rs
.
wasNull
());
...
@@ -1745,7 +1745,7 @@ public class TestResultSet extends TestBase {
...
@@ -1745,7 +1745,7 @@ public class TestResultSet extends TestBase {
stat
.
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY, VALUE ARRAY)"
);
stat
.
execute
(
"CREATE TABLE TEST(ID INT PRIMARY KEY, VALUE ARRAY)"
);
PreparedStatement
prep
=
conn
.
prepareStatement
(
"INSERT INTO TEST VALUES(?, ?)"
);
PreparedStatement
prep
=
conn
.
prepareStatement
(
"INSERT INTO TEST VALUES(?, ?)"
);
prep
.
setInt
(
1
,
1
);
prep
.
setInt
(
1
,
1
);
prep
.
setObject
(
2
,
new
Object
[]
{
new
Integer
(
1
),
new
Integer
(
2
)
});
prep
.
setObject
(
2
,
new
Object
[]
{
1
,
2
});
prep
.
execute
();
prep
.
execute
();
prep
.
setInt
(
1
,
2
);
prep
.
setInt
(
1
,
2
);
prep
.
setObject
(
2
,
new
Object
[]
{
11
,
12
});
prep
.
setObject
(
2
,
new
Object
[]
{
11
,
12
});
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/synth/TestCrashAPI.java
浏览文件 @
4389e581
...
@@ -440,7 +440,7 @@ public class TestCrashAPI extends TestBase implements Runnable {
...
@@ -440,7 +440,7 @@ public class TestCrashAPI extends TestBase implements Runnable {
}
else
if
(
type
==
boolean
.
class
)
{
}
else
if
(
type
==
boolean
.
class
)
{
return
random
.
nextBoolean
();
return
random
.
nextBoolean
();
}
else
if
(
type
==
double
.
class
)
{
}
else
if
(
type
==
double
.
class
)
{
return
new
Double
(
random
.
getRandomDouble
()
);
return
random
.
getRandomDouble
(
);
}
else
if
(
type
==
String
.
class
)
{
}
else
if
(
type
==
String
.
class
)
{
if
(
random
.
getInt
(
10
)
==
0
)
{
if
(
random
.
getInt
(
10
)
==
0
)
{
return
null
;
return
null
;
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论