You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by da...@apache.org on 2013/04/24 06:37:31 UTC
svn commit: r1471245 [2/14] - in /db/derby/code/trunk/java:
client/org/apache/derby/client/ client/org/apache/derby/client/am/
client/org/apache/derby/client/am/stmtcache/
client/org/apache/derby/client/net/ client/org/apache/derby/jdbc/
testing/org/ap...
Copied: db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientCallableStatement.java (from r1471244, db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement.java)
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientCallableStatement.java?p2=db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientCallableStatement.java&p1=db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement.java&r1=1471244&r2=1471245&rev=1471245&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientCallableStatement.java Wed Apr 24 04:37:28 2013
@@ -21,20 +21,29 @@
package org.apache.derby.client.am;
+import java.io.InputStream;
import org.apache.derby.client.ClientPooledConnection;
import org.apache.derby.shared.common.reference.SQLState;
import java.io.Reader;
+import java.math.BigDecimal;
+import java.net.URL;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.CallableStatement;
+import java.sql.Clob;
import java.sql.Date;
+import java.sql.PreparedStatement;
+import java.sql.Ref;
import java.sql.SQLException;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Calendar;
+import java.util.Map;
-public class CallableStatement extends PreparedStatement
- implements java.sql.PreparedStatement,
- java.sql.CallableStatement,
- PreparedStatementCallbackInterface {
+public class ClientCallableStatement extends ClientPreparedStatement
+ implements PreparedStatement, CallableStatement,
+ PreparedStatementCallbackInterface {
//---------------------navigational members-----------------------------------
//---------------------navigational cheat-links-------------------------------
@@ -87,27 +96,43 @@ public class CallableStatement extends P
* Occurred and the Close events.
* @throws SqlException
*/
- public CallableStatement(Agent agent,
- Connection connection,
+ public ClientCallableStatement(Agent agent,
+ ClientConnection connection,
String sql,
int type, int concurrency, int holdability,
ClientPooledConnection cpc) throws SqlException {
- super(agent, connection, sql, type, concurrency, holdability, java.sql.Statement.NO_GENERATED_KEYS,
- null, null,cpc);
+ super(agent,
+ connection,
+ sql,
+ type,
+ concurrency,
+ holdability,
+ ClientStatement.NO_GENERATED_KEYS,
+ null,
+ null,
+ cpc);
initCallableStatement();
}
public void resetCallableStatement(Agent agent,
- Connection connection,
+ ClientConnection connection,
String sql,
int type, int concurrency, int holdability) throws SqlException {
- super.resetPreparedStatement(agent, connection, sql, type, concurrency, holdability, java.sql.Statement.NO_GENERATED_KEYS,
- null,null);
+ super.resetPreparedStatement(
+ agent,
+ connection,
+ sql,
+ type,
+ concurrency,
+ holdability,
+ ClientStatement.NO_GENERATED_KEYS,
+ null,
+ null);
initCallableStatement();
}
public void resetCallableStatement(Agent agent,
- Connection connection,
+ ClientConnection connection,
String sql,
Section section) throws SqlException {
super.resetPreparedStatement(agent, connection, sql, section);
@@ -116,7 +141,7 @@ public class CallableStatement extends P
public void resetCallableStatement(Agent agent,
- Connection connection,
+ ClientConnection connection,
String sql,
Section section,
ColumnMetaData parameterMetaData,
@@ -125,7 +150,7 @@ public class CallableStatement extends P
initCallableStatement();
}
- protected void finalize() throws java.lang.Throwable {
+ protected void finalize() throws Throwable {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "finalize");
}
@@ -406,7 +431,8 @@ public class CallableStatement extends P
}
/** @deprecated */
- public java.math.BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException, ArithmeticException {
+ public BigDecimal getBigDecimal(int parameterIndex, int scale)
+ throws SQLException, ArithmeticException {
try
{
synchronized (connection_) {
@@ -415,12 +441,12 @@ public class CallableStatement extends P
}
super.checkForClosedStatement();
checkForValidScale(scale);
- java.math.BigDecimal result;
+ BigDecimal result;
checkGetterPreconditions(parameterIndex);
setWasNull(parameterIndex);
result = wasNullX() ? null : singletonRowData_.getBigDecimal(parameterIndex);
if (result != null) {
- result = result.setScale(scale, java.math.BigDecimal.ROUND_DOWN);
+ result = result.setScale(scale, BigDecimal.ROUND_DOWN);
}
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceDeprecatedExit(this, "getBigDecimal", result);
@@ -434,7 +460,7 @@ public class CallableStatement extends P
}
}
- public java.math.BigDecimal getBigDecimal(int parameterIndex) throws SQLException {
+ public BigDecimal getBigDecimal(int parameterIndex) throws SQLException {
try
{
synchronized (connection_) {
@@ -442,7 +468,7 @@ public class CallableStatement extends P
agent_.logWriter_.traceEntry(this, "getBigDecimal", parameterIndex);
}
super.checkForClosedStatement();
- java.math.BigDecimal result;
+ BigDecimal result;
checkGetterPreconditions(parameterIndex);
setWasNull(parameterIndex);
result = wasNullX() ? null : singletonRowData_.getBigDecimal(parameterIndex);
@@ -623,7 +649,7 @@ public class CallableStatement extends P
return wasNullX() ? null : singletonRowData_.getBytes(parameterIndex);
}
- public java.sql.Blob getBlob(int parameterIndex) throws SQLException {
+ public Blob getBlob(int parameterIndex) throws SQLException {
try
{
synchronized (connection_) {
@@ -633,7 +659,9 @@ public class CallableStatement extends P
super.checkForClosedStatement();
checkGetterPreconditions(parameterIndex);
setWasNull(parameterIndex);
- java.sql.Blob result = wasNullX() ? null : singletonRowData_.getBlob(parameterIndex);
+ Blob result = wasNullX() ? null :
+ singletonRowData_.getBlob(parameterIndex);
+
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceExit(this, "getBlob", result);
}
@@ -646,14 +674,16 @@ public class CallableStatement extends P
}
}
- public java.sql.Clob getClob(int parameterIndex) throws SQLException {
+ public Clob getClob(int parameterIndex) throws SQLException {
try
{
synchronized (connection_) {
super.checkForClosedStatement();
checkGetterPreconditions(parameterIndex);
setWasNull(parameterIndex);
- java.sql.Clob result = wasNullX() ? null : singletonRowData_.getClob(parameterIndex);
+ Clob result = wasNullX() ? null :
+ singletonRowData_.getClob(parameterIndex);
+
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceExit(this, "getClob", result);
}
@@ -666,7 +696,7 @@ public class CallableStatement extends P
}
}
- public java.sql.Array getArray(int parameterIndex) throws SQLException {
+ public Array getArray(int parameterIndex) throws SQLException {
try
{
synchronized (connection_) {
@@ -676,7 +706,9 @@ public class CallableStatement extends P
super.checkForClosedStatement();
checkGetterPreconditions(parameterIndex);
setWasNull(parameterIndex);
- java.sql.Array result = wasNullX() ? null : singletonRowData_.getArray(parameterIndex);
+ Array result = wasNullX() ? null :
+ singletonRowData_.getArray(parameterIndex);
+
if (true) {
throw new SqlException(agent_.logWriter_,
new ClientMessageId(SQLState.JDBC_METHOD_NOT_IMPLEMENTED));
@@ -693,7 +725,7 @@ public class CallableStatement extends P
}
}
- public java.sql.Ref getRef(int parameterIndex) throws SQLException {
+ public Ref getRef(int parameterIndex) throws SQLException {
try
{
synchronized (connection_) {
@@ -703,7 +735,9 @@ public class CallableStatement extends P
super.checkForClosedStatement();
checkGetterPreconditions(parameterIndex);
setWasNull(parameterIndex);
- java.sql.Ref result = wasNullX() ? null : singletonRowData_.getRef(parameterIndex);
+ Ref result = wasNullX() ? null :
+ singletonRowData_.getRef(parameterIndex);
+
if (true) {
throw new SqlException(agent_.logWriter_,
new ClientMessageId(SQLState.JDBC_METHOD_NOT_IMPLEMENTED));
@@ -744,7 +778,7 @@ public class CallableStatement extends P
}
}
- public Object getObject(int parameterIndex, java.util.Map map) throws SQLException {
+ public Object getObject(int parameterIndex, Map map) throws SQLException {
try
{
synchronized (connection_) {
@@ -793,14 +827,14 @@ public class CallableStatement extends P
throw jdbcMethodNotImplemented();
}
- public java.net.URL getURL(int parameterIndex) throws SQLException {
+ public URL getURL(int parameterIndex) throws SQLException {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "getURL", parameterIndex);
}
throw jdbcMethodNotImplemented();
}
- public void setURL(String parameterName, java.net.URL x) throws SQLException {
+ public void setURL(String parameterName, URL x) throws SQLException {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "setURL", parameterName, x);
}
@@ -863,7 +897,8 @@ public class CallableStatement extends P
throw jdbcMethodNotImplemented();
}
- public void setBigDecimal(String parameterName, java.math.BigDecimal x) throws SQLException {
+ public void setBigDecimal(String parameterName, BigDecimal x)
+ throws SQLException {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "setBigDecimal", parameterName, x);
}
@@ -884,35 +919,38 @@ public class CallableStatement extends P
throw jdbcMethodNotImplemented();
}
- public void setDate(String parameterName, java.sql.Date x) throws SQLException {
+ public void setDate(String parameterName, Date x) throws SQLException {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "setDate", parameterName, x);
}
throw jdbcMethodNotImplemented();
}
- public void setTime(String parameterName, java.sql.Time x) throws SQLException {
+ public void setTime(String parameterName, Time x) throws SQLException {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "setTime", parameterName, x);
}
throw jdbcMethodNotImplemented();
}
- public void setTimestamp(String parameterName, java.sql.Timestamp x) throws SQLException {
+ public void setTimestamp(String parameterName, Timestamp x)
+ throws SQLException {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "setTimestamp", parameterName, x);
}
throw jdbcMethodNotImplemented();
}
- public void setAsciiStream(String parameterName, java.io.InputStream x, int length) throws SQLException {
+ public void setAsciiStream(String parameterName, InputStream x, int length)
+ throws SQLException {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "setAsciiStream", parameterName, x, length);
}
throw jdbcMethodNotImplemented();
}
- public void setBinaryStream(String parameterName, java.io.InputStream x, int length) throws SQLException {
+ public void setBinaryStream(String parameterName, InputStream x, int length)
+ throws SQLException {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "setBinaryStream", parameterName, x, length);
}
@@ -940,28 +978,34 @@ public class CallableStatement extends P
throw jdbcMethodNotImplemented();
}
- public void setCharacterStream(String parameterName, java.io.Reader reader, int length) throws SQLException {
+ public void setCharacterStream(String parameterName,
+ Reader reader,
+ int length) throws SQLException {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "setCharacterStream", parameterName, reader, length);
}
throw jdbcMethodNotImplemented();
}
- public void setDate(String parameterName, java.sql.Date x, java.util.Calendar calendar) throws SQLException {
+ public void setDate(String parameterName, Date x, Calendar calendar)
+ throws SQLException {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "setDate", parameterName, x, calendar);
}
throw jdbcMethodNotImplemented();
}
- public void setTime(String parameterName, java.sql.Time x, java.util.Calendar calendar) throws SQLException {
+ public void setTime(String parameterName, Time x, Calendar calendar)
+ throws SQLException {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "setTime", parameterName, x, calendar);
}
throw jdbcMethodNotImplemented();
}
- public void setTimestamp(String parameterName, java.sql.Timestamp x, java.util.Calendar calendar) throws SQLException {
+ public void setTimestamp(String parameterName,
+ Timestamp x,
+ Calendar calendar) throws SQLException {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "setTimestamp", parameterName, x, calendar);
}
@@ -1038,21 +1082,21 @@ public class CallableStatement extends P
throw jdbcMethodNotImplemented();
}
- public java.sql.Date getDate(String parameterName) throws SQLException {
+ public Date getDate(String parameterName) throws SQLException {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "getDate", parameterName);
}
throw jdbcMethodNotImplemented();
}
- public java.sql.Time getTime(String parameterName) throws SQLException {
+ public Time getTime(String parameterName) throws SQLException {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "getTime", parameterName);
}
throw jdbcMethodNotImplemented();
}
- public java.sql.Timestamp getTimestamp(String parameterName) throws SQLException {
+ public Timestamp getTimestamp(String parameterName) throws SQLException {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "getTimestamp", parameterName);
}
@@ -1066,70 +1110,73 @@ public class CallableStatement extends P
throw jdbcMethodNotImplemented();
}
- public java.math.BigDecimal getBigDecimal(String parameterName) throws SQLException {
+ public BigDecimal getBigDecimal(String parameterName) throws SQLException {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "getBigDecimal", parameterName);
}
throw jdbcMethodNotImplemented();
}
- public Object getObject(String parameterName, java.util.Map map) throws SQLException {
+ public Object getObject(String parameterName, Map map) throws SQLException {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "getObject", parameterName, map);
}
throw jdbcMethodNotImplemented();
}
- public java.sql.Ref getRef(String parameterName) throws SQLException {
+ public Ref getRef(String parameterName) throws SQLException {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "getRef", parameterName);
}
throw jdbcMethodNotImplemented();
}
- public java.sql.Blob getBlob(String parameterName) throws SQLException {
+ public Blob getBlob(String parameterName) throws SQLException {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "getBlob", parameterName);
}
throw jdbcMethodNotImplemented();
}
- public java.sql.Clob getClob(String parameterName) throws SQLException {
+ public Clob getClob(String parameterName) throws SQLException {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "getClob", parameterName);
}
throw jdbcMethodNotImplemented();
}
- public java.sql.Array getArray(String parameterName) throws SQLException {
+ public Array getArray(String parameterName) throws SQLException {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "getArray", parameterName);
}
throw jdbcMethodNotImplemented();
}
- public java.sql.Date getDate(String parameterName, java.util.Calendar calendar) throws SQLException {
+ public Date getDate(String parameterName, Calendar calendar)
+ throws SQLException {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "getDate", parameterName, calendar);
}
throw jdbcMethodNotImplemented();
}
- public java.sql.Time getTime(String parameterName, java.util.Calendar calendar) throws SQLException {
+ public Time getTime(String parameterName, Calendar calendar)
+ throws SQLException {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "getTime", parameterName, calendar);
}
throw jdbcMethodNotImplemented();
}
- public java.sql.Timestamp getTimestamp(String parameterName, java.util.Calendar calendar) throws SQLException {
+ public Timestamp getTimestamp(String parameterName, Calendar calendar)
+ throws SQLException {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "getTimestamp", parameterName, calendar);
}
throw jdbcMethodNotImplemented();
}
- public java.net.URL getURL(String parameterName) throws SQLException {
+ public URL getURL(String parameterName) throws SQLException {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "getURL", parameterName);
}
@@ -1181,7 +1228,8 @@ public class CallableStatement extends P
for ( int i = 0; i < cursorParamCount; i++ )
{
- if ( parameterMetaData_.sqlxParmmode_[ i ] == java.sql.ParameterMetaData.parameterModeInOut )
+ if ( parameterMetaData_.sqlxParmmode_[ i ] ==
+ ClientParameterMetaData.parameterModeInOut )
{
int jdbcParamNumber = i + 1;
Object returnArg;
@@ -1198,7 +1246,7 @@ public class CallableStatement extends P
//
// special case to coerce Integer to Short for SMALLINT
//
- if ( parameterMetaData_.types_[ i ] == Types.SMALLINT )
+ if ( parameterMetaData_.types_[ i ] == ClientTypes.SMALLINT )
{
if (returnArg instanceof Integer)
{
@@ -1228,7 +1276,10 @@ public class CallableStatement extends P
}
private void checkForValidOutParameter(int parameterIndex) throws SqlException {
- if (parameterMetaData_ == null || parameterMetaData_.sqlxParmmode_[parameterIndex - 1] < java.sql.ParameterMetaData.parameterModeInOut) {
+ if (parameterMetaData_ == null ||
+ parameterMetaData_.sqlxParmmode_[parameterIndex - 1] <
+ ClientParameterMetaData.parameterModeInOut) {
+
throw new SqlException(agent_.logWriter_,
new ClientMessageId(SQLState.PARAM_NOT_OUT_OR_INOUT),
parameterIndex);
Copied: db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientCallableStatement40.java (from r1471244, db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement40.java)
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientCallableStatement40.java?p2=db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientCallableStatement40.java&p1=db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement40.java&r1=1471244&r2=1471245&rev=1471245&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientCallableStatement40.java Wed Apr 24 04:37:28 2013
@@ -24,6 +24,8 @@ package org.apache.derby.client.am;
import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
+import java.sql.Blob;
+import java.sql.Clob;
import java.sql.Date;
import java.sql.NClob;
import java.sql.RowId;
@@ -35,7 +37,7 @@ import org.apache.derby.client.ClientPoo
import org.apache.derby.shared.common.reference.SQLState;
-public class CallableStatement40 extends CallableStatement {
+public class ClientCallableStatement40 extends ClientCallableStatement {
/**
* Calls the superclass constructor and passes the parameters
@@ -54,8 +56,8 @@ public class CallableStatement40 extends
* Occurred and the Close events.
* @throws SqlException
*/
- public CallableStatement40(Agent agent,
- Connection connection,
+ public ClientCallableStatement40(Agent agent,
+ ClientConnection connection,
String sql,
int type, int concurrency, int holdability,
ClientPooledConnection cpc) throws SqlException {
@@ -100,12 +102,12 @@ public class CallableStatement40 extends
throw SQLExceptionFactory.notImplemented ("setRowId (String, RowId)");
}
- public void setBlob(String parameterName, java.sql.Blob x)
+ public void setBlob(String parameterName, Blob x)
throws SQLException {
throw SQLExceptionFactory.notImplemented("setBlob(String, Blob)");
}
- public void setClob(String parameterName, java.sql.Clob x)
+ public void setClob(String parameterName, Clob x)
throws SQLException {
throw SQLExceptionFactory.notImplemented("setClob(String, Clob)");
}
@@ -306,20 +308,10 @@ public class CallableStatement40 extends
else if ( Date.class.equals( type ) ) { retval = getDate( parameterIndex ); }
else if ( Time.class.equals( type ) ) { retval = getTime( parameterIndex ); }
else if ( Timestamp.class.equals( type ) ) { retval = getTimestamp( parameterIndex ); }
-
- else if ( java.sql.Blob.class.equals( type ) ) {
- retval = getBlob( parameterIndex );
-
- } else if ( java.sql.Clob.class.equals( type ) ) {
- retval = getClob( parameterIndex );
-
- } else if ( type.isArray() &&
- type.getComponentType().equals( byte.class ) ) {
- retval = getBytes( parameterIndex );
-
- } else {
- retval = getObject( parameterIndex );
- }
+ else if ( Blob.class.equals( type ) ) { retval = getBlob( parameterIndex ); }
+ else if ( Clob.class.equals( type ) ) { retval = getClob( parameterIndex ); }
+ else if ( type.isArray() && type.getComponentType().equals( byte.class ) ) { retval = getBytes( parameterIndex ); }
+ else { retval = getObject( parameterIndex ); }
if ( wasNull() ) { retval = null; }
Copied: db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientCallableStatement42.java (from r1471244, db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement42.java)
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientCallableStatement42.java?p2=db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientCallableStatement42.java&p1=db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement42.java&r1=1471244&r2=1471245&rev=1471245&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement42.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientCallableStatement42.java Wed Apr 24 04:37:28 2013
@@ -24,10 +24,9 @@ package org.apache.derby.client.am;
import java.sql.SQLException;
import java.sql.SQLType;
import org.apache.derby.client.ClientPooledConnection;
-import org.apache.derby.shared.common.reference.SQLState;
-public class CallableStatement42 extends CallableStatement40
+public class ClientCallableStatement42 extends ClientCallableStatement40
{
/**
* Calls the superclass constructor and passes the parameters
@@ -46,8 +45,8 @@ public class CallableStatement42 extends
* Occurred and the Close events.
* @throws SqlException
*/
- public CallableStatement42(Agent agent,
- Connection connection,
+ public ClientCallableStatement42(Agent agent,
+ ClientConnection connection,
String sql,
int type, int concurrency, int holdability,
ClientPooledConnection cpc) throws SqlException {
@@ -133,7 +132,7 @@ public class CallableStatement42 extends
}
public void setObject
- ( int parameterIndex, java.lang.Object x, SQLType sqlType )
+ ( int parameterIndex, Object x, SQLType sqlType )
throws SQLException
{
synchronized (connection_) {
@@ -147,7 +146,7 @@ public class CallableStatement42 extends
}
public void setObject
- ( int parameterIndex, java.lang.Object x, SQLType sqlType, int scaleOrLength )
+ ( int parameterIndex, Object x, SQLType sqlType, int scaleOrLength )
throws SQLException
{
synchronized (connection_) {
Copied: db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientClob.java (from r1471244, db/derby/code/trunk/java/client/org/apache/derby/client/am/Clob.java)
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientClob.java?p2=db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientClob.java&p1=db/derby/code/trunk/java/client/org/apache/derby/client/am/Clob.java&r1=1471244&r2=1471245&rev=1471245&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/Clob.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientClob.java Wed Apr 24 04:37:28 2013
@@ -1,6 +1,6 @@
/*
- Derby - Class org.apache.derby.client.am.Clob
+ Derby - Class org.apache.derby.client.am.ClientClob
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -23,13 +23,23 @@ package org.apache.derby.client.am;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
import java.io.Reader;
+import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.sql.Clob;
import java.sql.SQLException;
import org.apache.derby.client.net.EncodedInputStream;
import org.apache.derby.shared.common.reference.SQLState;
-public class Clob extends Lob implements java.sql.Clob {
+/**
+ * This class implements the JDBC {@code java.sql.Clob} interface.
+ */
+public class ClientClob extends Lob implements Clob {
//---------------------navigational members-----------------------------------
//-----------------------------state------------------------------------------
@@ -37,9 +47,9 @@ public class Clob extends Lob implements
// Only used for input purposes. For output, each getXXXStream call
// must generate an independent stream.
- protected java.io.InputStream asciiStream_ = null;
- protected java.io.InputStream unicodeStream_ = null;
- protected java.io.Reader characterStream_ = null;
+ protected InputStream asciiStream_ = null;
+ protected InputStream unicodeStream_ = null;
+ protected Reader characterStream_ = null;
// used for input
// Therefore, we always convert a String to UTF-8 before we flow it for input
@@ -48,7 +58,7 @@ public class Clob extends Lob implements
protected String encoding_ = "UNICODE";
//---------------------constructors/finalizer---------------------------------
- public Clob(Agent agent, String string) {
+ public ClientClob(Agent agent, String string) {
this(agent,
false);
@@ -59,7 +69,7 @@ public class Clob extends Lob implements
}
// CTOR for output, when a btc isn't available; the encoding is
- public Clob(Agent agent,
+ public ClientClob(Agent agent,
byte[] unconvertedBytes,
String charsetName,
int dataOffset) throws SqlException {
@@ -84,7 +94,7 @@ public class Clob extends Lob implements
charsetName);
setSqlLength(string_.length());
dataType_ |= STRING;
- } catch (java.io.UnsupportedEncodingException e) {
+ } catch (UnsupportedEncodingException e) {
throw new SqlException(agent_.logWriter_,
new ClientMessageId(SQLState.UNSUPPORTED_ENCODING),
"byte[]", charsetName + " String", e);
@@ -94,8 +104,8 @@ public class Clob extends Lob implements
// CTOR for ascii/unicode stream input
//"ISO-8859-1", "UTF-8", or "UnicodeBigUnmarked"
- public Clob(Agent agent,
- java.io.InputStream inputStream,
+ public ClientClob(Agent agent,
+ InputStream inputStream,
String encoding,
int length) throws SqlException {
@@ -113,8 +123,8 @@ public class Clob extends Lob implements
} else if (encoding.equals("UnicodeBigUnmarked")) { // "UnicodeBigUnmarked"
try {
characterStream_ =
- new java.io.InputStreamReader(inputStream, "UnicodeBigUnmarked");
- } catch (java.io.UnsupportedEncodingException e) {
+ new InputStreamReader(inputStream, "UnicodeBigUnmarked");
+ } catch (UnsupportedEncodingException e) {
throw new SqlException(agent_.logWriter_,
new ClientMessageId(SQLState.UNSUPPORTED_ENCODING),
"UnicodeBigUnmarked", "InputStreamReader", e);
@@ -125,19 +135,19 @@ public class Clob extends Lob implements
}
/**
- * Create a <code>Clob</code> of unknown length with the specified
+ * Create a <code>ClientClob</code> of unknown length with the specified
* encoding.
*
* This constructor was added to support the JDBC 4 length less overloads.
- * Note that a <code>Clob</code> created with this constructor is made for
- * input to the database only. Do not pass it out to the user!
+ * Note that a <code>ClientClob</code> created with this constructor is
+ * made for input to the database only. Do not pass it out to the user!
*
* @param agent
* @param inputStream the data to insert
* @param encoding encoding to use for characters. Only "ISO-8859-1" is
* allowed.
*/
- public Clob(Agent agent, java.io.InputStream inputStream, String encoding)
+ public ClientClob(Agent agent, InputStream inputStream, String encoding)
throws SqlException {
this(agent,
@@ -155,7 +165,7 @@ public class Clob extends Lob implements
// CTOR for character stream input
// THE ENCODING IS ASSUMED TO BE "UTF-16BE"
- public Clob(Agent agent, java.io.Reader reader, int length) {
+ public ClientClob(Agent agent, Reader reader, int length) {
this(agent,
false);
@@ -166,13 +176,13 @@ public class Clob extends Lob implements
}
/**
- * Create a <code>Clob</code> object for a Clob value stored
+ * Create a <code>ClientClob</code> object for a Clob value stored
* on the server and indentified by <code>locator</code>.
* @param agent context for this <code>Clob</code>
* object (incl. connection).
* @param locator reference id to <code>Clob</code> value on server.
*/
- public Clob(Agent agent, int locator)
+ public ClientClob(Agent agent, int locator)
{
super(agent, false);
locator_ = locator;
@@ -180,16 +190,16 @@ public class Clob extends Lob implements
}
/**
- * Create a <code>Clob</code> of unknown length.
+ * Create a <code>ClientClob</code> of unknown length.
*
* This constructor was added to support the JDBC 4 length less overloads.
- * Note that a <code>Clob</code> created with this constructor is made for
- * input to the database only. Do not pass it out to the user!
+ * Note that a <code>ClientClob</code> created with this constructor is
+ * made for input to the database only. Do not pass it out to the user!
*
* @param agent
* @param reader the data to insert
*/
- public Clob(Agent agent, Reader reader) {
+ public ClientClob(Agent agent, Reader reader) {
this(agent,
isLayerBStreamingPossible( agent ) );
@@ -200,7 +210,7 @@ public class Clob extends Lob implements
dataType_ |= UNICODE_STREAM;
}
- private Clob(Agent agent,
+ private ClientClob(Agent agent,
boolean willBeLayerBStreamed) {
super(agent,
willBeLayerBStreamed);
@@ -238,7 +248,7 @@ public class Clob extends Lob implements
/**
* Returns a copy of the specified substring
* in the <code>CLOB</code> value
- * designated by this <code>Clob</code> object.
+ * designated by this <code>ClientClob</code> object.
* The substring begins at position
* <code>pos</code> and has up to <code>length</code> consecutive
* characters. The starting position must be between 1 and the length
@@ -249,8 +259,9 @@ public class Clob extends Lob implements
* @param pos the first character of the substring to be extracted.
* The first character is at position 1.
* @param length the number of consecutive characters to be copied
- * @return a <code>String</code> that is the specified substring in
- * the <code>CLOB</code> value designated by this <code>Clob</code> object
+ * @return a <code>String</code> that is the specified substring in the
+ * <code>CLOB</code> value designated by this <code>ClientClob</code>
+ * object
* @exception SQLException if there is an error accessing the
* <code>CLOB</code>
@@ -322,7 +333,7 @@ public class Clob extends Lob implements
}
}
- public java.io.Reader getCharacterStream() throws SQLException {
+ public Reader getCharacterStream() throws SQLException {
//call checkValidity to exit by throwing a SQLException if
//the Clob object has been freed by calling free() on it
@@ -335,7 +346,7 @@ public class Clob extends Lob implements
agent_.logWriter_.traceEntry(this, "getCharacterStream");
}
- java.io.Reader retVal = getCharacterStreamX();
+ Reader retVal = getCharacterStreamX();
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceExit(this, "getCharacterStream", retVal);
}
@@ -348,7 +359,7 @@ public class Clob extends Lob implements
}
}
- java.io.Reader getCharacterStreamX() throws SqlException {
+ Reader getCharacterStreamX() throws SqlException {
checkForClosedConnection();
//check is this Lob is locator enabled
@@ -365,10 +376,10 @@ public class Clob extends Lob implements
return characterStream_;
}
- return new java.io.StringReader(string_);
+ return new StringReader(string_);
}
- public java.io.InputStream getAsciiStream() throws SQLException {
+ public InputStream getAsciiStream() throws SQLException {
//call checkValidity to exit by throwing a SQLException if
//the Clob object has been freed by calling free() on it
@@ -381,7 +392,7 @@ public class Clob extends Lob implements
agent_.logWriter_.traceEntry(this, "getAsciiStream");
}
- java.io.InputStream retVal = getAsciiStreamX();
+ InputStream retVal = getAsciiStreamX();
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceExit(this, "getAsciiStream", retVal);
}
@@ -394,7 +405,7 @@ public class Clob extends Lob implements
}
}
- java.io.InputStream getAsciiStreamX() throws SqlException {
+ InputStream getAsciiStreamX() throws SqlException {
checkForClosedConnection();
if (isAsciiStream()) // this Lob is used for input
@@ -411,7 +422,7 @@ public class Clob extends Lob implements
(agent_.connection_,this);
}
else {
- return new AsciiStream(string_, new java.io.StringReader(string_));
+ return new AsciiStream(string_, new StringReader(string_));
}
}
@@ -480,7 +491,7 @@ public class Clob extends Lob implements
return index;
}
- public long position(java.sql.Clob searchstr, long start) throws SQLException {
+ public long position(Clob searchstr, long start) throws SQLException {
//call checkValidity to exit by throwing a SQLException if
//the Clob object has been freed by calling free() on it
@@ -517,7 +528,7 @@ public class Clob extends Lob implements
}
}
- private long positionX(java.sql.Clob searchstr, long start) throws SqlException {
+ private long positionX(Clob searchstr, long start) throws SqlException {
checkForClosedConnection();
if (start <= 0) {
@@ -540,7 +551,7 @@ public class Clob extends Lob implements
//of the given Clob inside the LOB.
index = agent_.connection_.locatorProcedureCall()
.clobGetPositionFromLocator(locator_,
- ((Clob)searchstr).getLocator(),
+ ((ClientClob)searchstr).getLocator(),
start);
} else {
//Locator support is not available.
@@ -553,7 +564,7 @@ public class Clob extends Lob implements
index++;
}
}
- } catch (java.sql.SQLException e) {
+ } catch (SQLException e) {
throw new SqlException(e);
}
return index;
@@ -678,7 +689,7 @@ public class Clob extends Lob implements
return length;
}
- public java.io.OutputStream setAsciiStream(long pos) throws SQLException {
+ public OutputStream setAsciiStream(long pos) throws SQLException {
//call checkValidity to exit by throwing a SQLException if
//the Clob object has been freed by calling free() on it
@@ -690,7 +701,7 @@ public class Clob extends Lob implements
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "setAsciiStream", (int) pos);
}
- java.io.OutputStream outStream = null;
+ OutputStream outStream = null;
if(isLocator()) { // Check to see if the Lob is locator enabled
//The Lob is locator enabled. Return an instance of the
@@ -715,7 +726,7 @@ public class Clob extends Lob implements
}
}
- public java.io.Writer setCharacterStream(long pos) throws SQLException {
+ public Writer setCharacterStream(long pos) throws SQLException {
//call checkValidity to exit by throwing a SQLException if
//the Clob object has been freed by calling free() on it
@@ -727,7 +738,7 @@ public class Clob extends Lob implements
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "setCharacterStream", (int) pos);
}
- java.io.Writer writer = null;
+ Writer writer = null;
//Check to see if this Clob is locator enabled.
if (isLocator()) {
//return an instance of the locator enabled implementation
@@ -924,7 +935,7 @@ public class Clob extends Lob implements
catch(SqlException sqle) {
throw sqle.getSQLException();
}
- retVal = new java.io.StringReader(retVal_str);
+ retVal = new StringReader(retVal_str);
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceExit(this, "getCharacterStream", retVal);
}
@@ -951,7 +962,7 @@ public class Clob extends Lob implements
return ((dataType_ & UNICODE_STREAM) == UNICODE_STREAM);
}
- public java.io.InputStream getUnicodeStream() {
+ public InputStream getUnicodeStream() {
return unicodeStream_;
}
@@ -973,7 +984,7 @@ public class Clob extends Lob implements
try {
utf8String_ = string_.getBytes("UTF-8");
return utf8String_.length;
- } catch (java.io.UnsupportedEncodingException e) {
+ } catch (UnsupportedEncodingException e) {
throw new SqlException(agent_.logWriter_,
new ClientMessageId(SQLState.UNSUPPORTED_ENCODING),
"String", "UTF8 byte[]", e);
@@ -981,13 +992,13 @@ public class Clob extends Lob implements
}
// auxiliary method for position (Clob, long)
- protected Clob createClobWrapper(java.sql.Clob clob) throws SqlException {
+ protected ClientClob createClobWrapper(Clob clob) throws SqlException {
long length;
- java.io.Reader rdr;
+ Reader rdr;
try {
length = clob.length();
- } catch (java.sql.SQLException e) {
+ } catch (SQLException e) {
throw new SqlException(e);
}
@@ -999,19 +1010,19 @@ public class Clob extends Lob implements
try {
rdr = clob.getCharacterStream();
- } catch (java.sql.SQLException e) {
+ } catch (SQLException e) {
throw SqlException.javaException(agent_.logWriter_, e);
}
- return new Clob(this.agent_, rdr, (int) length);
+ return new ClientClob(this.agent_, rdr, (int) length);
}
public void convertFromAsciiToCharacterStream() throws SqlException {
try {
characterStream_ =
- new java.io.InputStreamReader(asciiStream_, "ISO-8859-1");
+ new InputStreamReader(asciiStream_, "ISO-8859-1");
dataType_ = CHARACTER_STREAM;
- } catch (java.io.UnsupportedEncodingException e) {
+ } catch (UnsupportedEncodingException e) {
throw new SqlException(agent_.logWriter_,
new ClientMessageId(SQLState.UNSUPPORTED_ENCODING),
"ISO-8859-1", "CharacterStream", e);
@@ -1035,7 +1046,7 @@ public class Clob extends Lob implements
string_ = newString;
asciiStream_ = new java.io.StringBufferInputStream(string_);
unicodeStream_ = new java.io.StringBufferInputStream(string_);
- characterStream_ = new java.io.StringReader(string_);
+ characterStream_ = new StringReader(string_);
setSqlLength(string_.length());
}
@@ -1063,6 +1074,7 @@ public class Clob extends Lob implements
* this locator based <code>Clob</code> object.
*
* A stored procedure call will be made to get it from the server.
+ * @throws org.apache.derby.client.am.SqlException
* @return length of <code>Clob</code> in bytes
*/
long getLocatorLength() throws SqlException