Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
06879c2d
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
06879c2d
编写于
1月 19, 2013
作者:
L
lancea
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8006139: add missing methods to javax.sql.rowset.serial.SQLInputImpl, SQLOutputImpl
Reviewed-by: naoto, ulfzibis, alanb
上级
94082ec6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
66 addition
and
222 deletion
+66
-222
src/share/classes/javax/sql/rowset/serial/SQLInputImpl.java
src/share/classes/javax/sql/rowset/serial/SQLInputImpl.java
+57
-213
src/share/classes/javax/sql/rowset/serial/SQLOutputImpl.java
src/share/classes/javax/sql/rowset/serial/SQLOutputImpl.java
+9
-9
未找到文件。
src/share/classes/javax/sql/rowset/serial/SQLInputImpl.java
浏览文件 @
06879c2d
/*
* Copyright (c) 2003, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -55,6 +55,7 @@ import java.util.Map;
* stream to the method <code>SQLData.readSQL</code>, which in turn
* calls the <code>SQLInputImpl</code> reader methods
* to read the attributes from the input stream.
* @since 1.5
* @see java.sql.SQLData
*/
public
class
SQLInputImpl
implements
SQLInput
{
...
...
@@ -142,6 +143,7 @@ public class SQLInputImpl implements SQLInput {
throw
new
SQLException
(
"SQLInputImpl exception: Invalid read "
+
"position"
);
}
else
{
lastValueWasNull
=
attrib
[
idx
]
==
null
;
return
attrib
[
idx
];
}
}
...
...
@@ -168,16 +170,7 @@ public class SQLInputImpl implements SQLInput {
* position or if there are no further values in the stream.
*/
public
String
readString
()
throws
SQLException
{
String
attrib
=
(
String
)
getNextAttribute
();
if
(
attrib
==
null
)
{
lastValueWasNull
=
true
;
return
null
;
}
else
{
lastValueWasNull
=
false
;
return
attrib
;
}
return
(
String
)
getNextAttribute
();
}
/**
...
...
@@ -195,16 +188,8 @@ public class SQLInputImpl implements SQLInput {
* position or if there are no further values in the stream.
*/
public
boolean
readBoolean
()
throws
SQLException
{
Boolean
attrib
=
(
Boolean
)
getNextAttribute
();
if
(
attrib
==
null
)
{
lastValueWasNull
=
true
;
return
false
;
}
else
{
lastValueWasNull
=
false
;
return
attrib
.
booleanValue
();
}
return
(
attrib
==
null
)
?
false
:
attrib
.
booleanValue
();
}
/**
...
...
@@ -223,14 +208,7 @@ public class SQLInputImpl implements SQLInput {
*/
public
byte
readByte
()
throws
SQLException
{
Byte
attrib
=
(
Byte
)
getNextAttribute
();
if
(
attrib
==
null
)
{
lastValueWasNull
=
true
;
return
(
byte
)
0
;
}
else
{
lastValueWasNull
=
false
;
return
attrib
.
byteValue
();
}
return
(
attrib
==
null
)
?
0
:
attrib
.
byteValue
();
}
/**
...
...
@@ -248,14 +226,7 @@ public class SQLInputImpl implements SQLInput {
*/
public
short
readShort
()
throws
SQLException
{
Short
attrib
=
(
Short
)
getNextAttribute
();
if
(
attrib
==
null
)
{
lastValueWasNull
=
true
;
return
(
short
)
0
;
}
else
{
lastValueWasNull
=
false
;
return
attrib
.
shortValue
();
}
return
(
attrib
==
null
)
?
0
:
attrib
.
shortValue
();
}
/**
...
...
@@ -273,14 +244,7 @@ public class SQLInputImpl implements SQLInput {
*/
public
int
readInt
()
throws
SQLException
{
Integer
attrib
=
(
Integer
)
getNextAttribute
();
if
(
attrib
==
null
)
{
lastValueWasNull
=
true
;
return
0
;
}
else
{
lastValueWasNull
=
false
;
return
attrib
.
intValue
();
}
return
(
attrib
==
null
)
?
0
:
attrib
.
intValue
();
}
/**
...
...
@@ -298,14 +262,7 @@ public class SQLInputImpl implements SQLInput {
*/
public
long
readLong
()
throws
SQLException
{
Long
attrib
=
(
Long
)
getNextAttribute
();
if
(
attrib
==
null
)
{
lastValueWasNull
=
true
;
return
(
long
)
0
;
}
else
{
lastValueWasNull
=
false
;
return
attrib
.
longValue
();
}
return
(
attrib
==
null
)
?
0
:
attrib
.
longValue
();
}
/**
...
...
@@ -323,14 +280,7 @@ public class SQLInputImpl implements SQLInput {
*/
public
float
readFloat
()
throws
SQLException
{
Float
attrib
=
(
Float
)
getNextAttribute
();
if
(
attrib
==
null
)
{
lastValueWasNull
=
true
;
return
(
float
)
0
;
}
else
{
lastValueWasNull
=
false
;
return
attrib
.
floatValue
();
}
return
(
attrib
==
null
)
?
0
:
attrib
.
floatValue
();
}
/**
...
...
@@ -348,14 +298,7 @@ public class SQLInputImpl implements SQLInput {
*/
public
double
readDouble
()
throws
SQLException
{
Double
attrib
=
(
Double
)
getNextAttribute
();
if
(
attrib
==
null
)
{
lastValueWasNull
=
true
;
return
(
double
)
0
;
}
else
{
lastValueWasNull
=
false
;
return
attrib
.
doubleValue
();
}
return
(
attrib
==
null
)
?
0
:
attrib
.
doubleValue
();
}
/**
...
...
@@ -372,15 +315,7 @@ public class SQLInputImpl implements SQLInput {
* position or if there are no more values in the stream
*/
public
java
.
math
.
BigDecimal
readBigDecimal
()
throws
SQLException
{
java
.
math
.
BigDecimal
attrib
=
(
java
.
math
.
BigDecimal
)
getNextAttribute
();
if
(
attrib
==
null
)
{
lastValueWasNull
=
true
;
return
null
;
}
else
{
lastValueWasNull
=
false
;
return
attrib
;
}
return
(
java
.
math
.
BigDecimal
)
getNextAttribute
();
}
/**
...
...
@@ -397,15 +332,7 @@ public class SQLInputImpl implements SQLInput {
* position or if there are no more values in the stream
*/
public
byte
[]
readBytes
()
throws
SQLException
{
byte
[]
attrib
=
(
byte
[])
getNextAttribute
();
if
(
attrib
==
null
)
{
lastValueWasNull
=
true
;
return
null
;
}
else
{
lastValueWasNull
=
false
;
return
attrib
;
}
return
(
byte
[])
getNextAttribute
();
}
/**
...
...
@@ -422,15 +349,7 @@ public class SQLInputImpl implements SQLInput {
* position or if there are no more values in the stream
*/
public
java
.
sql
.
Date
readDate
()
throws
SQLException
{
java
.
sql
.
Date
attrib
=
(
java
.
sql
.
Date
)
getNextAttribute
();
if
(
attrib
==
null
)
{
lastValueWasNull
=
true
;
return
null
;
}
else
{
lastValueWasNull
=
false
;
return
attrib
;
}
return
(
java
.
sql
.
Date
)
getNextAttribute
();
}
/**
...
...
@@ -448,15 +367,7 @@ public class SQLInputImpl implements SQLInput {
* position; or if there are no further values in the stream.
*/
public
java
.
sql
.
Time
readTime
()
throws
SQLException
{
java
.
sql
.
Time
attrib
=
(
java
.
sql
.
Time
)
getNextAttribute
();
if
(
attrib
==
null
)
{
lastValueWasNull
=
true
;
return
null
;
}
else
{
lastValueWasNull
=
false
;
return
attrib
;
}
return
(
java
.
sql
.
Time
)
getNextAttribute
();
}
/**
...
...
@@ -469,15 +380,7 @@ public class SQLInputImpl implements SQLInput {
* position; or if there are no further values in the stream.
*/
public
java
.
sql
.
Timestamp
readTimestamp
()
throws
SQLException
{
java
.
sql
.
Timestamp
attrib
=
(
java
.
sql
.
Timestamp
)
getNextAttribute
();
if
(
attrib
==
null
)
{
lastValueWasNull
=
true
;
return
null
;
}
else
{
lastValueWasNull
=
false
;
return
attrib
;
}
return
(
java
.
sql
.
Timestamp
)
getNextAttribute
();
}
/**
...
...
@@ -494,15 +397,7 @@ public class SQLInputImpl implements SQLInput {
* position; or if there are no further values in the stream.
*/
public
java
.
io
.
Reader
readCharacterStream
()
throws
SQLException
{
java
.
io
.
Reader
attrib
=
(
java
.
io
.
Reader
)
getNextAttribute
();
if
(
attrib
==
null
)
{
lastValueWasNull
=
true
;
return
null
;
}
else
{
lastValueWasNull
=
false
;
return
attrib
;
}
return
(
java
.
io
.
Reader
)
getNextAttribute
();
}
/**
...
...
@@ -520,15 +415,7 @@ public class SQLInputImpl implements SQLInput {
* position; or if there are no further values in the stream.
*/
public
java
.
io
.
InputStream
readAsciiStream
()
throws
SQLException
{
java
.
io
.
InputStream
attrib
=
(
java
.
io
.
InputStream
)
getNextAttribute
();
if
(
attrib
==
null
)
{
lastValueWasNull
=
true
;
return
null
;
}
else
{
lastValueWasNull
=
false
;
return
attrib
;
}
return
(
java
.
io
.
InputStream
)
getNextAttribute
();
}
/**
...
...
@@ -546,15 +433,7 @@ public class SQLInputImpl implements SQLInput {
* position; or if there are no further values in the stream.
*/
public
java
.
io
.
InputStream
readBinaryStream
()
throws
SQLException
{
java
.
io
.
InputStream
attrib
=
(
java
.
io
.
InputStream
)
getNextAttribute
();
if
(
attrib
==
null
)
{
lastValueWasNull
=
true
;
return
null
;
}
else
{
lastValueWasNull
=
false
;
return
attrib
;
}
return
(
java
.
io
.
InputStream
)
getNextAttribute
();
}
//================================================================
...
...
@@ -589,39 +468,32 @@ public class SQLInputImpl implements SQLInput {
*/
public
Object
readObject
()
throws
SQLException
{
Object
attrib
=
getNextAttribute
();
if
(
attrib
==
null
)
{
lastValueWasNull
=
true
;
return
null
;
}
else
{
lastValueWasNull
=
false
;
if
(
attrib
instanceof
Struct
)
{
Struct
s
=
(
Struct
)
attrib
;
// look up the class in the map
Class
<?>
c
=
map
.
get
(
s
.
getSQLTypeName
());
if
(
c
!=
null
)
{
// create new instance of the class
SQLData
obj
=
null
;
try
{
obj
=
(
SQLData
)
c
.
newInstance
();
}
catch
(
java
.
lang
.
InstantiationException
ex
)
{
throw
new
SQLException
(
"Unable to instantiate: "
+
ex
.
getMessage
());
}
catch
(
java
.
lang
.
IllegalAccessException
ex
)
{
throw
new
SQLException
(
"Unable to instantiate: "
+
ex
.
getMessage
());
}
// get the attributes from the struct
Object
attribs
[]
=
s
.
getAttributes
(
map
);
// create the SQLInput "stream"
SQLInputImpl
sqlInput
=
new
SQLInputImpl
(
attribs
,
map
);
// read the values...
obj
.
readSQL
(
sqlInput
,
s
.
getSQLTypeName
());
return
obj
;
if
(
attrib
instanceof
Struct
)
{
Struct
s
=
(
Struct
)
attrib
;
// look up the class in the map
Class
<?>
c
=
map
.
get
(
s
.
getSQLTypeName
());
if
(
c
!=
null
)
{
// create new instance of the class
SQLData
obj
=
null
;
try
{
obj
=
(
SQLData
)
c
.
newInstance
();
}
catch
(
java
.
lang
.
InstantiationException
ex
)
{
throw
new
SQLException
(
"Unable to instantiate: "
+
ex
.
getMessage
());
}
catch
(
java
.
lang
.
IllegalAccessException
ex
)
{
throw
new
SQLException
(
"Unable to instantiate: "
+
ex
.
getMessage
());
}
// get the attributes from the struct
Object
attribs
[]
=
s
.
getAttributes
(
map
);
// create the SQLInput "stream"
SQLInputImpl
sqlInput
=
new
SQLInputImpl
(
attribs
,
map
);
// read the values...
obj
.
readSQL
(
sqlInput
,
s
.
getSQLTypeName
());
return
obj
;
}
return
attrib
;
}
return
attrib
;
}
/**
...
...
@@ -635,15 +507,7 @@ public class SQLInputImpl implements SQLInput {
* position; or if there are no further values in the stream.
*/
public
Ref
readRef
()
throws
SQLException
{
Ref
attrib
=
(
Ref
)
getNextAttribute
();
if
(
attrib
==
null
)
{
lastValueWasNull
=
true
;
return
null
;
}
else
{
lastValueWasNull
=
false
;
return
attrib
;
}
return
(
Ref
)
getNextAttribute
();
}
/**
...
...
@@ -664,15 +528,7 @@ public class SQLInputImpl implements SQLInput {
* position; or if there are no further values in the stream.
*/
public
Blob
readBlob
()
throws
SQLException
{
Blob
attrib
=
(
Blob
)
getNextAttribute
();
if
(
attrib
==
null
)
{
lastValueWasNull
=
true
;
return
null
;
}
else
{
lastValueWasNull
=
false
;
return
attrib
;
}
return
(
Blob
)
getNextAttribute
();
}
/**
...
...
@@ -693,15 +549,7 @@ public class SQLInputImpl implements SQLInput {
* position; or if there are no further values in the stream.
*/
public
Clob
readClob
()
throws
SQLException
{
Clob
attrib
=
(
Clob
)
getNextAttribute
();
if
(
attrib
==
null
)
{
lastValueWasNull
=
true
;
return
null
;
}
else
{
lastValueWasNull
=
false
;
return
attrib
;
}
return
(
Clob
)
getNextAttribute
();
}
/**
...
...
@@ -723,15 +571,7 @@ public class SQLInputImpl implements SQLInput {
*/
public
Array
readArray
()
throws
SQLException
{
Array
attrib
=
(
Array
)
getNextAttribute
();
if
(
attrib
==
null
)
{
lastValueWasNull
=
true
;
return
null
;
}
else
{
lastValueWasNull
=
false
;
return
attrib
;
}
return
(
Array
)
getNextAttribute
();
}
/**
...
...
@@ -766,7 +606,7 @@ public class SQLInputImpl implements SQLInput {
* position; or if there are no further values in the stream.
*/
public
java
.
net
.
URL
readURL
()
throws
SQLException
{
throw
new
SQLException
(
"Operation not supported"
);
return
(
java
.
net
.
URL
)
getNextAttribute
(
);
}
//---------------------------- JDBC 4.0 -------------------------
...
...
@@ -779,10 +619,11 @@ public class SQLInputImpl implements SQLInput {
* at the head of the stream; <code>null</code> if the value read is
* SQL <code>NULL</code>
* @exception SQLException if a database access error occurs
* @since 1.6
*/
public
NClob
readNClob
()
throws
SQLException
{
throw
new
UnsupportedOperationException
(
"Operation not supported"
);
}
return
(
NClob
)
getNextAttribute
(
);
}
/**
* Reads the next attribute in the stream and returns it as a <code>String</code>
...
...
@@ -792,9 +633,10 @@ public class SQLInputImpl implements SQLInput {
*
* @return the attribute; if the value is SQL <code>NULL</code>, returns <code>null</code>
* @exception SQLException if a database access error occurs
* @since 1.6
*/
public
String
readNString
()
throws
SQLException
{
throw
new
UnsupportedOperationException
(
"Operation not supported"
);
return
(
String
)
getNextAttribute
(
);
}
/**
...
...
@@ -805,12 +647,13 @@ public class SQLInputImpl implements SQLInput {
* at the head of the stream; <code>null</code> if the value read is
* SQL <code>NULL</code>
* @exception SQLException if a database access error occurs
* @since 1.6
*/
public
SQLXML
readSQLXML
()
throws
SQLException
{
throw
new
UnsupportedOperationException
(
"Operation not supported"
);
return
(
SQLXML
)
getNextAttribute
(
);
}
/**
/**
* Reads an SQL <code>ROWID</code> value from the stream and returns it as a
* <code>RowId</code> object in the Java programming language.
*
...
...
@@ -818,9 +661,10 @@ public class SQLInputImpl implements SQLInput {
* at the head of the stream; <code>null</code> if the value read is
* SQL <code>NULL</code>
* @exception SQLException if a database access error occurs
* @since 1.6
*/
public
RowId
readRowId
()
throws
SQLException
{
throw
new
UnsupportedOperationException
(
"Operation not supported"
);
return
(
RowId
)
getNextAttribute
(
);
}
...
...
src/share/classes/javax/sql/rowset/serial/SQLOutputImpl.java
浏览文件 @
06879c2d
/*
* Copyright (c) 2003, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -579,7 +579,7 @@ public class SQLOutputImpl implements SQLOutput {
}
/**
/**
* Writes the next attribute to the stream as a <code>String</code>
* in the Java programming language. The driver converts this to a
* SQL <code>NCHAR</code> or
...
...
@@ -594,8 +594,8 @@ public class SQLOutputImpl implements SQLOutput {
*/
@SuppressWarnings
(
"unchecked"
)
public
void
writeNString
(
String
x
)
throws
SQLException
{
throw
new
UnsupportedOperationException
(
"Operation not supported"
);
}
attribs
.
add
(
x
);
}
/**
* Writes an SQL <code>NCLOB</code> value to the stream.
...
...
@@ -608,8 +608,8 @@ public class SQLOutputImpl implements SQLOutput {
*/
@SuppressWarnings
(
"unchecked"
)
public
void
writeNClob
(
NClob
x
)
throws
SQLException
{
throw
new
UnsupportedOperationException
(
"Operation not supported"
);
}
attribs
.
add
(
x
);
}
/**
...
...
@@ -623,8 +623,8 @@ public class SQLOutputImpl implements SQLOutput {
*/
@SuppressWarnings
(
"unchecked"
)
public
void
writeRowId
(
RowId
x
)
throws
SQLException
{
throw
new
UnsupportedOperationException
(
"Operation not supported"
);
}
attribs
.
add
(
x
);
}
/**
...
...
@@ -638,7 +638,7 @@ public class SQLOutputImpl implements SQLOutput {
*/
@SuppressWarnings
(
"unchecked"
)
public
void
writeSQLXML
(
SQLXML
x
)
throws
SQLException
{
throw
new
UnsupportedOperationException
(
"Operation not supported"
);
attribs
.
add
(
x
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录