Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
21e315da
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,体验更适合开发者的 AI 搜索 >>
提交
21e315da
编写于
7月 31, 2017
作者:
T
terrymanu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fin todo: wasNull for ResultSet
上级
0e1a06c2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
131 addition
and
39 deletion
+131
-39
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/jdbc/core/resultset/ShardingResultSet.java
...e/rdb/sharding/jdbc/core/resultset/ShardingResultSet.java
+131
-39
未找到文件。
sharding-jdbc-core/src/main/java/com/dangdang/ddframe/rdb/sharding/jdbc/core/resultset/ShardingResultSet.java
浏览文件 @
21e315da
...
...
@@ -45,6 +45,8 @@ public final class ShardingResultSet extends AbstractResultSetAdapter {
private
final
ResultSetMerger
mergeResultSet
;
private
boolean
wasNull
;
public
ShardingResultSet
(
final
List
<
ResultSet
>
resultSets
,
final
ResultSetMerger
mergeResultSet
)
{
super
(
resultSets
);
this
.
mergeResultSet
=
mergeResultSet
;
...
...
@@ -58,266 +60,356 @@ public final class ShardingResultSet extends AbstractResultSetAdapter {
@Override
// TODO
public
boolean
wasNull
()
throws
SQLException
{
return
false
;
return
wasNull
;
}
@Override
public
boolean
getBoolean
(
final
int
columnIndex
)
throws
SQLException
{
wasNull
=
false
;
return
(
boolean
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnIndex
,
boolean
.
class
),
boolean
.
class
);
}
@Override
public
boolean
getBoolean
(
final
String
columnLabel
)
throws
SQLException
{
wasNull
=
false
;
return
(
boolean
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnLabel
,
boolean
.
class
),
boolean
.
class
);
}
@Override
public
byte
getByte
(
final
int
columnIndex
)
throws
SQLException
{
wasNull
=
false
;
return
(
byte
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnIndex
,
byte
.
class
),
byte
.
class
);
}
@Override
public
byte
getByte
(
final
String
columnLabel
)
throws
SQLException
{
wasNull
=
false
;
return
(
byte
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnLabel
,
byte
.
class
),
byte
.
class
);
}
@Override
public
short
getShort
(
final
int
columnIndex
)
throws
SQLException
{
wasNull
=
false
;
return
(
short
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnIndex
,
short
.
class
),
short
.
class
);
}
@Override
public
short
getShort
(
final
String
columnLabel
)
throws
SQLException
{
wasNull
=
false
;
return
(
short
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnLabel
,
short
.
class
),
short
.
class
);
}
@Override
public
int
getInt
(
final
int
columnIndex
)
throws
SQLException
{
wasNull
=
false
;
return
(
int
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnIndex
,
int
.
class
),
int
.
class
);
}
@Override
public
int
getInt
(
final
String
columnLabel
)
throws
SQLException
{
wasNull
=
false
;
return
(
int
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnLabel
,
int
.
class
),
int
.
class
);
}
@Override
public
long
getLong
(
final
int
columnIndex
)
throws
SQLException
{
wasNull
=
false
;
return
(
long
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnIndex
,
long
.
class
),
long
.
class
);
}
@Override
public
long
getLong
(
final
String
columnLabel
)
throws
SQLException
{
wasNull
=
false
;
return
(
long
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnLabel
,
long
.
class
),
long
.
class
);
}
@Override
public
float
getFloat
(
final
int
columnIndex
)
throws
SQLException
{
wasNull
=
false
;
return
(
float
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnIndex
,
float
.
class
),
float
.
class
);
}
@Override
public
float
getFloat
(
final
String
columnLabel
)
throws
SQLException
{
wasNull
=
false
;
return
(
float
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnLabel
,
float
.
class
),
float
.
class
);
}
@Override
public
double
getDouble
(
final
int
columnIndex
)
throws
SQLException
{
wasNull
=
false
;
return
(
double
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnIndex
,
double
.
class
),
double
.
class
);
}
@Override
public
double
getDouble
(
final
String
columnLabel
)
throws
SQLException
{
wasNull
=
false
;
return
(
double
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnLabel
,
double
.
class
),
double
.
class
);
}
@Override
public
String
getString
(
final
int
columnIndex
)
throws
SQLException
{
return
(
String
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnIndex
,
String
.
class
),
String
.
class
);
Object
result
=
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnIndex
,
String
.
class
),
String
.
class
);
wasNull
=
null
==
result
;
return
(
String
)
result
;
}
@Override
public
String
getString
(
final
String
columnLabel
)
throws
SQLException
{
return
(
String
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnLabel
,
String
.
class
),
String
.
class
);
Object
result
=
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnLabel
,
String
.
class
),
String
.
class
);
wasNull
=
null
==
result
;
return
(
String
)
result
;
}
@Override
public
BigDecimal
getBigDecimal
(
final
int
columnIndex
)
throws
SQLException
{
return
(
BigDecimal
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnIndex
,
BigDecimal
.
class
),
BigDecimal
.
class
);
Object
result
=
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnIndex
,
BigDecimal
.
class
),
BigDecimal
.
class
);
wasNull
=
null
==
result
;
return
(
BigDecimal
)
result
;
}
@Override
public
BigDecimal
getBigDecimal
(
final
String
columnLabel
)
throws
SQLException
{
return
(
BigDecimal
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnLabel
,
BigDecimal
.
class
),
BigDecimal
.
class
);
Object
result
=
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnLabel
,
BigDecimal
.
class
),
BigDecimal
.
class
);
wasNull
=
null
==
result
;
return
(
BigDecimal
)
result
;
}
@Override
public
BigDecimal
getBigDecimal
(
final
int
columnIndex
,
final
int
scale
)
throws
SQLException
{
return
(
BigDecimal
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnIndex
,
BigDecimal
.
class
),
BigDecimal
.
class
);
Object
result
=
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnIndex
,
BigDecimal
.
class
),
BigDecimal
.
class
);
wasNull
=
null
==
result
;
return
(
BigDecimal
)
result
;
}
@Override
public
BigDecimal
getBigDecimal
(
final
String
columnLabel
,
final
int
scale
)
throws
SQLException
{
return
(
BigDecimal
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnLabel
,
BigDecimal
.
class
),
BigDecimal
.
class
);
Object
result
=
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnLabel
,
BigDecimal
.
class
),
BigDecimal
.
class
);
wasNull
=
null
==
result
;
return
(
BigDecimal
)
result
;
}
@Override
public
byte
[]
getBytes
(
final
int
columnIndex
)
throws
SQLException
{
return
(
byte
[])
mergeResultSet
.
getValue
(
columnIndex
,
byte
[].
class
);
Object
result
=
mergeResultSet
.
getValue
(
columnIndex
,
byte
[].
class
);
wasNull
=
null
==
result
;
return
(
byte
[])
result
;
}
@Override
public
byte
[]
getBytes
(
final
String
columnLabel
)
throws
SQLException
{
return
(
byte
[])
mergeResultSet
.
getValue
(
columnLabel
,
byte
[].
class
);
Object
result
=
mergeResultSet
.
getValue
(
columnLabel
,
byte
[].
class
);
wasNull
=
null
==
result
;
return
(
byte
[])
result
;
}
@Override
public
Date
getDate
(
final
int
columnIndex
)
throws
SQLException
{
return
(
Date
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnIndex
,
Date
.
class
),
Date
.
class
);
Object
result
=
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnIndex
,
Date
.
class
),
Date
.
class
);
wasNull
=
null
==
result
;
return
(
Date
)
result
;
}
@Override
public
Date
getDate
(
final
String
columnLabel
)
throws
SQLException
{
return
(
Date
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnLabel
,
Date
.
class
),
Date
.
class
);
Object
result
=
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnLabel
,
Date
.
class
),
Date
.
class
);
wasNull
=
null
==
result
;
return
(
Date
)
result
;
}
@Override
public
Date
getDate
(
final
int
columnIndex
,
final
Calendar
cal
)
throws
SQLException
{
return
(
Date
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getCalendarValue
(
columnIndex
,
Date
.
class
,
cal
),
Date
.
class
);
Object
result
=
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getCalendarValue
(
columnIndex
,
Date
.
class
,
cal
),
Date
.
class
);
wasNull
=
null
==
result
;
return
(
Date
)
result
;
}
@Override
public
Date
getDate
(
final
String
columnLabel
,
final
Calendar
cal
)
throws
SQLException
{
return
(
Date
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getCalendarValue
(
columnLabel
,
Date
.
class
,
cal
),
Date
.
class
);
Object
result
=
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getCalendarValue
(
columnLabel
,
Date
.
class
,
cal
),
Date
.
class
);
wasNull
=
null
==
result
;
return
(
Date
)
result
;
}
@Override
public
Time
getTime
(
final
int
columnIndex
)
throws
SQLException
{
return
(
Time
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnIndex
,
Time
.
class
),
Time
.
class
);
Object
result
=
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnIndex
,
Time
.
class
),
Time
.
class
);
wasNull
=
null
==
result
;
return
(
Time
)
result
;
}
@Override
public
Time
getTime
(
final
String
columnLabel
)
throws
SQLException
{
return
(
Time
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnLabel
,
Time
.
class
),
Time
.
class
);
Object
result
=
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnLabel
,
Time
.
class
),
Time
.
class
);
wasNull
=
null
==
result
;
return
(
Time
)
result
;
}
@Override
public
Time
getTime
(
final
int
columnIndex
,
final
Calendar
cal
)
throws
SQLException
{
return
(
Time
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getCalendarValue
(
columnIndex
,
Time
.
class
,
cal
),
Time
.
class
);
Object
result
=
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getCalendarValue
(
columnIndex
,
Time
.
class
,
cal
),
Time
.
class
);
wasNull
=
null
==
result
;
return
(
Time
)
result
;
}
@Override
public
Time
getTime
(
final
String
columnLabel
,
final
Calendar
cal
)
throws
SQLException
{
return
(
Time
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getCalendarValue
(
columnLabel
,
Time
.
class
,
cal
),
Time
.
class
);
Object
result
=
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getCalendarValue
(
columnLabel
,
Time
.
class
,
cal
),
Time
.
class
);
wasNull
=
null
==
result
;
return
(
Time
)
result
;
}
@Override
public
Timestamp
getTimestamp
(
final
int
columnIndex
)
throws
SQLException
{
return
(
Timestamp
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnIndex
,
Timestamp
.
class
),
Timestamp
.
class
);
Object
result
=
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnIndex
,
Timestamp
.
class
),
Timestamp
.
class
);
wasNull
=
null
==
result
;
return
(
Timestamp
)
result
;
}
@Override
public
Timestamp
getTimestamp
(
final
String
columnLabel
)
throws
SQLException
{
return
(
Timestamp
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnLabel
,
Timestamp
.
class
),
Timestamp
.
class
);
Object
result
=
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getValue
(
columnLabel
,
Timestamp
.
class
),
Timestamp
.
class
);
wasNull
=
null
==
result
;
return
(
Timestamp
)
result
;
}
@Override
public
Timestamp
getTimestamp
(
final
int
columnIndex
,
final
Calendar
cal
)
throws
SQLException
{
return
(
Timestamp
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getCalendarValue
(
columnIndex
,
Timestamp
.
class
,
cal
),
Timestamp
.
class
);
Object
result
=
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getCalendarValue
(
columnIndex
,
Timestamp
.
class
,
cal
),
Timestamp
.
class
);
wasNull
=
null
==
result
;
return
(
Timestamp
)
result
;
}
@Override
public
Timestamp
getTimestamp
(
final
String
columnLabel
,
final
Calendar
cal
)
throws
SQLException
{
return
(
Timestamp
)
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getCalendarValue
(
columnLabel
,
Timestamp
.
class
,
cal
),
Timestamp
.
class
);
Object
result
=
ResultSetUtil
.
convertValue
(
mergeResultSet
.
getCalendarValue
(
columnLabel
,
Timestamp
.
class
,
cal
),
Timestamp
.
class
);
wasNull
=
null
==
result
;
return
(
Timestamp
)
result
;
}
@Override
public
InputStream
getAsciiStream
(
final
int
columnIndex
)
throws
SQLException
{
return
mergeResultSet
.
getInputStream
(
columnIndex
,
"Ascii"
);
InputStream
result
=
mergeResultSet
.
getInputStream
(
columnIndex
,
"Ascii"
);
wasNull
=
null
==
result
;
return
result
;
}
@Override
public
InputStream
getAsciiStream
(
final
String
columnLabel
)
throws
SQLException
{
return
mergeResultSet
.
getInputStream
(
columnLabel
,
"Ascii"
);
InputStream
result
=
mergeResultSet
.
getInputStream
(
columnLabel
,
"Ascii"
);
wasNull
=
null
==
result
;
return
result
;
}
@Override
public
InputStream
getUnicodeStream
(
final
int
columnIndex
)
throws
SQLException
{
return
mergeResultSet
.
getInputStream
(
columnIndex
,
"Unicode"
);
InputStream
result
=
mergeResultSet
.
getInputStream
(
columnIndex
,
"Unicode"
);
wasNull
=
null
==
result
;
return
result
;
}
@Override
public
InputStream
getUnicodeStream
(
final
String
columnLabel
)
throws
SQLException
{
return
mergeResultSet
.
getInputStream
(
columnLabel
,
"Unicode"
);
InputStream
result
=
mergeResultSet
.
getInputStream
(
columnLabel
,
"Unicode"
);
wasNull
=
null
==
result
;
return
result
;
}
@Override
public
InputStream
getBinaryStream
(
final
int
columnIndex
)
throws
SQLException
{
return
mergeResultSet
.
getInputStream
(
columnIndex
,
"Binary"
);
InputStream
result
=
mergeResultSet
.
getInputStream
(
columnIndex
,
"Binary"
);
wasNull
=
null
==
result
;
return
result
;
}
@Override
public
InputStream
getBinaryStream
(
final
String
columnLabel
)
throws
SQLException
{
return
mergeResultSet
.
getInputStream
(
columnLabel
,
"Binary"
);
InputStream
result
=
mergeResultSet
.
getInputStream
(
columnLabel
,
"Binary"
);
wasNull
=
null
==
result
;
return
result
;
}
@Override
public
Reader
getCharacterStream
(
final
int
columnIndex
)
throws
SQLException
{
return
(
Reader
)
mergeResultSet
.
getValue
(
columnIndex
,
Reader
.
class
);
Object
result
=
mergeResultSet
.
getValue
(
columnIndex
,
Reader
.
class
);
wasNull
=
null
==
result
;
return
(
Reader
)
result
;
}
@Override
public
Reader
getCharacterStream
(
final
String
columnLabel
)
throws
SQLException
{
return
(
Reader
)
mergeResultSet
.
getValue
(
columnLabel
,
Reader
.
class
);
Object
result
=
mergeResultSet
.
getValue
(
columnLabel
,
Reader
.
class
);
wasNull
=
null
==
result
;
return
(
Reader
)
result
;
}
@Override
public
Blob
getBlob
(
final
int
columnIndex
)
throws
SQLException
{
return
(
Blob
)
mergeResultSet
.
getValue
(
columnIndex
,
Blob
.
class
);
Object
result
=
mergeResultSet
.
getValue
(
columnIndex
,
Blob
.
class
);
wasNull
=
null
==
result
;
return
(
Blob
)
result
;
}
@Override
public
Blob
getBlob
(
final
String
columnLabel
)
throws
SQLException
{
return
(
Blob
)
mergeResultSet
.
getValue
(
columnLabel
,
Blob
.
class
);
Object
result
=
mergeResultSet
.
getValue
(
columnLabel
,
Blob
.
class
);
wasNull
=
null
==
result
;
return
(
Blob
)
result
;
}
@Override
public
Clob
getClob
(
final
int
columnIndex
)
throws
SQLException
{
return
(
Clob
)
mergeResultSet
.
getValue
(
columnIndex
,
Clob
.
class
);
Object
result
=
mergeResultSet
.
getValue
(
columnIndex
,
Clob
.
class
);
wasNull
=
null
==
result
;
return
(
Clob
)
result
;
}
@Override
public
Clob
getClob
(
final
String
columnLabel
)
throws
SQLException
{
return
(
Clob
)
mergeResultSet
.
getValue
(
columnLabel
,
Clob
.
class
);
Object
result
=
mergeResultSet
.
getValue
(
columnLabel
,
Clob
.
class
);
wasNull
=
null
==
result
;
return
(
Clob
)
result
;
}
@Override
public
URL
getURL
(
final
int
columnIndex
)
throws
SQLException
{
return
(
URL
)
mergeResultSet
.
getValue
(
columnIndex
,
URL
.
class
);
Object
result
=
mergeResultSet
.
getValue
(
columnIndex
,
URL
.
class
);
wasNull
=
null
==
result
;
return
(
URL
)
result
;
}
@Override
public
URL
getURL
(
final
String
columnLabel
)
throws
SQLException
{
return
(
URL
)
mergeResultSet
.
getValue
(
columnLabel
,
URL
.
class
);
Object
result
=
mergeResultSet
.
getValue
(
columnLabel
,
URL
.
class
);
wasNull
=
null
==
result
;
return
(
URL
)
result
;
}
@Override
public
SQLXML
getSQLXML
(
final
int
columnIndex
)
throws
SQLException
{
return
(
SQLXML
)
mergeResultSet
.
getValue
(
columnIndex
,
SQLXML
.
class
);
Object
result
=
mergeResultSet
.
getValue
(
columnIndex
,
SQLXML
.
class
);
wasNull
=
null
==
result
;
return
(
SQLXML
)
result
;
}
@Override
public
SQLXML
getSQLXML
(
final
String
columnLabel
)
throws
SQLException
{
return
(
SQLXML
)
mergeResultSet
.
getValue
(
columnLabel
,
SQLXML
.
class
);
Object
result
=
mergeResultSet
.
getValue
(
columnLabel
,
SQLXML
.
class
);
wasNull
=
null
==
result
;
return
(
SQLXML
)
result
;
}
@Override
public
Object
getObject
(
final
int
columnIndex
)
throws
SQLException
{
return
mergeResultSet
.
getValue
(
columnIndex
,
Object
.
class
);
Object
result
=
mergeResultSet
.
getValue
(
columnIndex
,
Object
.
class
);
wasNull
=
null
==
result
;
return
result
;
}
@Override
public
Object
getObject
(
final
String
columnLabel
)
throws
SQLException
{
return
mergeResultSet
.
getValue
(
columnLabel
,
Object
.
class
);
Object
result
=
mergeResultSet
.
getValue
(
columnLabel
,
Object
.
class
);
wasNull
=
null
==
result
;
return
result
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录