Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
5c69455f
提交
5c69455f
authored
10月 21, 2010
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Various CallableStatement methods could throw a NullPointerException.
上级
52f3bd34
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
1122 行增加
和
253 行删除
+1122
-253
changelog.html
h2/src/docsrc/html/changelog.html
+5
-1
JdbcCallableStatement.java
h2/src/main/org/h2/jdbc/JdbcCallableStatement.java
+1075
-233
JdbcPreparedStatement.java
h2/src/main/org/h2/jdbc/JdbcPreparedStatement.java
+5
-3
JdbcResultSet.java
h2/src/main/org/h2/jdbc/JdbcResultSet.java
+19
-16
TestCallableStatement.java
h2/src/test/org/h2/test/jdbc/TestCallableStatement.java
+18
-0
没有找到文件。
h2/src/docsrc/html/changelog.html
浏览文件 @
5c69455f
...
@@ -18,8 +18,12 @@ Change Log
...
@@ -18,8 +18,12 @@ Change Log
<h1>
Change Log
</h1>
<h1>
Change Log
</h1>
<h2>
Next Version (unreleased)
</h2>
<h2>
Next Version (unreleased)
</h2>
<ul><li>
LOB files were not deleted when running DROP ALL OBJECTS.
<ul><li>
Various CallableStatement methods could throw a NullPointerException.
</li><li>
LOB files were not deleted when running DROP ALL OBJECTS.
</li><li>
MS SQL Server compatibility: support string literals prefixed with N ("National Language" strings). Issue 240.
</li><li>
MS SQL Server compatibility: support string literals prefixed with N ("National Language" strings). Issue 240.
</li><li>
CAST: when converting a string to binary, it is hex encoded (every byte two characters);
a hex string can be converted to a number by first converting it to binary. Examples:
CAST(CAST('FFFF' AS BINARY) AS INT) = 65535, CAST(65535 AS BINARY) = '0000FFFF'.
</li><li>
When a domain (user defined data type) contained a user defined function, the database could not be opened.
</li><li>
When a domain (user defined data type) contained a user defined function, the database could not be opened.
</li><li>
CAST('011' AS INT) will no longer use decode the value as an octal number (using Integer.decode) but now use Integer.parseInt.
</li><li>
CAST('011' AS INT) will no longer use decode the value as an octal number (using Integer.decode) but now use Integer.parseInt.
The same logic applied to byte, short, and long. This also means that trying to convert hex numbers (0x...) with CAST now fails.
The same logic applied to byte, short, and long. This also means that trying to convert hex numbers (0x...) with CAST now fails.
...
...
h2/src/main/org/h2/jdbc/JdbcCallableStatement.java
浏览文件 @
5c69455f
...
@@ -28,10 +28,12 @@ import java.sql.Timestamp;
...
@@ -28,10 +28,12 @@ import java.sql.Timestamp;
import
java.util.Calendar
;
import
java.util.Calendar
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
org.h2.constant.ErrorCode
;
import
org.h2.expression.ParameterInterface
;
import
org.h2.expression.ParameterInterface
;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.message.TraceObject
;
import
org.h2.message.TraceObject
;
import
org.h2.util.BitField
;
import
org.h2.util.BitField
;
import
org.h2.util.New
;
import
org.h2.value.ValueNull
;
import
org.h2.value.ValueNull
;
/**
/**
...
@@ -44,7 +46,7 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
...
@@ -44,7 +46,7 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
private
BitField
outParameters
;
private
BitField
outParameters
;
private
int
maxOutParameters
;
private
int
maxOutParameters
;
private
Map
<
String
,
Integer
>
namedParameters
;
private
Hash
Map
<
String
,
Integer
>
namedParameters
;
JdbcCallableStatement
(
JdbcConnection
conn
,
String
sql
,
int
id
,
int
resultSetType
,
int
resultSetConcurrency
)
{
JdbcCallableStatement
(
JdbcConnection
conn
,
String
sql
,
int
id
,
int
resultSetType
,
int
resultSetConcurrency
)
{
super
(
conn
,
sql
,
id
,
resultSetType
,
resultSetConcurrency
,
false
);
super
(
conn
,
sql
,
id
,
resultSetType
,
resultSetConcurrency
,
false
);
...
@@ -68,455 +70,1129 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
...
@@ -68,455 +70,1129 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
* @throws SQLException if this object is closed or invalid
* @throws SQLException if this object is closed or invalid
*/
*/
public
int
executeUpdate
()
throws
SQLException
{
public
int
executeUpdate
()
throws
SQLException
{
try
{
checkClosed
();
if
(
command
.
isQuery
())
{
if
(
command
.
isQuery
())
{
super
.
executeQuery
().
next
();
super
.
executeQuery
().
next
();
return
0
;
return
0
;
}
}
return
super
.
executeUpdate
();
return
super
.
executeUpdate
();
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
}
}
public
void
registerOutParameter
(
int
parameterIndex
,
int
sqlType
)
throws
SQLException
{
registerOutParameter
(
parameterIndex
,
sqlType
,
0
);
}
}
public
void
registerOutParameter
(
int
parameterIndex
,
int
sqlType
,
int
scale
)
throws
SQLException
{
/**
registerOutParameter
(
parameterIndex
,
sqlType
,
scale
,
null
);
* Registers the given OUT parameter.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param sqlType the data type (Types.x) - ignored
*/
public
void
registerOutParameter
(
int
parameterIndex
,
int
sqlType
)
throws
SQLException
{
registerOutParameter
(
parameterIndex
);
}
}
private
ResultSetMetaData
getCheckedMetaData
()
throws
SQLException
{
/**
ResultSetMetaData
meta
=
getMetaData
();
* Registers the given OUT parameter.
if
(
meta
==
null
)
{
*
throw
DbException
.
getUnsupportedException
(
"Supported only for stored procedures calling."
);
* @param parameterIndex the parameter index (1, 2, ...)
}
* @param sqlType the data type (Types.x) - ignored
return
meta
;
* @param typeName the SQL type name - ignored
*/
public
void
registerOutParameter
(
int
parameterIndex
,
int
sqlType
,
String
typeName
)
throws
SQLException
{
registerOutParameter
(
parameterIndex
);
}
}
private
void
checkIndexBounds
(
int
parameterIndex
)
throws
SQLException
{
/**
if
(
parameterIndex
<
1
||
parameterIndex
>
maxOutParameters
)
{
* Registers the given OUT parameter.
throw
DbException
.
getInvalidValueException
(
Integer
.
toString
(
parameterIndex
),
"parameterIndex"
);
*
}
* @param parameterIndex the parameter index (1, 2, ...)
* @param sqlType the data type (Types.x)
* @param scale is ignored
*/
public
void
registerOutParameter
(
int
parameterIndex
,
int
sqlType
,
int
scale
)
throws
SQLException
{
registerOutParameter
(
parameterIndex
);
}
}
private
void
registerOutParameter
(
int
parameterIndex
,
int
sqlType
,
int
scale
,
String
typeName
)
throws
SQLException
{
/**
try
{
* Registers the given OUT parameter.
if
(
outParameters
==
null
)
{
*
maxOutParameters
=
Math
.
min
(
getParameterMetaData
().
getParameterCount
(),
getCheckedMetaData
()
* @param parameterName the parameter name
.
getColumnCount
());
* @param sqlType the data type (Types.x) - ignored
outParameters
=
new
BitField
();
* @param typeName the SQL type name - ignored
}
*/
checkIndexBounds
(
parameterIndex
);
public
void
registerOutParameter
(
String
parameterName
,
int
sqlType
,
String
typeName
)
throws
SQLException
{
ParameterInterface
param
=
command
.
getParameters
().
get
(--
parameterIndex
);
registerOutParameter
(
getIndexForName
(
parameterName
),
sqlType
,
typeName
);
if
(
param
.
getParamValue
()
==
null
)
{
param
.
setValue
(
ValueNull
.
INSTANCE
,
false
);
}
outParameters
.
set
(
parameterIndex
);
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
}
}
}
private
void
checkRegistered
(
int
parameterIndex
)
throws
SQLException
{
/**
try
{
* Registers the given OUT parameter.
checkIndexBounds
(
parameterIndex
);
*
if
(!
outParameters
.
get
(
parameterIndex
-
1
))
{
* @param parameterName the parameter name
throw
DbException
.
getInvalidValueException
(
Integer
.
toString
(
parameterIndex
),
"parameterIndex"
);
* @param sqlType the data type (Types.x) - ignored
}
* @param scale is ignored
}
catch
(
Exception
e
)
{
*/
throw
logAndConvert
(
e
);
public
void
registerOutParameter
(
String
parameterName
,
int
sqlType
,
int
scale
)
throws
SQLException
{
}
registerOutParameter
(
getIndexForName
(
parameterName
),
sqlType
,
scale
);
}
}
private
int
getIndexForName
(
String
parameterName
)
throws
SQLException
{
/**
try
{
* Registers the given OUT parameter.
if
(
namedParameters
==
null
)
{
*
ResultSetMetaData
meta
=
getCheckedMetaData
();
* @param parameterName the parameter name
int
columnCount
=
meta
.
getColumnCount
();
* @param sqlType the data type (Types.x) - ignored
Map
<
String
,
Integer
>
map
=
new
HashMap
<
String
,
Integer
>(
columnCount
);
*/
for
(
int
i
=
1
;
i
<=
columnCount
;
i
++)
{
public
void
registerOutParameter
(
String
parameterName
,
int
sqlType
)
throws
SQLException
{
map
.
put
(
meta
.
getColumnLabel
(
i
),
i
);
registerOutParameter
(
getIndexForName
(
parameterName
),
sqlType
);
}
namedParameters
=
map
;
}
Integer
index
=
namedParameters
.
get
(
parameterName
);
if
(
index
==
null
)
{
throw
DbException
.
getInvalidValueException
(
parameterName
,
"parameterName"
);
}
return
index
;
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
}
}
}
/**
* Returns whether the last column accessed was null.
*
* @return true if the last column accessed was null
*/
public
boolean
wasNull
()
throws
SQLException
{
public
boolean
wasNull
()
throws
SQLException
{
if
(
resultSet
==
null
)
{
return
getOpenResultSet
().
wasNull
();
throw
logAndConvert
(
DbException
.
getUnsupportedException
(
"Method wasNull() should be called only after statement execution and calling a getter method."
));
}
return
resultSet
.
wasNull
();
}
}
/**
* [Not supported]
*/
public
URL
getURL
(
int
parameterIndex
)
throws
SQLException
{
public
URL
getURL
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
throw
unsupported
(
"url"
);
return
resultSet
.
getURL
(
parameterIndex
);
}
}
/**
* Returns the value of the specified column as a String.
*
* @param parameterIndex (1,2,...)
* @return the value
* @throws SQLException if the column is not found or if the result set is closed
*/
public
String
getString
(
int
parameterIndex
)
throws
SQLException
{
public
String
getString
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
checkRegistered
(
parameterIndex
);
return
resultSet
.
getString
(
parameterIndex
);
return
getOpenResultSet
()
.
getString
(
parameterIndex
);
}
}
/**
* Returns the value of the specified column as a boolean.
*
* @param parameterIndex (1,2,...)
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
boolean
getBoolean
(
int
parameterIndex
)
throws
SQLException
{
public
boolean
getBoolean
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
checkRegistered
(
parameterIndex
);
return
resultSet
.
getBoolean
(
parameterIndex
);
return
getOpenResultSet
()
.
getBoolean
(
parameterIndex
);
}
}
/**
* Returns the value of the specified column as a byte.
*
* @param parameterIndex (1,2,...)
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
byte
getByte
(
int
parameterIndex
)
throws
SQLException
{
public
byte
getByte
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
checkRegistered
(
parameterIndex
);
return
resultSet
.
getByte
(
parameterIndex
);
return
getOpenResultSet
()
.
getByte
(
parameterIndex
);
}
}
/**
* Returns the value of the specified column as a short.
*
* @param parameterIndex (1,2,...)
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
short
getShort
(
int
parameterIndex
)
throws
SQLException
{
public
short
getShort
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
checkRegistered
(
parameterIndex
);
return
resultSet
.
getShort
(
parameterIndex
);
return
getOpenResultSet
()
.
getShort
(
parameterIndex
);
}
}
/**
* Returns the value of the specified column as an int.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @return the value
* @throws SQLException if the column is not found or if the result set is closed
*/
public
int
getInt
(
int
parameterIndex
)
throws
SQLException
{
public
int
getInt
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
checkRegistered
(
parameterIndex
);
return
resultSet
.
getInt
(
parameterIndex
);
return
getOpenResultSet
()
.
getInt
(
parameterIndex
);
}
}
/**
* Returns the value of the specified column as a long.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
long
getLong
(
int
parameterIndex
)
throws
SQLException
{
public
long
getLong
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
checkRegistered
(
parameterIndex
);
return
resultSet
.
getLong
(
parameterIndex
);
return
getOpenResultSet
()
.
getLong
(
parameterIndex
);
}
}
/**
* Returns the value of the specified column as a float.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
float
getFloat
(
int
parameterIndex
)
throws
SQLException
{
public
float
getFloat
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
checkRegistered
(
parameterIndex
);
return
resultSet
.
getFloat
(
parameterIndex
);
return
getOpenResultSet
()
.
getFloat
(
parameterIndex
);
}
}
/**
* Returns the value of the specified column as a double.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
double
getDouble
(
int
parameterIndex
)
throws
SQLException
{
public
double
getDouble
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
checkRegistered
(
parameterIndex
);
return
resultSet
.
getDouble
(
parameterIndex
);
return
getOpenResultSet
()
.
getDouble
(
parameterIndex
);
}
}
/**
/**
* @see java.sql.CallableStatement#getBigDecimal(int, int)
* Returns the value of the specified column as a BigDecimal.
* @deprecated use <code>getBigDecimal(int parameterIndex)</code>
*
* or <code>getBigDecimal(String parameterName)</code>
* @deprecated
*
* @param parameterIndex the parameter index (1, 2, ...)
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
*/
public
BigDecimal
getBigDecimal
(
int
parameterIndex
,
int
scale
)
throws
SQLException
{
public
BigDecimal
getBigDecimal
(
int
parameterIndex
,
int
scale
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
checkRegistered
(
parameterIndex
);
return
resultSet
.
getBigDecimal
(
parameterIndex
,
scale
);
return
getOpenResultSet
()
.
getBigDecimal
(
parameterIndex
,
scale
);
}
}
/**
* Returns the value of the specified column as a byte array.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
byte
[]
getBytes
(
int
parameterIndex
)
throws
SQLException
{
public
byte
[]
getBytes
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
checkRegistered
(
parameterIndex
);
return
resultSet
.
getBytes
(
parameterIndex
);
return
getOpenResultSet
()
.
getBytes
(
parameterIndex
);
}
}
/**
* Returns the value of the specified column as a java.sql.Date.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @return the value
* @throws SQLException if the column is not found or if the result set is closed
*/
public
Date
getDate
(
int
parameterIndex
)
throws
SQLException
{
public
Date
getDate
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
checkRegistered
(
parameterIndex
);
return
resultSet
.
getDate
(
parameterIndex
);
return
getOpenResultSet
()
.
getDate
(
parameterIndex
);
}
}
/**
* Returns the value of the specified column as a java.sql.Time.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @return the value
* @throws SQLException if the column is not found or if the result set is closed
*/
public
Time
getTime
(
int
parameterIndex
)
throws
SQLException
{
public
Time
getTime
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
checkRegistered
(
parameterIndex
);
return
resultSet
.
getTime
(
parameterIndex
);
return
getOpenResultSet
()
.
getTime
(
parameterIndex
);
}
}
/**
* Returns the value of the specified column as a java.sql.Timestamp.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @return the value
* @throws SQLException if the column is not found or if the result set is closed
*/
public
Timestamp
getTimestamp
(
int
parameterIndex
)
throws
SQLException
{
public
Timestamp
getTimestamp
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
checkRegistered
(
parameterIndex
);
return
resultSet
.
getTimestamp
(
parameterIndex
);
return
getOpenResultSet
()
.
getTimestamp
(
parameterIndex
);
}
}
/**
* Returns a column value as a Java object. The data is
* de-serialized into a Java object (on the client side).
*
* @param parameterIndex the parameter index (1, 2, ...)
* @return the value or null
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
Object
getObject
(
int
parameterIndex
)
throws
SQLException
{
public
Object
getObject
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
checkRegistered
(
parameterIndex
);
return
resultSet
.
getObject
(
parameterIndex
);
return
getOpenResultSet
()
.
getObject
(
parameterIndex
);
}
}
/**
* Returns the value of the specified column as a BigDecimal.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @return the value
* @throws SQLException if the column is not found or if the result set is closed
*/
public
BigDecimal
getBigDecimal
(
int
parameterIndex
)
throws
SQLException
{
public
BigDecimal
getBigDecimal
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
checkRegistered
(
parameterIndex
);
return
resultSet
.
getBigDecimal
(
parameterIndex
);
return
getOpenResultSet
()
.
getBigDecimal
(
parameterIndex
);
}
}
/**
* [Not supported] Gets a column as a object using the specified type
* mapping.
*/
public
Object
getObject
(
int
parameterIndex
,
Map
<
String
,
Class
<?>>
map
)
throws
SQLException
{
public
Object
getObject
(
int
parameterIndex
,
Map
<
String
,
Class
<?>>
map
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
throw
unsupported
(
"map"
);
return
resultSet
.
getObject
(
parameterIndex
,
map
);
}
}
/**
* [Not supported] Gets a column as a reference.
*/
public
Ref
getRef
(
int
parameterIndex
)
throws
SQLException
{
public
Ref
getRef
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
throw
unsupported
(
"ref"
);
return
resultSet
.
getRef
(
parameterIndex
);
}
}
/**
* Returns the value of the specified column as a Blob.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
Blob
getBlob
(
int
parameterIndex
)
throws
SQLException
{
public
Blob
getBlob
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
checkRegistered
(
parameterIndex
);
return
resultSet
.
getBlob
(
parameterIndex
);
return
getOpenResultSet
()
.
getBlob
(
parameterIndex
);
}
}
/**
* Returns the value of the specified column as a Clob.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
Clob
getClob
(
int
parameterIndex
)
throws
SQLException
{
public
Clob
getClob
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
checkRegistered
(
parameterIndex
);
return
resultSet
.
getClob
(
parameterIndex
);
return
getOpenResultSet
()
.
getClob
(
parameterIndex
);
}
}
/**
* Returns the value of the specified column as an Array.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
Array
getArray
(
int
parameterIndex
)
throws
SQLException
{
public
Array
getArray
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
checkRegistered
(
parameterIndex
);
return
resultSet
.
getArray
(
parameterIndex
);
return
getOpenResultSet
()
.
getArray
(
parameterIndex
);
}
}
/**
* Returns the value of the specified column as a java.sql.Date using a
* specified time zone.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param calendar the calendar
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
Date
getDate
(
int
parameterIndex
,
Calendar
cal
)
throws
SQLException
{
public
Date
getDate
(
int
parameterIndex
,
Calendar
cal
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
checkRegistered
(
parameterIndex
);
return
resultSet
.
getDate
(
parameterIndex
,
cal
);
return
getOpenResultSet
()
.
getDate
(
parameterIndex
,
cal
);
}
}
/**
* Returns the value of the specified column as a java.sql.Time using a
* specified time zone.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param calendar the calendar
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
Time
getTime
(
int
parameterIndex
,
Calendar
cal
)
throws
SQLException
{
public
Time
getTime
(
int
parameterIndex
,
Calendar
cal
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
checkRegistered
(
parameterIndex
);
return
resultSet
.
getTime
(
parameterIndex
,
cal
);
return
getOpenResultSet
()
.
getTime
(
parameterIndex
,
cal
);
}
}
/**
* Returns the value of the specified column as a java.sql.Timestamp using a
* specified time zone.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param calendar the calendar
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
Timestamp
getTimestamp
(
int
parameterIndex
,
Calendar
cal
)
throws
SQLException
{
public
Timestamp
getTimestamp
(
int
parameterIndex
,
Calendar
cal
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
checkRegistered
(
parameterIndex
);
return
resultSet
.
getTimestamp
(
parameterIndex
,
cal
);
return
getOpenResultSet
().
getTimestamp
(
parameterIndex
,
cal
);
}
public
void
registerOutParameter
(
int
parameterIndex
,
int
sqlType
,
String
typeName
)
throws
SQLException
{
registerOutParameter
(
parameterIndex
,
sqlType
,
0
,
typeName
);
}
}
/**
* [Not supported]
*/
public
URL
getURL
(
String
parameterName
)
throws
SQLException
{
public
URL
getURL
(
String
parameterName
)
throws
SQLException
{
return
getURL
(
getIndexForName
(
parameterName
)
);
throw
unsupported
(
"url"
);
}
}
/**
* Returns the value of the specified column as a java.sql.Timestamp using a
* specified time zone.
*
* @param parameterName the parameter name
* @param calendar the calendar
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
Timestamp
getTimestamp
(
String
parameterName
,
Calendar
cal
)
throws
SQLException
{
public
Timestamp
getTimestamp
(
String
parameterName
,
Calendar
cal
)
throws
SQLException
{
return
getTimestamp
(
getIndexForName
(
parameterName
),
cal
);
return
getTimestamp
(
getIndexForName
(
parameterName
),
cal
);
}
}
/**
* Returns the value of the specified column as a java.sql.Time using a
* specified time zone.
*
* @param parameterName the parameter name
* @param calendar the calendar
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
Time
getTime
(
String
parameterName
,
Calendar
cal
)
throws
SQLException
{
public
Time
getTime
(
String
parameterName
,
Calendar
cal
)
throws
SQLException
{
return
getTime
(
getIndexForName
(
parameterName
),
cal
);
return
getTime
(
getIndexForName
(
parameterName
),
cal
);
}
}
/**
* Returns the value of the specified column as a java.sql.Date using a
* specified time zone.
*
* @param parameterName the parameter name
* @param calendar the calendar
* @return the value
* @throws SQLException if the column is not found or if the result set is closed
*/
public
Date
getDate
(
String
parameterName
,
Calendar
cal
)
throws
SQLException
{
public
Date
getDate
(
String
parameterName
,
Calendar
cal
)
throws
SQLException
{
return
getDate
(
getIndexForName
(
parameterName
),
cal
);
return
getDate
(
getIndexForName
(
parameterName
),
cal
);
}
}
/**
* Returns the value of the specified column as an Array.
*
* @param parameterName the parameter name
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
Array
getArray
(
String
parameterName
)
throws
SQLException
{
public
Array
getArray
(
String
parameterName
)
throws
SQLException
{
return
getArray
(
getIndexForName
(
parameterName
));
return
getArray
(
getIndexForName
(
parameterName
));
}
}
/**
* Returns the value of the specified column as a Clob.
*
* @param parameterName the parameter name
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
Clob
getClob
(
String
parameterName
)
throws
SQLException
{
public
Clob
getClob
(
String
parameterName
)
throws
SQLException
{
return
getClob
(
getIndexForName
(
parameterName
));
return
getClob
(
getIndexForName
(
parameterName
));
}
}
/**
* Returns the value of the specified column as a Blob.
*
* @param parameterName the parameter name
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
Blob
getBlob
(
String
parameterName
)
throws
SQLException
{
public
Blob
getBlob
(
String
parameterName
)
throws
SQLException
{
return
getBlob
(
getIndexForName
(
parameterName
));
return
getBlob
(
getIndexForName
(
parameterName
));
}
}
/**
* [Not supported] Gets a column as a reference.
*/
public
Ref
getRef
(
String
parameterName
)
throws
SQLException
{
public
Ref
getRef
(
String
parameterName
)
throws
SQLException
{
return
getRef
(
getIndexForName
(
parameterName
)
);
throw
unsupported
(
"ref"
);
}
}
/**
* [Not supported] Gets a column as a object using the specified type
* mapping.
*/
public
Object
getObject
(
String
parameterName
,
Map
<
String
,
Class
<?>>
map
)
throws
SQLException
{
public
Object
getObject
(
String
parameterName
,
Map
<
String
,
Class
<?>>
map
)
throws
SQLException
{
return
getObject
(
getIndexForName
(
parameterName
),
map
);
throw
unsupported
(
"map"
);
}
}
/**
* Returns the value of the specified column as a BigDecimal.
*
* @param parameterName the parameter name
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
BigDecimal
getBigDecimal
(
String
parameterName
)
throws
SQLException
{
public
BigDecimal
getBigDecimal
(
String
parameterName
)
throws
SQLException
{
return
getBigDecimal
(
getIndexForName
(
parameterName
));
return
getBigDecimal
(
getIndexForName
(
parameterName
));
}
}
/**
* Returns a column value as a Java object. The data is
* de-serialized into a Java object (on the client side).
*
* @param parameterName the parameter name
* @return the value or null
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
Object
getObject
(
String
parameterName
)
throws
SQLException
{
public
Object
getObject
(
String
parameterName
)
throws
SQLException
{
return
getObject
(
getIndexForName
(
parameterName
));
return
getObject
(
getIndexForName
(
parameterName
));
}
}
/**
* Returns the value of the specified column as a java.sql.Timestamp.
*
* @param parameterName the parameter name
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
Timestamp
getTimestamp
(
String
parameterName
)
throws
SQLException
{
public
Timestamp
getTimestamp
(
String
parameterName
)
throws
SQLException
{
return
getTimestamp
(
getIndexForName
(
parameterName
));
return
getTimestamp
(
getIndexForName
(
parameterName
));
}
}
/**
* Returns the value of the specified column as a java.sql.Time.
*
* @param parameterName the parameter name
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
Time
getTime
(
String
parameterName
)
throws
SQLException
{
public
Time
getTime
(
String
parameterName
)
throws
SQLException
{
return
getTime
(
getIndexForName
(
parameterName
));
return
getTime
(
getIndexForName
(
parameterName
));
}
}
/**
* Returns the value of the specified column as a java.sql.Date.
*
* @param parameterName the parameter name
* @return the value
* @throws SQLException if the column is not found or if the result set is closed
*/
public
Date
getDate
(
String
parameterName
)
throws
SQLException
{
public
Date
getDate
(
String
parameterName
)
throws
SQLException
{
return
getDate
(
getIndexForName
(
parameterName
));
return
getDate
(
getIndexForName
(
parameterName
));
}
}
/**
* Returns the value of the specified column as a byte array.
*
* @param parameterName the parameter name
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
byte
[]
getBytes
(
String
parameterName
)
throws
SQLException
{
public
byte
[]
getBytes
(
String
parameterName
)
throws
SQLException
{
return
getBytes
(
getIndexForName
(
parameterName
));
return
getBytes
(
getIndexForName
(
parameterName
));
}
}
/**
* Returns the value of the specified column as a double.
*
* @param parameterName the parameter name
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
double
getDouble
(
String
parameterName
)
throws
SQLException
{
public
double
getDouble
(
String
parameterName
)
throws
SQLException
{
return
getDouble
(
getIndexForName
(
parameterName
));
return
getDouble
(
getIndexForName
(
parameterName
));
}
}
/**
* Returns the value of the specified column as a float.
*
* @param parameterName the parameter name
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
float
getFloat
(
String
parameterName
)
throws
SQLException
{
public
float
getFloat
(
String
parameterName
)
throws
SQLException
{
return
getFloat
(
getIndexForName
(
parameterName
));
return
getFloat
(
getIndexForName
(
parameterName
));
}
}
/**
* Returns the value of the specified column as a long.
*
* @param parameterName the parameter name
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
long
getLong
(
String
parameterName
)
throws
SQLException
{
public
long
getLong
(
String
parameterName
)
throws
SQLException
{
return
getLong
(
getIndexForName
(
parameterName
));
return
getLong
(
getIndexForName
(
parameterName
));
}
}
/**
* Returns the value of the specified column as an int.
*
* @param parameterName the parameter name
* @return the value
* @throws SQLException if the column is not found or if the result set is closed
*/
public
int
getInt
(
String
parameterName
)
throws
SQLException
{
public
int
getInt
(
String
parameterName
)
throws
SQLException
{
return
getInt
(
getIndexForName
(
parameterName
));
return
getInt
(
getIndexForName
(
parameterName
));
}
}
/**
* Returns the value of the specified column as a short.
*
* @param parameterName the parameter name
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
short
getShort
(
String
parameterName
)
throws
SQLException
{
public
short
getShort
(
String
parameterName
)
throws
SQLException
{
return
getShort
(
getIndexForName
(
parameterName
));
return
getShort
(
getIndexForName
(
parameterName
));
}
}
/**
* Returns the value of the specified column as a byte.
*
* @param parameterName the parameter name
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
byte
getByte
(
String
parameterName
)
throws
SQLException
{
public
byte
getByte
(
String
parameterName
)
throws
SQLException
{
return
getByte
(
getIndexForName
(
parameterName
));
return
getByte
(
getIndexForName
(
parameterName
));
}
}
/**
* Returns the value of the specified column as a boolean.
*
* @param parameterName the parameter name
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
public
boolean
getBoolean
(
String
parameterName
)
throws
SQLException
{
public
boolean
getBoolean
(
String
parameterName
)
throws
SQLException
{
return
getBoolean
(
getIndexForName
(
parameterName
));
return
getBoolean
(
getIndexForName
(
parameterName
));
}
}
/**
* Returns the value of the specified column as a String.
*
* @param parameterName the parameter name
* @return the value
* @throws SQLException if the column is not found or if the result set is closed
*/
public
String
getString
(
String
parameterName
)
throws
SQLException
{
public
String
getString
(
String
parameterName
)
throws
SQLException
{
return
getString
(
getIndexForName
(
parameterName
));
return
getString
(
getIndexForName
(
parameterName
));
}
}
/
/ --- setters --------------------------------------------------
/
**
* [Not supported] Returns the value of the specified column as a row id.
public
void
setNull
(
String
parameterName
,
int
sqlType
,
String
typeName
)
throws
SQLException
{
*
setNull
(
getIndexForName
(
parameterName
),
sqlType
,
typeName
);
* @param parameterIndex the parameter index (1, 2, ...)
}
*/
//## Java 1.6 begin ##
public
void
setTimestamp
(
String
parameterName
,
Timestamp
x
,
Calendar
cal
)
throws
SQLException
{
public
RowId
getRowId
(
int
parameterIndex
)
throws
SQLException
{
setTimestamp
(
getIndexForName
(
parameterName
),
x
,
cal
);
throw
unsupported
(
"rowId"
);
}
}
//## Java 1.6 end ##
public
void
setTime
(
String
parameterName
,
Time
x
,
Calendar
cal
)
throws
SQLException
{
/**
setTime
(
getIndexForName
(
parameterName
),
x
,
cal
);
* [Not supported] Returns the value of the specified column as a row id.
*
* @param parameterName the parameter name
*/
//## Java 1.6 begin ##
public
RowId
getRowId
(
String
parameterName
)
throws
SQLException
{
throw
unsupported
(
"rowId"
);
}
}
//## Java 1.6 end ##
public
void
setDate
(
String
parameterName
,
Date
x
,
Calendar
cal
)
throws
SQLException
{
/**
setDate
(
getIndexForName
(
parameterName
),
x
,
cal
);
* Returns the value of the specified column as a Clob.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @return the value
* @throws SQLException if the column is not found or if the result set is closed
*/
//## Java 1.6 begin ##
public
NClob
getNClob
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
return
getOpenResultSet
().
getNClob
(
parameterIndex
);
}
}
//## Java 1.6 end ##
public
void
setCharacterStream
(
String
parameterName
,
Reader
reader
,
int
length
)
throws
SQLException
{
/**
* Returns the value of the specified column as a Clob.
*
* @param parameterName the parameter name
* @return the value
* @throws SQLException if the column is not found or if the result set is closed
*/
//## Java 1.6 begin ##
public
NClob
getNClob
(
String
parameterName
)
throws
SQLException
{
return
getNClob
(
getIndexForName
(
parameterName
));
}
//## Java 1.6 end ##
/**
* [Not supported] Returns the value of the specified column as a SQLXML object.
*/
//## Java 1.6 begin ##
public
SQLXML
getSQLXML
(
int
parameterIndex
)
throws
SQLException
{
throw
unsupported
(
"SQLXML"
);
}
//## Java 1.6 end ##
/**
* [Not supported] Returns the value of the specified column as a SQLXML object.
*/
//## Java 1.6 begin ##
public
SQLXML
getSQLXML
(
String
parameterName
)
throws
SQLException
{
throw
unsupported
(
"SQLXML"
);
}
//## Java 1.6 end ##
/**
* Returns the value of the specified column as a String.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
//## Java 1.6 begin ##
public
String
getNString
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
return
getOpenResultSet
().
getNString
(
parameterIndex
);
}
//## Java 1.6 end ##
/**
* Returns the value of the specified column as a String.
*
* @param parameterName the parameter name
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
//## Java 1.6 begin ##
public
String
getNString
(
String
parameterName
)
throws
SQLException
{
return
getNString
(
getIndexForName
(
parameterName
));
}
//## Java 1.6 end ##
/**
* Returns the value of the specified column as a reader.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
//## Java 1.6 begin ##
public
Reader
getNCharacterStream
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
return
getOpenResultSet
().
getNCharacterStream
(
parameterIndex
);
}
//## Java 1.6 end ##
/**
* Returns the value of the specified column as a reader.
*
* @param parameterName the parameter name
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
//## Java 1.6 begin ##
public
Reader
getNCharacterStream
(
String
parameterName
)
throws
SQLException
{
return
getNCharacterStream
(
getIndexForName
(
parameterName
));
}
//## Java 1.6 end ##
/**
* Returns the value of the specified column as a reader.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
//## Java 1.6 begin ##
public
Reader
getCharacterStream
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
return
getOpenResultSet
().
getCharacterStream
(
parameterIndex
);
}
//## Java 1.6 end ##
/**
* Returns the value of the specified column as a reader.
*
* @param parameterName the parameter name
* @return the value
* @throws SQLException if the column is not found or if the result set is
* closed
*/
//## Java 1.6 begin ##
public
Reader
getCharacterStream
(
String
parameterName
)
throws
SQLException
{
return
getCharacterStream
(
getIndexForName
(
parameterName
));
}
//## Java 1.6 end ##
// =============================================================
/**
* Sets a parameter to null.
*
* @param parameterName the parameter name
* @param sqlType the data type (Types.x)
* @param typeName this parameter is ignored
* @throws SQLException if this object is closed
*/
public
void
setNull
(
String
parameterName
,
int
sqlType
,
String
typeName
)
throws
SQLException
{
setNull
(
getIndexForName
(
parameterName
),
sqlType
,
typeName
);
}
/**
* Sets a parameter to null.
*
* @param parameterName the parameter name
* @param sqlType the data type (Types.x)
* @throws SQLException if this object is closed
*/
public
void
setNull
(
String
parameterName
,
int
sqlType
)
throws
SQLException
{
setNull
(
getIndexForName
(
parameterName
),
sqlType
);
}
/**
* Sets the timestamp using a specified time zone. The value will be
* converted to the local time zone.
*
* @param parameterName the parameter name
* @param x the value
* @param calendar the calendar
* @throws SQLException if this object is closed
*/
public
void
setTimestamp
(
String
parameterName
,
Timestamp
x
,
Calendar
cal
)
throws
SQLException
{
setTimestamp
(
getIndexForName
(
parameterName
),
x
,
cal
);
}
/**
* Sets the time using a specified time zone. The value will be converted to
* the local time zone.
*
* @param parameterName the parameter name
* @param x the value
* @param calendar the calendar
* @throws SQLException if this object is closed
*/
public
void
setTime
(
String
parameterName
,
Time
x
,
Calendar
cal
)
throws
SQLException
{
setTime
(
getIndexForName
(
parameterName
),
x
,
cal
);
}
/**
* Sets the date using a specified time zone. The value will be converted to
* the local time zone.
*
* @param parameterName the parameter name
* @param x the value
* @param calendar the calendar
* @throws SQLException if this object is closed
*/
public
void
setDate
(
String
parameterName
,
Date
x
,
Calendar
cal
)
throws
SQLException
{
setDate
(
getIndexForName
(
parameterName
),
x
,
cal
);
}
/**
* Sets the value of a parameter as a character stream.
* This method does not close the reader.
* The reader may be closed after executing the statement.
*
* @param parameterName the parameter name
* @param x the value
* @param length the number of bytes
* @throws SQLException if this object is closed
*/
public
void
setCharacterStream
(
String
parameterName
,
Reader
reader
,
int
length
)
throws
SQLException
{
setCharacterStream
(
getIndexForName
(
parameterName
),
reader
,
length
);
setCharacterStream
(
getIndexForName
(
parameterName
),
reader
,
length
);
}
}
/**
* Sets the value of a parameter.
* Objects of unknown classes are serialized (on the client side).
*
* @param parameterName the parameter name
* @param x the value
* @throws SQLException if this object is closed
*/
public
void
setObject
(
String
parameterName
,
Object
x
)
throws
SQLException
{
public
void
setObject
(
String
parameterName
,
Object
x
)
throws
SQLException
{
setObject
(
getIndexForName
(
parameterName
),
x
);
setObject
(
getIndexForName
(
parameterName
),
x
);
}
}
/**
* Sets the value of a parameter. The object is converted, if required, to
* the specified data type before sending to the database.
* Objects of unknown classes are serialized (on the client side).
*
* @param parameterName the parameter name
* @param x the value, null is allowed
* @param targetSqlType the type as defined in java.sql.Types
* @throws SQLException if this object is closed
*/
public
void
setObject
(
String
parameterName
,
Object
x
,
int
targetSqlType
)
throws
SQLException
{
public
void
setObject
(
String
parameterName
,
Object
x
,
int
targetSqlType
)
throws
SQLException
{
setObject
(
getIndexForName
(
parameterName
),
x
,
targetSqlType
);
setObject
(
getIndexForName
(
parameterName
),
x
,
targetSqlType
);
}
}
/**
* Sets the value of a parameter. The object is converted, if required, to
* the specified data type before sending to the database.
* Objects of unknown classes are serialized (on the client side).
*
* @param parameterName the parameter name
* @param x the value, null is allowed
* @param targetSqlType the type as defined in java.sql.Types
* @param scale is ignored
* @throws SQLException if this object is closed
*/
public
void
setObject
(
String
parameterName
,
Object
x
,
int
targetSqlType
,
int
scale
)
throws
SQLException
{
public
void
setObject
(
String
parameterName
,
Object
x
,
int
targetSqlType
,
int
scale
)
throws
SQLException
{
setObject
(
getIndexForName
(
parameterName
),
x
,
targetSqlType
,
scale
);
setObject
(
getIndexForName
(
parameterName
),
x
,
targetSqlType
,
scale
);
}
}
/**
* Sets the value of a parameter as an input stream.
* This method does not close the stream.
* The stream may be closed after executing the statement.
*
* @param parameterName the parameter name
* @param x the value
* @param length the number of bytes
* @throws SQLException if this object is closed
*/
public
void
setBinaryStream
(
String
parameterName
,
InputStream
x
,
int
length
)
throws
SQLException
{
public
void
setBinaryStream
(
String
parameterName
,
InputStream
x
,
int
length
)
throws
SQLException
{
setBinaryStream
(
getIndexForName
(
parameterName
),
x
,
length
);
setBinaryStream
(
getIndexForName
(
parameterName
),
x
,
length
);
}
}
//## Java 1.6 begin ##
/**
* Sets the value of a parameter as an ASCII stream.
* This method does not close the stream.
* The stream may be closed after executing the statement.
*
* @param parameterName the parameter name
* @param x the value
* @param length the number of bytes
* @throws SQLException if this object is closed
*/
public
void
setAsciiStream
(
String
parameterName
,
public
void
setAsciiStream
(
String
parameterName
,
InputStream
x
,
long
length
)
throws
SQLException
{
InputStream
x
,
long
length
)
throws
SQLException
{
setAsciiStream
(
getIndexForName
(
parameterName
),
x
,
length
);
setAsciiStream
(
getIndexForName
(
parameterName
),
x
,
length
);
}
}
//## Java 1.6 end ##
/**
* Sets the value of a parameter.
*
* @param parameterName the parameter name
* @param x the value
* @throws SQLException if this object is closed
*/
public
void
setTimestamp
(
String
parameterName
,
Timestamp
x
)
throws
SQLException
{
public
void
setTimestamp
(
String
parameterName
,
Timestamp
x
)
throws
SQLException
{
setTimestamp
(
getIndexForName
(
parameterName
),
x
);
setTimestamp
(
getIndexForName
(
parameterName
),
x
);
}
}
/**
* Sets the time using a specified time zone. The value will be converted to
* the local time zone.
*
* @param parameterName the parameter name
* @param x the value
* @param calendar the calendar
* @throws SQLException if this object is closed
*/
public
void
setTime
(
String
parameterName
,
Time
x
)
throws
SQLException
{
public
void
setTime
(
String
parameterName
,
Time
x
)
throws
SQLException
{
setTime
(
getIndexForName
(
parameterName
),
x
);
setTime
(
getIndexForName
(
parameterName
),
x
);
}
}
/**
* Sets the value of a parameter.
*
* @param parameterName the parameter name
* @param x the value
* @throws SQLException if this object is closed
*/
public
void
setDate
(
String
parameterName
,
Date
x
)
throws
SQLException
{
public
void
setDate
(
String
parameterName
,
Date
x
)
throws
SQLException
{
setDate
(
getIndexForName
(
parameterName
),
x
);
setDate
(
getIndexForName
(
parameterName
),
x
);
}
}
/**
* Sets the value of a parameter as a byte array.
*
* @param parameterName the parameter name
* @param x the value
* @throws SQLException if this object is closed
*/
public
void
setBytes
(
String
parameterName
,
byte
[]
x
)
throws
SQLException
{
public
void
setBytes
(
String
parameterName
,
byte
[]
x
)
throws
SQLException
{
setBytes
(
getIndexForName
(
parameterName
),
x
);
setBytes
(
getIndexForName
(
parameterName
),
x
);
}
}
/**
* Sets the value of a parameter.
*
* @param parameterName the parameter name
* @param x the value
* @throws SQLException if this object is closed
*/
public
void
setString
(
String
parameterName
,
String
x
)
throws
SQLException
{
public
void
setString
(
String
parameterName
,
String
x
)
throws
SQLException
{
setString
(
getIndexForName
(
parameterName
),
x
);
setString
(
getIndexForName
(
parameterName
),
x
);
}
}
/**
* Sets the value of a parameter.
*
* @param parameterName the parameter name
* @param x the value
* @throws SQLException if this object is closed
*/
public
void
setBigDecimal
(
String
parameterName
,
BigDecimal
x
)
throws
SQLException
{
public
void
setBigDecimal
(
String
parameterName
,
BigDecimal
x
)
throws
SQLException
{
setBigDecimal
(
getIndexForName
(
parameterName
),
x
);
setBigDecimal
(
getIndexForName
(
parameterName
),
x
);
}
}
/**
* Sets the value of a parameter.
*
* @param parameterName the parameter name
* @param x the value
* @throws SQLException if this object is closed
*/
public
void
setDouble
(
String
parameterName
,
double
x
)
throws
SQLException
{
public
void
setDouble
(
String
parameterName
,
double
x
)
throws
SQLException
{
setDouble
(
getIndexForName
(
parameterName
),
x
);
setDouble
(
getIndexForName
(
parameterName
),
x
);
}
}
/**
* Sets the value of a parameter.
*
* @param parameterName the parameter name
* @param x the value
* @throws SQLException if this object is closed
*/
public
void
setFloat
(
String
parameterName
,
float
x
)
throws
SQLException
{
public
void
setFloat
(
String
parameterName
,
float
x
)
throws
SQLException
{
setFloat
(
getIndexForName
(
parameterName
),
x
);
setFloat
(
getIndexForName
(
parameterName
),
x
);
}
}
/**
* Sets the value of a parameter.
*
* @param parameterName the parameter name
* @param x the value
* @throws SQLException if this object is closed
*/
public
void
setLong
(
String
parameterName
,
long
x
)
throws
SQLException
{
public
void
setLong
(
String
parameterName
,
long
x
)
throws
SQLException
{
setLong
(
getIndexForName
(
parameterName
),
x
);
setLong
(
getIndexForName
(
parameterName
),
x
);
}
}
/**
* Sets the value of a parameter.
*
* @param parameterName the parameter name
* @param x the value
* @throws SQLException if this object is closed
*/
public
void
setInt
(
String
parameterName
,
int
x
)
throws
SQLException
{
public
void
setInt
(
String
parameterName
,
int
x
)
throws
SQLException
{
setInt
(
getIndexForName
(
parameterName
),
x
);
setInt
(
getIndexForName
(
parameterName
),
x
);
}
}
/**
* Sets the value of a parameter.
*
* @param parameterName the parameter name
* @param x the value
* @throws SQLException if this object is closed
*/
public
void
setShort
(
String
parameterName
,
short
x
)
throws
SQLException
{
public
void
setShort
(
String
parameterName
,
short
x
)
throws
SQLException
{
setShort
(
getIndexForName
(
parameterName
),
x
);
setShort
(
getIndexForName
(
parameterName
),
x
);
}
}
/**
* Sets the value of a parameter.
*
* @param parameterName the parameter name
* @param x the value
* @throws SQLException if this object is closed
*/
public
void
setByte
(
String
parameterName
,
byte
x
)
throws
SQLException
{
public
void
setByte
(
String
parameterName
,
byte
x
)
throws
SQLException
{
setByte
(
getIndexForName
(
parameterName
),
x
);
setByte
(
getIndexForName
(
parameterName
),
x
);
}
}
/**
* Sets the value of a parameter.
*
* @param parameterName the parameter name
* @param x the value
* @throws SQLException if this object is closed
*/
public
void
setBoolean
(
String
parameterName
,
boolean
x
)
throws
SQLException
{
public
void
setBoolean
(
String
parameterName
,
boolean
x
)
throws
SQLException
{
setBoolean
(
getIndexForName
(
parameterName
),
x
);
setBoolean
(
getIndexForName
(
parameterName
),
x
);
}
}
public
void
setNull
(
String
parameterName
,
int
sqlType
)
throws
SQLException
{
/**
setNull
(
getIndexForName
(
parameterName
),
sqlType
);
* [Not supported]
}
*/
public
void
setURL
(
String
parameterName
,
URL
val
)
throws
SQLException
{
public
void
setURL
(
String
parameterName
,
URL
val
)
throws
SQLException
{
setURL
(
getIndexForName
(
parameterName
),
val
);
throw
unsupported
(
"url"
);
}
// --- other methods --------------------------------------------
public
void
registerOutParameter
(
String
parameterName
,
int
sqlType
,
String
typeName
)
throws
SQLException
{
registerOutParameter
(
getIndexForName
(
parameterName
),
sqlType
,
typeName
);
}
public
void
registerOutParameter
(
String
parameterName
,
int
sqlType
,
int
scale
)
throws
SQLException
{
registerOutParameter
(
getIndexForName
(
parameterName
),
sqlType
,
scale
);
}
public
void
registerOutParameter
(
String
parameterName
,
int
sqlType
)
throws
SQLException
{
registerOutParameter
(
getIndexForName
(
parameterName
),
sqlType
);
}
// =============================================================
//## Java 1.6 begin ##
public
RowId
getRowId
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
return
resultSet
.
getRowId
(
parameterIndex
);
}
}
//## Java 1.6 end ##
//## Java 1.6 begin ##
public
RowId
getRowId
(
String
parameterName
)
throws
SQLException
{
return
getRowId
(
getIndexForName
(
parameterName
));
}
//## Java 1.6 end ##
/**
* [Not supported] Sets the value of a parameter as a row id.
*/
//## Java 1.6 begin ##
//## Java 1.6 begin ##
public
void
setRowId
(
String
parameterName
,
RowId
x
)
public
void
setRowId
(
String
parameterName
,
RowId
x
)
throws
SQLException
{
throws
SQLException
{
setRowId
(
getIndexForName
(
parameterName
),
x
);
throw
unsupported
(
"rowId"
);
}
}
//## Java 1.6 end ##
//## Java 1.6 end ##
/**
* Sets the value of a parameter.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param x the value
* @throws SQLException if this object is closed
*/
//## Java 1.6 begin ##
//## Java 1.6 begin ##
public
void
setNString
(
String
parameterName
,
String
x
)
public
void
setNString
(
String
parameterName
,
String
x
)
throws
SQLException
{
throws
SQLException
{
...
@@ -524,6 +1200,16 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
...
@@ -524,6 +1200,16 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
}
}
//## Java 1.6 end ##
//## Java 1.6 end ##
/**
* Sets the value of a parameter as a character stream.
* This method does not close the reader.
* The reader may be closed after executing the statement.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param x the value
* @param length the number of bytes
* @throws SQLException if this object is closed
*/
//## Java 1.6 begin ##
//## Java 1.6 begin ##
public
void
setNCharacterStream
(
String
parameterName
,
public
void
setNCharacterStream
(
String
parameterName
,
Reader
value
,
long
length
)
throws
SQLException
{
Reader
value
,
long
length
)
throws
SQLException
{
...
@@ -531,6 +1217,13 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
...
@@ -531,6 +1217,13 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
}
}
//## Java 1.6 end ##
//## Java 1.6 end ##
/**
* Sets the value of a parameter as a Clob.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param x the value
* @throws SQLException if this object is closed
*/
//## Java 1.6 begin ##
//## Java 1.6 begin ##
public
void
setNClob
(
String
parameterName
,
NClob
value
)
public
void
setNClob
(
String
parameterName
,
NClob
value
)
throws
SQLException
{
throws
SQLException
{
...
@@ -538,6 +1231,15 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
...
@@ -538,6 +1231,15 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
}
}
//## Java 1.6 end ##
//## Java 1.6 end ##
/**
* Sets the value of a parameter as a Clob.
* This method does not close the reader.
* The reader may be closed after executing the statement.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param x the value
* @throws SQLException if this object is closed
*/
//## Java 1.6 begin ##
//## Java 1.6 begin ##
public
void
setClob
(
String
parameterName
,
Reader
reader
,
public
void
setClob
(
String
parameterName
,
Reader
reader
,
long
length
)
throws
SQLException
{
long
length
)
throws
SQLException
{
...
@@ -545,6 +1247,15 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
...
@@ -545,6 +1247,15 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
}
}
//## Java 1.6 end ##
//## Java 1.6 end ##
/**
* Sets the value of a parameter as a Blob.
* This method does not close the stream.
* The stream may be closed after executing the statement.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param x the value
* @throws SQLException if this object is closed
*/
//## Java 1.6 begin ##
//## Java 1.6 begin ##
public
void
setBlob
(
String
parameterName
,
InputStream
inputStream
,
public
void
setBlob
(
String
parameterName
,
InputStream
inputStream
,
long
length
)
throws
SQLException
{
long
length
)
throws
SQLException
{
...
@@ -552,6 +1263,15 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
...
@@ -552,6 +1263,15 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
}
}
//## Java 1.6 end ##
//## Java 1.6 end ##
/**
* Sets the value of a parameter as a Clob.
* This method does not close the reader.
* The reader may be closed after executing the statement.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param x the value
* @throws SQLException if this object is closed
*/
//## Java 1.6 begin ##
//## Java 1.6 begin ##
public
void
setNClob
(
String
parameterName
,
Reader
reader
,
public
void
setNClob
(
String
parameterName
,
Reader
reader
,
long
length
)
throws
SQLException
{
long
length
)
throws
SQLException
{
...
@@ -559,82 +1279,13 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
...
@@ -559,82 +1279,13 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
}
}
//## Java 1.6 end ##
//## Java 1.6 end ##
//## Java 1.6 begin ##
/**
public
NClob
getNClob
(
int
parameterIndex
)
throws
SQLException
{
* Sets the value of a parameter as a Blob.
checkRegistered
(
parameterIndex
);
*
return
resultSet
.
getNClob
(
parameterIndex
);
* @param parameterIndex the parameter index (1, 2, ...)
}
* @param x the value
//## Java 1.6 end ##
* @throws SQLException if this object is closed
*/
//## Java 1.6 begin ##
public
NClob
getNClob
(
String
parameterName
)
throws
SQLException
{
return
getNClob
(
getIndexForName
(
parameterName
));
}
//## Java 1.6 end ##
//## Java 1.6 begin ##
public
void
setSQLXML
(
String
parameterName
,
SQLXML
xmlObject
)
throws
SQLException
{
setSQLXML
(
getIndexForName
(
parameterName
),
xmlObject
);
}
//## Java 1.6 end ##
//## Java 1.6 begin ##
public
SQLXML
getSQLXML
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
return
resultSet
.
getSQLXML
(
parameterIndex
);
}
//## Java 1.6 end ##
//## Java 1.6 begin ##
public
SQLXML
getSQLXML
(
String
parameterName
)
throws
SQLException
{
return
getSQLXML
(
getIndexForName
(
parameterName
));
}
//## Java 1.6 end ##
//## Java 1.6 begin ##
public
String
getNString
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
return
resultSet
.
getNString
(
parameterIndex
);
}
//## Java 1.6 end ##
//## Java 1.6 begin ##
public
String
getNString
(
String
parameterName
)
throws
SQLException
{
return
getNString
(
getIndexForName
(
parameterName
));
}
//## Java 1.6 end ##
//## Java 1.6 begin ##
public
Reader
getNCharacterStream
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
return
resultSet
.
getNCharacterStream
(
parameterIndex
);
}
//## Java 1.6 end ##
//## Java 1.6 begin ##
public
Reader
getNCharacterStream
(
String
parameterName
)
throws
SQLException
{
return
getNCharacterStream
(
getIndexForName
(
parameterName
));
}
//## Java 1.6 end ##
//## Java 1.6 begin ##
public
Reader
getCharacterStream
(
int
parameterIndex
)
throws
SQLException
{
checkRegistered
(
parameterIndex
);
return
resultSet
.
getCharacterStream
(
parameterIndex
);
}
//## Java 1.6 end ##
//## Java 1.6 begin ##
public
Reader
getCharacterStream
(
String
parameterName
)
throws
SQLException
{
return
getCharacterStream
(
getIndexForName
(
parameterName
));
}
//## Java 1.6 end ##
//## Java 1.6 begin ##
//## Java 1.6 begin ##
public
void
setBlob
(
String
parameterName
,
Blob
x
)
public
void
setBlob
(
String
parameterName
,
Blob
x
)
throws
SQLException
{
throws
SQLException
{
...
@@ -642,12 +1293,28 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
...
@@ -642,12 +1293,28 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
}
}
//## Java 1.6 end ##
//## Java 1.6 end ##
/**
* Sets the value of a parameter as a Clob.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param x the value
* @throws SQLException if this object is closed
*/
//## Java 1.6 begin ##
//## Java 1.6 begin ##
public
void
setClob
(
String
parameterName
,
Clob
x
)
throws
SQLException
{
public
void
setClob
(
String
parameterName
,
Clob
x
)
throws
SQLException
{
setClob
(
getIndexForName
(
parameterName
),
x
);
setClob
(
getIndexForName
(
parameterName
),
x
);
}
}
//## Java 1.6 end ##
//## Java 1.6 end ##
/**
* Sets the value of a parameter as an ASCII stream.
* This method does not close the stream.
* The stream may be closed after executing the statement.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param x the value
* @throws SQLException if this object is closed
*/
//## Java 1.6 begin ##
//## Java 1.6 begin ##
public
void
setAsciiStream
(
String
parameterName
,
InputStream
x
)
public
void
setAsciiStream
(
String
parameterName
,
InputStream
x
)
throws
SQLException
{
throws
SQLException
{
...
@@ -655,11 +1322,30 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
...
@@ -655,11 +1322,30 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
}
}
//## Java 1.6 end ##
//## Java 1.6 end ##
/**
* Sets the value of a parameter as an ASCII stream.
* This method does not close the stream.
* The stream may be closed after executing the statement.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param x the value
* @param length the number of bytes
* @throws SQLException if this object is closed
*/
public
void
setAsciiStream
(
String
parameterName
,
public
void
setAsciiStream
(
String
parameterName
,
InputStream
x
,
int
length
)
throws
SQLException
{
InputStream
x
,
int
length
)
throws
SQLException
{
setAsciiStream
(
getIndexForName
(
parameterName
),
x
,
length
);
setAsciiStream
(
getIndexForName
(
parameterName
),
x
,
length
);
}
}
/**
* Sets the value of a parameter as an input stream.
* This method does not close the stream.
* The stream may be closed after executing the statement.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param x the value
* @throws SQLException if this object is closed
*/
//## Java 1.6 begin ##
//## Java 1.6 begin ##
public
void
setBinaryStream
(
String
parameterName
,
public
void
setBinaryStream
(
String
parameterName
,
InputStream
x
)
throws
SQLException
{
InputStream
x
)
throws
SQLException
{
...
@@ -667,6 +1353,16 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
...
@@ -667,6 +1353,16 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
}
}
//## Java 1.6 end ##
//## Java 1.6 end ##
/**
* Sets the value of a parameter as an input stream.
* This method does not close the stream.
* The stream may be closed after executing the statement.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param x the value
* @param length the number of bytes
* @throws SQLException if this object is closed
*/
//## Java 1.6 begin ##
//## Java 1.6 begin ##
public
void
setBinaryStream
(
String
parameterName
,
public
void
setBinaryStream
(
String
parameterName
,
InputStream
x
,
long
length
)
throws
SQLException
{
InputStream
x
,
long
length
)
throws
SQLException
{
...
@@ -674,6 +1370,15 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
...
@@ -674,6 +1370,15 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
}
}
//## Java 1.6 end ##
//## Java 1.6 end ##
/**
* Sets the value of a parameter as a Blob.
* This method does not close the stream.
* The stream may be closed after executing the statement.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param x the value
* @throws SQLException if this object is closed
*/
//## Java 1.6 begin ##
//## Java 1.6 begin ##
public
void
setBlob
(
String
parameterName
,
InputStream
x
)
public
void
setBlob
(
String
parameterName
,
InputStream
x
)
throws
SQLException
{
throws
SQLException
{
...
@@ -681,6 +1386,15 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
...
@@ -681,6 +1386,15 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
}
}
//## Java 1.6 end ##
//## Java 1.6 end ##
/**
* Sets the value of a parameter as a character stream.
* This method does not close the reader.
* The reader may be closed after executing the statement.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param x the value
* @throws SQLException if this object is closed
*/
//## Java 1.6 begin ##
//## Java 1.6 begin ##
public
void
setCharacterStream
(
String
parameterName
,
Reader
x
)
public
void
setCharacterStream
(
String
parameterName
,
Reader
x
)
throws
SQLException
{
throws
SQLException
{
...
@@ -688,6 +1402,16 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
...
@@ -688,6 +1402,16 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
}
}
//## Java 1.6 end ##
//## Java 1.6 end ##
/**
* Sets the value of a parameter as a character stream.
* This method does not close the reader.
* The reader may be closed after executing the statement.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param x the value
* @param length the number of characters
* @throws SQLException if this object is closed
*/
//## Java 1.6 begin ##
//## Java 1.6 begin ##
public
void
setCharacterStream
(
String
parameterName
,
public
void
setCharacterStream
(
String
parameterName
,
Reader
x
,
long
length
)
throws
SQLException
{
Reader
x
,
long
length
)
throws
SQLException
{
...
@@ -695,12 +1419,30 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
...
@@ -695,12 +1419,30 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
}
}
//## Java 1.6 end ##
//## Java 1.6 end ##
/**
* Sets the value of a parameter as a character stream.
* This method does not close the reader.
* The reader may be closed after executing the statement.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param x the value
* @throws SQLException if this object is closed
*/
//## Java 1.6 begin ##
//## Java 1.6 begin ##
public
void
setClob
(
String
parameterName
,
Reader
x
)
throws
SQLException
{
public
void
setClob
(
String
parameterName
,
Reader
x
)
throws
SQLException
{
setClob
(
getIndexForName
(
parameterName
),
x
);
setClob
(
getIndexForName
(
parameterName
),
x
);
}
}
//## Java 1.6 end ##
//## Java 1.6 end ##
/**
* Sets the value of a parameter as a character stream.
* This method does not close the reader.
* The reader may be closed after executing the statement.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param x the value
* @throws SQLException if this object is closed
*/
//## Java 1.6 begin ##
//## Java 1.6 begin ##
public
void
setNCharacterStream
(
String
parameterName
,
public
void
setNCharacterStream
(
String
parameterName
,
Reader
x
)
throws
SQLException
{
Reader
x
)
throws
SQLException
{
...
@@ -708,10 +1450,110 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
...
@@ -708,10 +1450,110 @@ public class JdbcCallableStatement extends JdbcPreparedStatement implements Call
}
}
//## Java 1.6 end ##
//## Java 1.6 end ##
/**
* Sets the value of a parameter as a Clob.
* This method does not close the reader.
* The reader may be closed after executing the statement.
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param x the value
* @param length the number of characters
* @throws SQLException if this object is closed
*/
//## Java 1.6 begin ##
//## Java 1.6 begin ##
public
void
setNClob
(
String
parameterName
,
Reader
x
)
throws
SQLException
{
public
void
setNClob
(
String
parameterName
,
Reader
x
)
throws
SQLException
{
setNClob
(
getIndexForName
(
parameterName
),
x
);
setNClob
(
getIndexForName
(
parameterName
),
x
);
}
}
//## Java 1.6 end ##
//## Java 1.6 end ##
/**
* [Not supported] Sets the value of a parameter as a SQLXML object.
*/
//## Java 1.6 begin ##
public
void
setSQLXML
(
String
parameterName
,
SQLXML
xmlObject
)
throws
SQLException
{
throw
unsupported
(
"SQLXML"
);
}
//## Java 1.6 end ##
private
ResultSetMetaData
getCheckedMetaData
()
throws
SQLException
{
ResultSetMetaData
meta
=
getMetaData
();
if
(
meta
==
null
)
{
throw
DbException
.
getUnsupportedException
(
"Supported only for calling stored procedures"
);
}
return
meta
;
}
private
void
checkIndexBounds
(
int
parameterIndex
)
throws
SQLException
{
checkClosed
();
if
(
parameterIndex
<
1
||
parameterIndex
>
maxOutParameters
)
{
throw
DbException
.
getInvalidValueException
(
""
+
parameterIndex
,
"parameterIndex"
);
}
}
private
void
registerOutParameter
(
int
parameterIndex
)
throws
SQLException
{
try
{
checkClosed
();
if
(
outParameters
==
null
)
{
maxOutParameters
=
Math
.
min
(
getParameterMetaData
().
getParameterCount
(),
getCheckedMetaData
().
getColumnCount
());
outParameters
=
new
BitField
();
}
checkIndexBounds
(
parameterIndex
);
ParameterInterface
param
=
command
.
getParameters
().
get
(--
parameterIndex
);
if
(
param
.
getParamValue
()
==
null
)
{
param
.
setValue
(
ValueNull
.
INSTANCE
,
false
);
}
outParameters
.
set
(
parameterIndex
);
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
}
}
private
void
checkRegistered
(
int
parameterIndex
)
throws
SQLException
{
try
{
checkIndexBounds
(
parameterIndex
);
if
(!
outParameters
.
get
(
parameterIndex
-
1
))
{
throw
DbException
.
getInvalidValueException
(
""
+
parameterIndex
,
"parameterIndex"
);
}
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
}
}
private
int
getIndexForName
(
String
parameterName
)
throws
SQLException
{
try
{
checkClosed
();
if
(
namedParameters
==
null
)
{
ResultSetMetaData
meta
=
getCheckedMetaData
();
int
columnCount
=
meta
.
getColumnCount
();
HashMap
<
String
,
Integer
>
map
=
New
.
hashMap
(
columnCount
);
for
(
int
i
=
1
;
i
<=
columnCount
;
i
++)
{
map
.
put
(
meta
.
getColumnLabel
(
i
),
i
);
}
namedParameters
=
map
;
}
Integer
index
=
namedParameters
.
get
(
parameterName
);
if
(
index
==
null
)
{
throw
DbException
.
getInvalidValueException
(
parameterName
,
"parameterName"
);
}
return
index
;
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
}
}
private
JdbcResultSet
getOpenResultSet
()
throws
SQLException
{
try
{
checkClosed
();
if
(
resultSet
==
null
)
{
throw
DbException
.
get
(
ErrorCode
.
NO_DATA_AVAILABLE
);
}
return
resultSet
;
}
catch
(
Exception
e
)
{
throw
logAndConvert
(
e
);
}
}
}
}
h2/src/main/org/h2/jdbc/JdbcPreparedStatement.java
浏览文件 @
5c69455f
...
@@ -945,7 +945,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
...
@@ -945,7 +945,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
*
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param parameterIndex the parameter index (1, 2, ...)
* @param x the value
* @param x the value
* @param length the number of
byte
s
* @param length the number of
character
s
* @throws SQLException if this object is closed
* @throws SQLException if this object is closed
*/
*/
public
void
setCharacterStream
(
int
parameterIndex
,
Reader
x
,
int
length
)
throws
SQLException
{
public
void
setCharacterStream
(
int
parameterIndex
,
Reader
x
,
int
length
)
throws
SQLException
{
...
@@ -972,7 +972,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
...
@@ -972,7 +972,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
*
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param parameterIndex the parameter index (1, 2, ...)
* @param x the value
* @param x the value
* @param length the number of
byte
s
* @param length the number of
character
s
* @throws SQLException if this object is closed
* @throws SQLException if this object is closed
*/
*/
public
void
setCharacterStream
(
int
parameterIndex
,
Reader
x
,
long
length
)
throws
SQLException
{
public
void
setCharacterStream
(
int
parameterIndex
,
Reader
x
,
long
length
)
throws
SQLException
{
...
@@ -1300,7 +1300,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
...
@@ -1300,7 +1300,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
*
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param parameterIndex the parameter index (1, 2, ...)
* @param x the value
* @param x the value
* @param length the number of
byte
s
* @param length the number of
character
s
* @throws SQLException if this object is closed
* @throws SQLException if this object is closed
*/
*/
//## Java 1.6 begin ##
//## Java 1.6 begin ##
...
@@ -1402,6 +1402,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
...
@@ -1402,6 +1402,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
*
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param parameterIndex the parameter index (1, 2, ...)
* @param x the value
* @param x the value
* @param length the number of characters
* @throws SQLException if this object is closed
* @throws SQLException if this object is closed
*/
*/
public
void
setClob
(
int
parameterIndex
,
Reader
x
,
long
length
)
throws
SQLException
{
public
void
setClob
(
int
parameterIndex
,
Reader
x
,
long
length
)
throws
SQLException
{
...
@@ -1454,6 +1455,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
...
@@ -1454,6 +1455,7 @@ public class JdbcPreparedStatement extends JdbcStatement implements PreparedStat
*
*
* @param parameterIndex the parameter index (1, 2, ...)
* @param parameterIndex the parameter index (1, 2, ...)
* @param x the value
* @param x the value
* @param length the number of characters
* @throws SQLException if this object is closed
* @throws SQLException if this object is closed
*/
*/
//## Java 1.6 begin ##
//## Java 1.6 begin ##
...
...
h2/src/main/org/h2/jdbc/JdbcResultSet.java
浏览文件 @
5c69455f
...
@@ -319,7 +319,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -319,7 +319,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
}
}
/**
/**
* Returns the value of the specified column as a
String
.
* Returns the value of the specified column as a
BigDecimal
.
*
*
* @param columnIndex (1,2,...)
* @param columnIndex (1,2,...)
* @return the value
* @return the value
...
@@ -383,11 +383,12 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -383,11 +383,12 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
}
}
/**
/**
* Returns the value of the specified column as a
String
.
* Returns the value of the specified column as a
BigDecimal
.
*
*
* @param columnLabel the column label
* @param columnLabel the column label
* @return the value
* @return the value
* @throws SQLException if the column is not found or if the result set is closed
* @throws SQLException if the column is not found or if the result set is
* closed
*/
*/
public
BigDecimal
getBigDecimal
(
String
columnLabel
)
throws
SQLException
{
public
BigDecimal
getBigDecimal
(
String
columnLabel
)
throws
SQLException
{
try
{
try
{
...
@@ -419,7 +420,8 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -419,7 +420,8 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
*
*
* @param columnLabel the column label
* @param columnLabel the column label
* @return the value
* @return the value
* @throws SQLException if the column is not found or if the result set is closed
* @throws SQLException if the column is not found or if the result set is
* closed
*/
*/
public
Time
getTime
(
String
columnLabel
)
throws
SQLException
{
public
Time
getTime
(
String
columnLabel
)
throws
SQLException
{
try
{
try
{
...
@@ -435,7 +437,8 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -435,7 +437,8 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
*
*
* @param columnLabel the column label
* @param columnLabel the column label
* @return the value
* @return the value
* @throws SQLException if the column is not found or if the result set is closed
* @throws SQLException if the column is not found or if the result set is
* closed
*/
*/
public
Timestamp
getTimestamp
(
String
columnLabel
)
throws
SQLException
{
public
Timestamp
getTimestamp
(
String
columnLabel
)
throws
SQLException
{
try
{
try
{
...
@@ -691,7 +694,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -691,7 +694,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
}
}
/**
/**
* Returns the value of the specified column as a
String
.
* Returns the value of the specified column as a
BigDecimal
.
*
*
* @deprecated
* @deprecated
*
*
...
@@ -716,7 +719,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -716,7 +719,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
}
}
/**
/**
* Returns the value of the specified column as a
String
.
* Returns the value of the specified column as a
BigDecimal
.
*
*
* @deprecated
* @deprecated
*
*
...
@@ -760,7 +763,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -760,7 +763,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
* [Not supported] Gets a column as a object using the specified type
* [Not supported] Gets a column as a object using the specified type
* mapping.
* mapping.
*/
*/
public
Object
getObject
(
int
columnIndex
,
Map
<
String
,
Class
<
?
>>
map
)
throws
SQLException
{
public
Object
getObject
(
int
columnIndex
,
Map
<
String
,
Class
<
?
>>
map
)
throws
SQLException
{
throw
unsupported
(
"map"
);
throw
unsupported
(
"map"
);
}
}
...
@@ -990,7 +993,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -990,7 +993,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
}
}
/**
/**
* Returns the value of the specified column as input stream.
* Returns the value of the specified column as
an
input stream.
*
*
* @param columnIndex (1,2,...)
* @param columnIndex (1,2,...)
* @return the value
* @return the value
...
@@ -1007,7 +1010,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -1007,7 +1010,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
}
}
/**
/**
* Returns the value of the specified column as input stream.
* Returns the value of the specified column as
an
input stream.
*
*
* @param columnLabel the column label
* @param columnLabel the column label
* @return the value
* @return the value
...
@@ -1101,7 +1104,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -1101,7 +1104,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
}
}
/**
/**
* Returns the value of the specified column as input stream.
* Returns the value of the specified column as
an
input stream.
*
*
* @param columnIndex (1,2,...)
* @param columnIndex (1,2,...)
* @return the value
* @return the value
...
@@ -1119,7 +1122,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -1119,7 +1122,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
}
}
/**
/**
* Returns the value of the specified column as input stream.
* Returns the value of the specified column as
an
input stream.
*
*
* @param columnLabel the column label
* @param columnLabel the column label
* @return the value
* @return the value
...
@@ -1137,7 +1140,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -1137,7 +1140,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
}
}
/**
/**
* Returns the value of the specified column as
input stream
.
* Returns the value of the specified column as
a reader
.
*
*
* @param columnIndex (1,2,...)
* @param columnIndex (1,2,...)
* @return the value
* @return the value
...
@@ -1154,7 +1157,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -1154,7 +1157,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
}
}
/**
/**
* Returns the value of the specified column as
input stream
.
* Returns the value of the specified column as
a reader
.
*
*
* @param columnLabel the column label
* @param columnLabel the column label
* @return the value
* @return the value
...
@@ -3286,7 +3289,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -3286,7 +3289,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
//## Java 1.6 end ##
//## Java 1.6 end ##
/**
/**
* Returns the value of the specified column as
input stream
.
* Returns the value of the specified column as
a reader
.
*
*
* @param columnIndex (1,2,...)
* @param columnIndex (1,2,...)
* @return the value
* @return the value
...
@@ -3305,7 +3308,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
...
@@ -3305,7 +3308,7 @@ public class JdbcResultSet extends TraceObject implements ResultSet {
//## Java 1.6 end ##
//## Java 1.6 end ##
/**
/**
* Returns the value of the specified column as
input stream
.
* Returns the value of the specified column as
a reader
.
*
*
* @param columnLabel the column label
* @param columnLabel the column label
* @return the value
* @return the value
...
...
h2/src/test/org/h2/test/jdbc/TestCallableStatement.java
浏览文件 @
5c69455f
...
@@ -14,6 +14,7 @@ import java.sql.Statement;
...
@@ -14,6 +14,7 @@ import java.sql.Statement;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.sql.Types
;
import
java.sql.Types
;
import
org.h2.constant.ErrorCode
;
import
org.h2.test.TestBase
;
import
org.h2.test.TestBase
;
import
org.h2.tools.SimpleResultSet
;
import
org.h2.tools.SimpleResultSet
;
...
@@ -98,6 +99,23 @@ public class TestCallableStatement extends TestBase {
...
@@ -98,6 +99,23 @@ public class TestCallableStatement extends TestBase {
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
// expected exception
// expected exception
}
}
// test for exceptions after closing
call
.
close
();
try
{
call
.
executeUpdate
();
}
catch
(
SQLException
e
)
{
assertEquals
(
ErrorCode
.
OBJECT_CLOSED
,
e
.
getErrorCode
());
}
try
{
call
.
registerOutParameter
(
1
,
Types
.
INTEGER
);
}
catch
(
SQLException
e
)
{
assertEquals
(
ErrorCode
.
OBJECT_CLOSED
,
e
.
getErrorCode
());
}
try
{
call
.
getURL
(
"X"
);
}
catch
(
SQLException
e
)
{
assertEquals
(
ErrorCode
.
OBJECT_CLOSED
,
e
.
getErrorCode
());
}
}
}
/**
/**
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论