Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
68b1bf67
Shardingsphere
项目概览
apache
/
Shardingsphere
通知
56
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Shardingsphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
68b1bf67
编写于
10月 10, 2019
作者:
杨
杨翊 Sion Yang
提交者:
Liang Zhang
10月 10, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
For #3017, get value according to target class in StreamQueryResult (#3208)
上级
a01fce65
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
109 addition
and
14 deletion
+109
-14
sharding-core/sharding-core-execute/src/main/java/org/apache/shardingsphere/core/execute/sql/execute/result/QueryResultUtil.java
...here/core/execute/sql/execute/result/QueryResultUtil.java
+51
-0
sharding-core/sharding-core-execute/src/main/java/org/apache/shardingsphere/core/execute/sql/execute/result/StreamQueryResult.java
...re/core/execute/sql/execute/result/StreamQueryResult.java
+2
-2
sharding-core/sharding-core-execute/src/test/java/org/apache/shardingsphere/core/execute/sql/execute/result/QueryResultUtilTest.java
.../core/execute/sql/execute/result/QueryResultUtilTest.java
+52
-4
sharding-core/sharding-core-execute/src/test/java/org/apache/shardingsphere/core/execute/sql/execute/result/StreamQueryResultTest.java
...ore/execute/sql/execute/result/StreamQueryResultTest.java
+4
-8
未找到文件。
sharding-core/sharding-core-execute/src/main/java/org/apache/shardingsphere/core/execute/sql/execute/result/QueryResultUtil.java
浏览文件 @
68b1bf67
...
...
@@ -20,9 +20,15 @@ package org.apache.shardingsphere.core.execute.sql.execute.result;
import
lombok.AccessLevel
;
import
lombok.NoArgsConstructor
;
import
java.math.BigDecimal
;
import
java.sql.Blob
;
import
java.sql.Clob
;
import
java.sql.Date
;
import
java.sql.ResultSet
;
import
java.sql.ResultSetMetaData
;
import
java.sql.SQLException
;
import
java.sql.Time
;
import
java.sql.Timestamp
;
import
java.sql.Types
;
/**
...
...
@@ -46,6 +52,51 @@ public final class QueryResultUtil {
return
resultSet
.
wasNull
()
?
null
:
result
;
}
/**
* Get value by target class.
*
* @param resultSet result set
* @param columnIndex column index of value
* @param targetClass target class
* @return {@code null} if the column is SQL {@code NULL}, otherwise the value of column
* @throws SQLException SQL exception
*/
public
static
Object
getValue
(
final
ResultSet
resultSet
,
final
int
columnIndex
,
final
Class
<?>
targetClass
)
throws
SQLException
{
if
(
boolean
.
class
==
targetClass
)
{
return
resultSet
.
getBoolean
(
columnIndex
);
}
else
if
(
byte
.
class
==
targetClass
)
{
return
resultSet
.
getByte
(
columnIndex
);
}
else
if
(
short
.
class
==
targetClass
)
{
return
resultSet
.
getShort
(
columnIndex
);
}
else
if
(
int
.
class
==
targetClass
)
{
return
resultSet
.
getInt
(
columnIndex
);
}
else
if
(
long
.
class
==
targetClass
)
{
return
resultSet
.
getLong
(
columnIndex
);
}
else
if
(
float
.
class
==
targetClass
)
{
return
resultSet
.
getFloat
(
columnIndex
);
}
else
if
(
double
.
class
==
targetClass
)
{
return
resultSet
.
getDouble
(
columnIndex
);
}
else
if
(
String
.
class
==
targetClass
)
{
return
resultSet
.
getString
(
columnIndex
);
}
else
if
(
BigDecimal
.
class
==
targetClass
)
{
return
resultSet
.
getBigDecimal
(
columnIndex
);
}
else
if
(
byte
[].
class
==
targetClass
)
{
return
resultSet
.
getBytes
(
columnIndex
);
}
else
if
(
Date
.
class
==
targetClass
)
{
return
resultSet
.
getDate
(
columnIndex
);
}
else
if
(
Time
.
class
==
targetClass
)
{
return
resultSet
.
getTime
(
columnIndex
);
}
else
if
(
Timestamp
.
class
==
targetClass
)
{
return
resultSet
.
getTimestamp
(
columnIndex
);
}
else
if
(
Blob
.
class
==
targetClass
)
{
return
resultSet
.
getBlob
(
columnIndex
);
}
else
if
(
Clob
.
class
==
targetClass
)
{
return
resultSet
.
getClob
(
columnIndex
);
}
else
{
return
resultSet
.
getObject
(
columnIndex
);
}
}
private
static
Object
getValueByColumnType
(
final
ResultSet
resultSet
,
final
int
columnIndex
)
throws
SQLException
{
ResultSetMetaData
metaData
=
resultSet
.
getMetaData
();
switch
(
metaData
.
getColumnType
(
columnIndex
))
{
...
...
sharding-core/sharding-core-execute/src/main/java/org/apache/shardingsphere/core/execute/sql/execute/result/StreamQueryResult.java
浏览文件 @
68b1bf67
...
...
@@ -68,12 +68,12 @@ public final class StreamQueryResult implements QueryResult {
@Override
public
Object
getValue
(
final
int
columnIndex
,
final
Class
<?>
type
)
throws
SQLException
{
return
decrypt
(
columnIndex
,
QueryResultUtil
.
getValue
(
resultSet
,
columnIndex
));
return
decrypt
(
columnIndex
,
QueryResultUtil
.
getValue
(
resultSet
,
columnIndex
,
type
));
}
@Override
public
Object
getValue
(
final
String
columnLabel
,
final
Class
<?>
type
)
throws
SQLException
{
return
decrypt
(
columnLabel
,
QueryResultUtil
.
getValue
(
resultSet
,
queryResultMetaData
.
getColumnIndex
(
columnLabel
)));
return
decrypt
(
columnLabel
,
QueryResultUtil
.
getValue
(
resultSet
,
queryResultMetaData
.
getColumnIndex
(
columnLabel
)
,
type
));
}
@Override
...
...
sharding-core/sharding-core-execute/src/test/java/org/apache/shardingsphere/core/execute/sql/execute/result/QueryResultUtilTest.java
浏览文件 @
68b1bf67
...
...
@@ -69,20 +69,24 @@ public final class QueryResultUtilTest {
when
(
resultSetMetaData
.
getColumnType
(
1
)).
thenReturn
(
Types
.
BOOLEAN
);
when
(
resultSet
.
getBoolean
(
1
)).
thenReturn
(
true
);
assertTrue
((
boolean
)
QueryResultUtil
.
getValue
(
resultSet
,
1
));
assertTrue
((
boolean
)
QueryResultUtil
.
getValue
(
resultSet
,
1
,
boolean
.
class
));
}
@Test
public
void
assertGetValueByTinyint
()
throws
SQLException
{
when
(
resultSetMetaData
.
getColumnType
(
1
)).
thenReturn
(
Types
.
TINYINT
);
when
(
resultSet
.
getInt
(
1
)).
thenReturn
(
Integer
.
MAX_VALUE
);
assertThat
((
int
)
QueryResultUtil
.
getValue
(
resultSet
,
1
),
is
(
Integer
.
MAX_VALUE
));
when
(
resultSet
.
getInt
(
1
)).
thenReturn
(
1
);
assertThat
((
int
)
QueryResultUtil
.
getValue
(
resultSet
,
1
),
is
(
1
));
assertThat
((
int
)
QueryResultUtil
.
getValue
(
resultSet
,
1
,
int
.
class
),
is
(
1
));
}
@Test
public
void
assertGetValueBySmallint
()
throws
SQLException
{
when
(
resultSetMetaData
.
getColumnType
(
1
)).
thenReturn
(
Types
.
SMALLINT
);
when
(
resultSet
.
getInt
(
1
)).
thenReturn
(
Integer
.
MAX_VALUE
);
assertThat
((
int
)
QueryResultUtil
.
getValue
(
resultSet
,
1
),
is
(
Integer
.
MAX_VALUE
));
when
(
resultSet
.
getInt
(
1
)).
thenReturn
(
32767
);
assertThat
((
int
)
QueryResultUtil
.
getValue
(
resultSet
,
1
),
is
(
32767
));
assertThat
((
int
)
QueryResultUtil
.
getValue
(
resultSet
,
1
,
int
.
class
),
is
(
32767
));
}
@Test
...
...
@@ -90,6 +94,8 @@ public final class QueryResultUtilTest {
when
(
resultSetMetaData
.
getColumnType
(
1
)).
thenReturn
(
Types
.
INTEGER
);
when
(
resultSet
.
getInt
(
1
)).
thenReturn
(
Integer
.
MAX_VALUE
);
assertThat
((
int
)
QueryResultUtil
.
getValue
(
resultSet
,
1
),
is
(
Integer
.
MAX_VALUE
));
assertThat
((
int
)
QueryResultUtil
.
getValue
(
resultSet
,
1
,
int
.
class
),
is
(
Integer
.
MAX_VALUE
));
}
@Test
...
...
@@ -97,6 +103,7 @@ public final class QueryResultUtilTest {
when
(
resultSetMetaData
.
getColumnType
(
1
)).
thenReturn
(
Types
.
BIGINT
);
when
(
resultSet
.
getLong
(
1
)).
thenReturn
(
Long
.
MAX_VALUE
);
assertThat
((
long
)
QueryResultUtil
.
getValue
(
resultSet
,
1
),
is
(
Long
.
MAX_VALUE
));
assertThat
((
long
)
QueryResultUtil
.
getValue
(
resultSet
,
1
,
long
.
class
),
is
(
Long
.
MAX_VALUE
));
}
@Test
...
...
@@ -104,6 +111,7 @@ public final class QueryResultUtilTest {
when
(
resultSetMetaData
.
getColumnType
(
1
)).
thenReturn
(
Types
.
NUMERIC
);
when
(
resultSet
.
getBigDecimal
(
1
)).
thenReturn
(
BigDecimal
.
TEN
);
assertThat
((
BigDecimal
)
QueryResultUtil
.
getValue
(
resultSet
,
1
),
is
(
BigDecimal
.
TEN
));
assertThat
((
BigDecimal
)
QueryResultUtil
.
getValue
(
resultSet
,
1
,
BigDecimal
.
class
),
is
(
BigDecimal
.
TEN
));
}
@Test
...
...
@@ -111,13 +119,17 @@ public final class QueryResultUtilTest {
when
(
resultSetMetaData
.
getColumnType
(
1
)).
thenReturn
(
Types
.
DECIMAL
);
when
(
resultSet
.
getBigDecimal
(
1
)).
thenReturn
(
BigDecimal
.
TEN
);
assertThat
((
BigDecimal
)
QueryResultUtil
.
getValue
(
resultSet
,
1
),
is
(
BigDecimal
.
TEN
));
assertThat
((
BigDecimal
)
QueryResultUtil
.
getValue
(
resultSet
,
1
,
BigDecimal
.
class
),
is
(
BigDecimal
.
TEN
));
}
@Test
public
void
assertGetValueByFloat
()
throws
SQLException
{
when
(
resultSetMetaData
.
getColumnType
(
1
)).
thenReturn
(
Types
.
FLOAT
);
when
(
resultSet
.
getDouble
(
1
)).
thenReturn
(
Double
.
MAX_VALUE
);
when
(
resultSet
.
getFloat
(
1
)).
thenReturn
(
Float
.
MAX_VALUE
);
assertThat
((
double
)
QueryResultUtil
.
getValue
(
resultSet
,
1
),
is
(
Double
.
MAX_VALUE
));
assertThat
((
float
)
QueryResultUtil
.
getValue
(
resultSet
,
1
,
float
.
class
),
is
(
Float
.
MAX_VALUE
));
}
@Test
...
...
@@ -125,6 +137,8 @@ public final class QueryResultUtilTest {
when
(
resultSetMetaData
.
getColumnType
(
1
)).
thenReturn
(
Types
.
DOUBLE
);
when
(
resultSet
.
getDouble
(
1
)).
thenReturn
(
Double
.
MAX_VALUE
);
assertThat
((
double
)
QueryResultUtil
.
getValue
(
resultSet
,
1
),
is
(
Double
.
MAX_VALUE
));
assertThat
((
double
)
QueryResultUtil
.
getValue
(
resultSet
,
1
,
double
.
class
),
is
(
Double
.
MAX_VALUE
));
}
@Test
...
...
@@ -132,6 +146,7 @@ public final class QueryResultUtilTest {
when
(
resultSetMetaData
.
getColumnType
(
1
)).
thenReturn
(
Types
.
CHAR
);
when
(
resultSet
.
getString
(
1
)).
thenReturn
(
"x"
);
assertThat
((
String
)
QueryResultUtil
.
getValue
(
resultSet
,
1
),
is
(
"x"
));
assertThat
((
String
)
QueryResultUtil
.
getValue
(
resultSet
,
1
,
String
.
class
),
is
(
"x"
));
}
@Test
...
...
@@ -139,6 +154,7 @@ public final class QueryResultUtilTest {
when
(
resultSetMetaData
.
getColumnType
(
1
)).
thenReturn
(
Types
.
VARCHAR
);
when
(
resultSet
.
getString
(
1
)).
thenReturn
(
"xxxxx"
);
assertThat
((
String
)
QueryResultUtil
.
getValue
(
resultSet
,
1
),
is
(
"xxxxx"
));
assertThat
((
String
)
QueryResultUtil
.
getValue
(
resultSet
,
1
,
String
.
class
),
is
(
"xxxxx"
));
}
@Test
...
...
@@ -146,6 +162,7 @@ public final class QueryResultUtilTest {
when
(
resultSetMetaData
.
getColumnType
(
1
)).
thenReturn
(
Types
.
LONGVARCHAR
);
when
(
resultSet
.
getString
(
1
)).
thenReturn
(
"xxxxx"
);
assertThat
((
String
)
QueryResultUtil
.
getValue
(
resultSet
,
1
),
is
(
"xxxxx"
));
assertThat
((
String
)
QueryResultUtil
.
getValue
(
resultSet
,
1
,
String
.
class
),
is
(
"xxxxx"
));
}
@Test
...
...
@@ -154,6 +171,7 @@ public final class QueryResultUtilTest {
when
(
resultSetMetaData
.
getColumnType
(
1
)).
thenReturn
(
Types
.
BINARY
);
when
(
resultSet
.
getBlob
(
1
)).
thenReturn
(
blob
);
assertThat
((
Blob
)
QueryResultUtil
.
getValue
(
resultSet
,
1
),
is
(
blob
));
assertThat
((
Blob
)
QueryResultUtil
.
getValue
(
resultSet
,
1
,
Blob
.
class
),
is
(
blob
));
}
@Test
...
...
@@ -162,6 +180,8 @@ public final class QueryResultUtilTest {
when
(
resultSetMetaData
.
getColumnType
(
1
)).
thenReturn
(
Types
.
VARBINARY
);
when
(
resultSet
.
getBlob
(
1
)).
thenReturn
(
blob
);
assertThat
((
Blob
)
QueryResultUtil
.
getValue
(
resultSet
,
1
),
is
(
blob
));
assertThat
((
Blob
)
QueryResultUtil
.
getValue
(
resultSet
,
1
,
Blob
.
class
),
is
(
blob
));
}
@Test
...
...
@@ -170,6 +190,8 @@ public final class QueryResultUtilTest {
when
(
resultSetMetaData
.
getColumnType
(
1
)).
thenReturn
(
Types
.
LONGVARBINARY
);
when
(
resultSet
.
getBlob
(
1
)).
thenReturn
(
blob
);
assertThat
((
Blob
)
QueryResultUtil
.
getValue
(
resultSet
,
1
),
is
(
blob
));
assertThat
((
Blob
)
QueryResultUtil
.
getValue
(
resultSet
,
1
,
Blob
.
class
),
is
(
blob
));
}
@Test
...
...
@@ -178,6 +200,7 @@ public final class QueryResultUtilTest {
when
(
resultSetMetaData
.
getColumnType
(
1
)).
thenReturn
(
Types
.
DATE
);
when
(
resultSet
.
getDate
(
1
)).
thenReturn
(
new
Date
(
currentTime
));
assertThat
((
Date
)
QueryResultUtil
.
getValue
(
resultSet
,
1
),
is
(
new
Date
(
currentTime
)));
assertThat
((
Date
)
QueryResultUtil
.
getValue
(
resultSet
,
1
,
Date
.
class
),
is
(
new
Date
(
currentTime
)));
}
@Test
...
...
@@ -186,6 +209,7 @@ public final class QueryResultUtilTest {
when
(
resultSetMetaData
.
getColumnType
(
1
)).
thenReturn
(
Types
.
TIME
);
when
(
resultSet
.
getTime
(
1
)).
thenReturn
(
new
Time
(
currentTime
));
assertThat
((
Time
)
QueryResultUtil
.
getValue
(
resultSet
,
1
),
is
(
new
Time
(
currentTime
)));
assertThat
((
Time
)
QueryResultUtil
.
getValue
(
resultSet
,
1
,
Time
.
class
),
is
(
new
Time
(
currentTime
)));
}
@Test
...
...
@@ -194,6 +218,7 @@ public final class QueryResultUtilTest {
when
(
resultSetMetaData
.
getColumnType
(
1
)).
thenReturn
(
Types
.
TIMESTAMP
);
when
(
resultSet
.
getTimestamp
(
1
)).
thenReturn
(
new
Timestamp
(
currentTime
));
assertThat
((
Timestamp
)
QueryResultUtil
.
getValue
(
resultSet
,
1
),
is
(
new
Timestamp
(
currentTime
)));
assertThat
((
Timestamp
)
QueryResultUtil
.
getValue
(
resultSet
,
1
,
Timestamp
.
class
),
is
(
new
Timestamp
(
currentTime
)));
}
@Test
...
...
@@ -203,6 +228,7 @@ public final class QueryResultUtilTest {
when
(
resultSetMetaData
.
getColumnType
(
1
)).
thenReturn
(
Types
.
CLOB
);
when
(
resultSet
.
getClob
(
1
)).
thenReturn
(
clob
);
assertThat
((
Clob
)
QueryResultUtil
.
getValue
(
resultSet
,
1
),
is
(
clob
));
assertThat
((
Clob
)
QueryResultUtil
.
getValue
(
resultSet
,
1
,
Clob
.
class
),
is
(
clob
));
}
@Test
...
...
@@ -211,6 +237,27 @@ public final class QueryResultUtilTest {
when
(
resultSetMetaData
.
getColumnType
(
1
)).
thenReturn
(
Types
.
BLOB
);
when
(
resultSet
.
getBlob
(
1
)).
thenReturn
(
blob
);
assertThat
((
Blob
)
QueryResultUtil
.
getValue
(
resultSet
,
1
),
is
(
blob
));
assertThat
((
Blob
)
QueryResultUtil
.
getValue
(
resultSet
,
1
,
Blob
.
class
),
is
(
blob
));
}
@Test
public
void
assertGetValueByShort
()
throws
SQLException
{
when
(
resultSet
.
getShort
(
1
)).
thenReturn
(
Short
.
MAX_VALUE
);
assertThat
((
short
)
QueryResultUtil
.
getValue
(
resultSet
,
1
,
short
.
class
),
is
(
Short
.
MAX_VALUE
));
}
@Test
public
void
assertGetValueByByte
()
throws
SQLException
{
byte
value
=
0x00
;
when
(
resultSet
.
getByte
(
1
)).
thenReturn
(
value
);
assertThat
((
byte
)
QueryResultUtil
.
getValue
(
resultSet
,
1
,
byte
.
class
),
is
(
value
));
}
@Test
public
void
assertGetValueByBytes
()
throws
SQLException
{
byte
[]
values
=
new
byte
[]
{
0x00
};
when
(
resultSet
.
getBytes
(
1
)).
thenReturn
(
values
);
assertThat
((
byte
[])
QueryResultUtil
.
getValue
(
resultSet
,
1
,
byte
[].
class
),
is
(
values
));
}
@Test
...
...
@@ -219,6 +266,7 @@ public final class QueryResultUtilTest {
when
(
resultSetMetaData
.
getColumnType
(
1
)).
thenReturn
(
Types
.
OTHER
);
when
(
resultSet
.
getObject
(
1
)).
thenReturn
(
object
);
assertThat
(
QueryResultUtil
.
getValue
(
resultSet
,
1
),
is
(
object
));
assertThat
(
QueryResultUtil
.
getValue
(
resultSet
,
1
,
Object
.
class
),
is
(
object
));
}
@Test
...
...
sharding-core/sharding-core-execute/src/test/java/org/apache/shardingsphere/core/execute/sql/execute/result/StreamQueryResultTest.java
浏览文件 @
68b1bf67
...
...
@@ -34,7 +34,6 @@ import java.sql.ResultSetMetaData;
import
java.sql.SQLException
;
import
java.sql.Time
;
import
java.sql.Timestamp
;
import
java.sql.Types
;
import
java.util.Calendar
;
import
java.util.Properties
;
...
...
@@ -95,14 +94,14 @@ public final class StreamQueryResultTest {
public
void
assertGetValueWithColumnIndex
()
throws
SQLException
{
StreamQueryResult
queryResult
=
new
StreamQueryResult
(
getResultSet
());
queryResult
.
next
();
assertThat
(
queryResult
.
getValue
(
1
,
Integer
.
class
),
Is
.<
Object
>
is
(
1
));
assertThat
(
queryResult
.
getValue
(
1
,
int
.
class
),
Is
.<
Object
>
is
(
1
));
}
@Test
public
void
assertGetValueWithColumnLabel
()
throws
SQLException
{
StreamQueryResult
queryResult
=
new
StreamQueryResult
(
getResultSet
());
queryResult
.
next
();
assertThat
(
queryResult
.
getValue
(
"order_id"
,
Integer
.
class
),
Is
.<
Object
>
is
(
1
));
assertThat
(
queryResult
.
getValue
(
"order_id"
,
int
.
class
),
Is
.<
Object
>
is
(
1
));
}
@Test
...
...
@@ -110,7 +109,7 @@ public final class StreamQueryResultTest {
when
(
shardingEncryptor
.
decrypt
(
"1"
)).
thenReturn
(
"1"
);
StreamQueryResult
queryResult
=
new
StreamQueryResult
(
getResultSet
(),
getShardingRule
(),
new
ShardingProperties
(
new
Properties
()));
queryResult
.
next
();
assertThat
(
queryResult
.
getValue
(
"order_id"
,
Integer
.
class
),
Is
.<
Object
>
is
(
"1"
));
assertThat
(
queryResult
.
getValue
(
"order_id"
,
int
.
class
),
Is
.<
Object
>
is
(
"1"
));
}
@Test
(
expected
=
Exception
.
class
)
...
...
@@ -118,14 +117,13 @@ public final class StreamQueryResultTest {
ResultSet
resultSet
=
getResultSetWithException
();
StreamQueryResult
queryResult
=
new
StreamQueryResult
(
resultSet
);
queryResult
.
next
();
queryResult
.
getValue
(
"order_id"
,
Integer
.
class
);
queryResult
.
getValue
(
"order_id"
,
int
.
class
);
}
private
ResultSet
getResultSetWithException
()
throws
SQLException
{
ResultSet
result
=
mock
(
ResultSet
.
class
);
when
(
result
.
next
()).
thenReturn
(
true
).
thenReturn
(
false
);
when
(
result
.
getInt
(
1
)).
thenReturn
(
1
);
when
(
result
.
wasNull
()).
thenReturn
(
false
);
doReturn
(
getResultSetMetaDataWithException
()).
when
(
result
).
getMetaData
();
return
result
;
}
...
...
@@ -135,7 +133,6 @@ public final class StreamQueryResultTest {
when
(
result
.
getColumnCount
()).
thenReturn
(
1
);
when
(
result
.
getColumnLabel
(
1
)).
thenReturn
(
"order_id"
);
when
(
result
.
getColumnName
(
1
)).
thenThrow
(
new
SQLException
());
when
(
result
.
getColumnType
(
1
)).
thenReturn
(
Types
.
INTEGER
);
when
(
result
.
getTableName
(
1
)).
thenReturn
(
"order"
);
return
result
;
}
...
...
@@ -325,7 +322,6 @@ public final class StreamQueryResultTest {
when
(
metaData
.
getColumnCount
()).
thenReturn
(
1
);
when
(
metaData
.
getColumnLabel
(
1
)).
thenReturn
(
"order_id"
);
when
(
metaData
.
getColumnName
(
1
)).
thenReturn
(
"order_id"
);
when
(
metaData
.
getColumnType
(
1
)).
thenReturn
(
Types
.
INTEGER
);
when
(
metaData
.
getTableName
(
1
)).
thenReturn
(
"order"
);
when
(
metaData
.
isCaseSensitive
(
1
)).
thenReturn
(
false
);
return
metaData
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录