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 [7/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/ClientStatement.java (from r1471244, db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java)
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientStatement.java?p2=db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientStatement.java&p1=db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java&r1=1471244&r2=1471245&rev=1471245&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientStatement.java Wed Apr 24 04:37:28 2013
@@ -20,13 +20,20 @@
*/
package org.apache.derby.client.am;
+import java.sql.BatchUpdateException;
+import java.sql.Connection;
+import java.sql.ResultSet;
import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.Statement;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Iterator;
+import java.util.StringTokenizer;
import org.apache.derby.shared.common.reference.SQLState;
import org.apache.derby.shared.common.sanity.SanityManager;
-public class Statement implements java.sql.Statement, StatementCallbackInterface{
+public class ClientStatement implements Statement, StatementCallbackInterface{
/** For use in debugging setLargeMaxRows() method added by JDBC 4.2 */
public static long fetchedRowBase = 0L;
@@ -49,13 +56,13 @@ public class Statement implements java.s
this.materialStatement_ = materialStatement;
}
- Connection connection_;
+ ClientConnection connection_;
public Section section_;
Agent agent_;
/** The owner of this statement, if any. */
- private java.sql.Statement owner = null;
- ResultSet resultSet_;
+ private Statement owner = null;
+ ClientResultSet resultSet_;
// Use -1, if there is no update count returned, ie. when result set is returned. 0 is a valid update count for DDL.
long updateCount_ = -1L;
@@ -135,7 +142,7 @@ public class Statement implements java.s
//private int indexOfCurrentResultSet_ = -1;
protected int indexOfCurrentResultSet_ = -1;
- ResultSet[] resultSetList_ = null; // array of ResultSet objects
+ ClientResultSet[] resultSetList_ = null; // array of ResultSet objects
protected final static String TIMEOUT_STATEMENT = "SET STATEMENT_TIMEOUT ";
protected ArrayList<String> timeoutArrayList = new ArrayList<String>(1);
@@ -162,14 +169,14 @@ public class Statement implements java.s
// Scrollable cursor attributes
- public int resultSetType_ = java.sql.ResultSet.TYPE_FORWARD_ONLY;
- public int resultSetConcurrency_ = java.sql.ResultSet.CONCUR_READ_ONLY;
+ public int resultSetType_ = ResultSet.TYPE_FORWARD_ONLY;
+ public int resultSetConcurrency_ = ResultSet.CONCUR_READ_ONLY;
public int resultSetHoldability_;
// This is ignored by the driver if this is zero.
// For the net forward-only result set, if fetchSize is unset, we let the server return however many rows will fit in a query block.
// For the net scrollable result set, then we use a default of 64 rows.
public int fetchSize_ = 0;
- public int fetchDirection_ = java.sql.ResultSet.FETCH_FORWARD;
+ public int fetchDirection_ = ResultSet.FETCH_FORWARD;
// Conceptually this doesn't belong in Statement, but belongs in PreparedStatement,
// since Statement doesn't know about params, so we're just putting it here perhaps temporarily,
@@ -184,12 +191,12 @@ public class Statement implements java.s
public String cursorAttributesToSendOnPrepare_ = null;
// The following members are for the exclusive use of prepared statements that require auto-generated keys to be returned
- public PreparedStatement preparedStatementForAutoGeneratedKeys_;
- public ResultSet generatedKeysResultSet_;
+ public ClientPreparedStatement preparedStatementForAutoGeneratedKeys_;
+ public ClientResultSet generatedKeysResultSet_;
public String[] generatedKeysColumnNames_;
public int[] generatedKeysColumnIndexes_;
- public int autoGeneratedKeys_ = java.sql.Statement.NO_GENERATED_KEYS;
+ public int autoGeneratedKeys_ = Statement.NO_GENERATED_KEYS;
// This flag makes sure that only one copy of this statement
// will be in connection_.commitListeners_.
@@ -205,7 +212,7 @@ public class Statement implements java.s
//---------------------constructors/finalizer/accessors--------------------
- private Statement() {
+ private ClientStatement() {
initStatement();
}
@@ -217,8 +224,8 @@ public class Statement implements java.s
materialStatement_ = null;
connection_ = null;
agent_ = null;
- resultSetType_ = java.sql.ResultSet.TYPE_FORWARD_ONLY;
- resultSetConcurrency_ = java.sql.ResultSet.CONCUR_READ_ONLY;
+ resultSetType_ = ResultSet.TYPE_FORWARD_ONLY;
+ resultSetConcurrency_ = ResultSet.CONCUR_READ_ONLY;
resultSetHoldability_ = 0;
cursorAttributesToSendOnPrepare_ = null;
if (timeoutArrayList.size() == 0) {
@@ -265,7 +272,7 @@ public class Statement implements java.s
generatedKeysResultSet_ = null;
generatedKeysColumnNames_ = null;
generatedKeysColumnIndexes_ = null;
- autoGeneratedKeys_ = java.sql.Statement.NO_GENERATED_KEYS;
+ autoGeneratedKeys_ = Statement.NO_GENERATED_KEYS;
resetUserControllableAttributes();
}
@@ -281,7 +288,7 @@ public class Statement implements java.s
maxRows_ = 0L; // setMaxRows
maxFieldSize_ = 0; // setMaxFieldSize
fetchSize_ = 0; // setFetchSize
- fetchDirection_ = java.sql.ResultSet.FETCH_FORWARD; // setFetchDirection
+ fetchDirection_ = ResultSet.FETCH_FORWARD; // setFetchDirection
isPoolable = isPreparedStatement_;
// Calls to setEscapeProcessing is currently a noop, nothing to reset.
}
@@ -359,31 +366,49 @@ public class Statement implements java.s
}
}
- public Statement(Agent agent, Connection connection) throws SqlException {
+ public ClientStatement(Agent agent, ClientConnection connection)
+ throws SqlException {
this();
initStatement(agent, connection);
}
- public void resetStatement(Agent agent, Connection connection) throws SqlException {
+ public void resetStatement(Agent agent, ClientConnection connection)
+ throws SqlException {
resetStatement();
initStatement(agent, connection);
}
- private void initStatement(Agent agent, Connection connection) {
+ private void initStatement(Agent agent, ClientConnection connection) {
agent_ = agent;
connection_ = connection;
}
// For jdbc 2 statements with scroll attributes
- public Statement(Agent agent, Connection connection, int type, int concurrency, int holdability,
- int autoGeneratedKeys, String[] columnNames, int[] columnIndexes) throws SqlException {
+ public ClientStatement(
+ Agent agent,
+ ClientConnection connection,
+ int type,
+ int concurrency,
+ int holdability,
+ int autoGeneratedKeys,
+ String[] columnNames,
+ int[] columnIndexes) throws SqlException {
+
this(agent, connection);
initStatement(type, concurrency, holdability, autoGeneratedKeys, columnNames,
columnIndexes);
}
- public void resetStatement(Agent agent, Connection connection, int type, int concurrency, int holdability,
- int autoGeneratedKeys, String[] columnNames, int[] columnIndexes) throws SqlException {
+ public void resetStatement(
+ Agent agent,
+ ClientConnection connection,
+ int type,
+ int concurrency,
+ int holdability,
+ int autoGeneratedKeys,
+ String[] columnNames,
+ int[] columnIndexes) throws SqlException {
+
resetStatement(agent, connection);
initStatement(type, concurrency, holdability, autoGeneratedKeys, columnNames, columnIndexes);
}
@@ -392,9 +417,9 @@ public class Statement implements java.s
int autoGeneratedKeys, String[] columnNames,
int[] columnIndexes) throws SqlException {
switch (type) {
- case java.sql.ResultSet.TYPE_FORWARD_ONLY:
- case java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE:
- case java.sql.ResultSet.TYPE_SCROLL_SENSITIVE:
+ case ResultSet.TYPE_FORWARD_ONLY:
+ case ResultSet.TYPE_SCROLL_INSENSITIVE:
+ case ResultSet.TYPE_SCROLL_SENSITIVE:
resultSetType_ = type;
break;
default:
@@ -404,8 +429,8 @@ public class Statement implements java.s
}
switch (concurrency) {
- case java.sql.ResultSet.CONCUR_READ_ONLY:
- case java.sql.ResultSet.CONCUR_UPDATABLE:
+ case ResultSet.CONCUR_READ_ONLY:
+ case ResultSet.CONCUR_UPDATABLE:
resultSetConcurrency_ = concurrency;
break;
default:
@@ -426,8 +451,8 @@ public class Statement implements java.s
}
switch (autoGeneratedKeys) {
- case java.sql.Statement.NO_GENERATED_KEYS:
- case java.sql.Statement.RETURN_GENERATED_KEYS:
+ case Statement.NO_GENERATED_KEYS:
+ case Statement.RETURN_GENERATED_KEYS:
autoGeneratedKeys_ = autoGeneratedKeys;
break;
default:
@@ -447,7 +472,7 @@ public class Statement implements java.s
* It is different from close() method, which also does clean up on server.
* Changes done as part of DERBY-210.
*/
- protected void finalize() throws java.lang.Throwable {
+ protected void finalize() throws Throwable {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "finalize");
}
@@ -466,14 +491,14 @@ public class Statement implements java.s
// ---------------------------jdbc 1------------------------------------------
- public java.sql.ResultSet executeQuery(String sql) throws SQLException {
+ public ResultSet executeQuery(String sql) throws SQLException {
try
{
synchronized (connection_) {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "executeQuery", sql);
}
- ResultSet resultSet = executeQueryX(sql);
+ ClientResultSet resultSet = executeQueryX(sql);
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceExit(this, "executeQuery", resultSet);
}
@@ -487,7 +512,7 @@ public class Statement implements java.s
}
- private ResultSet executeQueryX(String sql) throws SqlException {
+ private ClientResultSet executeQueryX(String sql) throws SqlException {
flowExecute(executeQueryMethod__, sql);
return resultSet_;
}
@@ -777,7 +802,10 @@ public class Statement implements java.s
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "setLargeMaxRows", maxRows);
}
- checkForClosedStatement(); // Per jdbc spec (see java.sql.Statement.close() javadoc)
+
+ // Per jdbc spec (see Statement.close() javadoc)
+ checkForClosedStatement();
+
if (maxRows < 0) {
throw new SqlException(agent_.logWriter_,
new ClientMessageId(SQLState.INVALID_MAX_ROWS_VALUE),
@@ -799,7 +827,8 @@ public class Statement implements java.s
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "setEscapeProcessing", enable);
}
- checkForClosedStatement(); // Per jdbc spec (see java.sql.Statement.close() javadoc)
+ // Per jdbc spec (see Statement.close() javadoc)
+ checkForClosedStatement();
}
}
catch ( SqlException se )
@@ -830,7 +859,10 @@ public class Statement implements java.s
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "setQueryTimeout", seconds);
}
- checkForClosedStatement(); // Per jdbc spec (see java.sql.Statement.close() javadoc)
+
+ // Per jdbc spec (see Statement.close() javadoc)
+ checkForClosedStatement();
+
if (seconds < 0) {
throw new SqlException(agent_.logWriter_,
new ClientMessageId(SQLState.INVALID_QUERYTIMEOUT_VALUE),
@@ -854,7 +886,10 @@ public class Statement implements java.s
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "cancel");
}
- checkForClosedStatement(); // Per jdbc spec (see java.sql.Statement.close() javadoc)
+
+ // Per jdbc spec (see Statement.close() javadoc)
+ checkForClosedStatement();
+
throw new SqlException(agent_.logWriter_,
new ClientMessageId(SQLState.CANCEL_NOT_SUPPORTED_BY_SERVER));
}
@@ -864,7 +899,7 @@ public class Statement implements java.s
}
}
- public java.sql.SQLWarning getWarnings() throws SQLException {
+ public SQLWarning getWarnings() throws SQLException {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceExit(this, "getWarnings", warnings_);
}
@@ -907,7 +942,10 @@ public class Statement implements java.s
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "setCursorName", name);
}
- checkForClosedStatement(); // Per jdbc spec (see java.sql.Statement.close() javadoc)
+
+ // Per jdbc spec (see Statement.close() javadoc)
+ checkForClosedStatement();
+
if (name == null || name.equals("")) {
throw new SqlException(agent_.logWriter_,
new ClientMessageId(SQLState.CURSOR_INVALID_NAME),
@@ -961,14 +999,17 @@ public class Statement implements java.s
return resultSet_ != null;
}
- public java.sql.ResultSet getResultSet() throws SQLException {
+ public ResultSet getResultSet() throws SQLException {
try
{
synchronized (connection_) {
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "getResultSet");
}
- checkForClosedStatement(); // Per jdbc spec (see java.sql.Statement.close() javadoc)
+
+ // Per jdbc spec (see Statement.close() javadoc)
+ checkForClosedStatement();
+
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceExit(this, "getResultSet", resultSet_);
}
@@ -988,7 +1029,10 @@ public class Statement implements java.s
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "getUpdateCount");
}
- checkForClosedStatement(); // Per jdbc spec (see java.sql.Statement.close() javadoc)
+
+ // Per jdbc spec (see Statement.close() javadoc)
+ checkForClosedStatement();
+
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceExit(this, "getUpdateCount", updateCount_);
}
@@ -1009,7 +1053,10 @@ public class Statement implements java.s
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "getUpdateCount");
}
- checkForClosedStatement(); // Per jdbc spec (see java.sql.Statement.close() javadoc)
+
+ // Per jdbc spec (see Statement.close() javadoc)
+ checkForClosedStatement();
+
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceExit(this, "getUpdateCount", updateCount_);
}
@@ -1051,11 +1098,14 @@ public class Statement implements java.s
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "setFetchDirection", direction);
}
- checkForClosedStatement(); // Per jdbc spec (see java.sql.Statement.close() javadoc)
+
+ // Per jdbc spec (see Statement.close() javadoc)
+ checkForClosedStatement();
+
switch (direction) {
- case java.sql.ResultSet.FETCH_FORWARD:
- case java.sql.ResultSet.FETCH_REVERSE:
- case java.sql.ResultSet.FETCH_UNKNOWN:
+ case ResultSet.FETCH_FORWARD:
+ case ResultSet.FETCH_REVERSE:
+ case ResultSet.FETCH_UNKNOWN:
fetchDirection_ = direction;
break;
default:
@@ -1093,7 +1143,9 @@ public class Statement implements java.s
if (agent_.loggingEnabled()) {
agent_.logWriter_.traceEntry(this, "setFetchSize", rows);
}
- checkForClosedStatement(); // Per jdbc spec (see java.sql.Statement.close() javadoc)
+
+ // Per jdbc spec (see Statement.close() javadoc)
+ checkForClosedStatement();
if (rows < 0 || (maxRows_ != 0 && rows > maxRows_)) {
throw new SqlException(agent_.logWriter_,
@@ -1230,8 +1282,9 @@ public class Statement implements java.s
}
}
- private long[] executeBatchX() throws SqlException, java.sql.BatchUpdateException {
- checkForClosedStatement(); // Per jdbc spec (see java.sql.Statement.close() javadoc)
+ private long[] executeBatchX() throws SqlException, BatchUpdateException {
+ // Per jdbc spec (see Statement.close() javadoc)
+ checkForClosedStatement();
clearWarningsX(); // Per jdbc spec 0.7, and getWarnings() javadoc
resultSetList_ = null;
// Initialize all the updateCounts to indicate failure
@@ -1243,7 +1296,7 @@ public class Statement implements java.s
return updateCounts;
}
- public java.sql.Connection getConnection() throws SQLException {
+ public Connection getConnection() throws SQLException {
try
{
checkForClosedStatement();
@@ -1281,7 +1334,8 @@ public class Statement implements java.s
}
private boolean getMoreResultsX(int current) throws SqlException {
- checkForClosedStatement(); // Per jdbc spec (see java.sql.Statement.close() javadoc)
+ // Per jdbc spec (see Statement.close() javadoc)
+ checkForClosedStatement();
boolean resultIsResultSet;
updateCount_ = -1L;
if (resultSetList_ == null) {
@@ -1318,7 +1372,7 @@ public class Statement implements java.s
return resultIsResultSet;
}
- public java.sql.ResultSet getGeneratedKeys() throws SQLException {
+ public ResultSet getGeneratedKeys() throws SQLException {
try
{
if (agent_.loggingEnabled()) {
@@ -1387,7 +1441,7 @@ public class Statement implements java.s
agent_.logWriter_.traceEntry(this, "executeUpdate", sql, columnIndexes);
}
if (columnIndexes != null && columnIndexes.length > 0)
- autoGeneratedKeys_ = Statement.RETURN_GENERATED_KEYS;
+ autoGeneratedKeys_ = ClientStatement.RETURN_GENERATED_KEYS;
generatedKeysColumnIndexes_ = columnIndexes;
int updateValue = (int) executeUpdateX(sql);
if (agent_.loggingEnabled()) {
@@ -1411,7 +1465,7 @@ public class Statement implements java.s
agent_.logWriter_.traceEntry(this, "executeLargeUpdate", sql, columnIndexes);
}
if (columnIndexes != null && columnIndexes.length > 0)
- autoGeneratedKeys_ = Statement.RETURN_GENERATED_KEYS;
+ autoGeneratedKeys_ = ClientStatement.RETURN_GENERATED_KEYS;
generatedKeysColumnIndexes_ = columnIndexes;
long updateValue = executeUpdateX(sql);
if (agent_.loggingEnabled()) {
@@ -1434,7 +1488,7 @@ public class Statement implements java.s
agent_.logWriter_.traceEntry(this, "executeUpdate", sql, columnNames);
}
if (columnNames != null && columnNames.length > 0)
- autoGeneratedKeys_ = Statement.RETURN_GENERATED_KEYS;
+ autoGeneratedKeys_ = ClientStatement.RETURN_GENERATED_KEYS;
generatedKeysColumnNames_ = columnNames;
int updateValue = (int) executeUpdateX(sql);
if (agent_.loggingEnabled()) {
@@ -1458,7 +1512,7 @@ public class Statement implements java.s
agent_.logWriter_.traceEntry(this, "executeLargeUpdate", sql, columnNames);
}
if (columnNames != null && columnNames.length > 0)
- autoGeneratedKeys_ = Statement.RETURN_GENERATED_KEYS;
+ autoGeneratedKeys_ = ClientStatement.RETURN_GENERATED_KEYS;
generatedKeysColumnNames_ = columnNames;
long updateValue = executeUpdateX(sql);
if (agent_.loggingEnabled()) {
@@ -1502,7 +1556,7 @@ public class Statement implements java.s
agent_.logWriter_.traceEntry(this, "execute", sql, columnIndexes);
}
if (columnIndexes != null && columnIndexes.length > 0)
- autoGeneratedKeys_ = Statement.RETURN_GENERATED_KEYS;
+ autoGeneratedKeys_ = ClientStatement.RETURN_GENERATED_KEYS;
generatedKeysColumnIndexes_ = columnIndexes;
boolean b = executeX(sql);
if (agent_.loggingEnabled()) {
@@ -1525,7 +1579,7 @@ public class Statement implements java.s
agent_.logWriter_.traceEntry(this, "execute", sql, columnNames);
}
if (columnNames != null && columnNames.length > 0)
- autoGeneratedKeys_ = Statement.RETURN_GENERATED_KEYS;
+ autoGeneratedKeys_ = ClientStatement.RETURN_GENERATED_KEYS;
generatedKeysColumnNames_ = columnNames;
boolean b = executeX(sql);
if (agent_.loggingEnabled()) {
@@ -1564,12 +1618,12 @@ public class Statement implements java.s
* Section is needed, and freed when the Statement is closed.
*/
private Section setSpecialRegisterSection_ = null;
- public void writeSetSpecialRegister(java.util.ArrayList sqlsttList)
+ public void writeSetSpecialRegister(ArrayList sqlsttList)
throws SqlException {
if (setSpecialRegisterSection_ == null) {
setSpecialRegisterSection_ =
agent_.sectionManager_.getDynamicSection
- (java.sql.ResultSet.HOLD_CURSORS_OVER_COMMIT);
+ (ResultSet.HOLD_CURSORS_OVER_COMMIT);
}
materialStatement_.writeSetSpecialRegister_(setSpecialRegisterSection_,
sqlsttList);
@@ -1652,7 +1706,7 @@ public class Statement implements java.s
materialStatement_.readOpenQuery_();
}
- public void completeOpenQuery(Sqlca sqlca, ResultSet resultSet) {
+ public void completeOpenQuery(Sqlca sqlca, ClientResultSet resultSet) {
completeSqlca(sqlca);
resultSet_ = resultSet;
// For NET, resultSet_ == null when open query fails and receives OPNQFLRM.
@@ -1686,13 +1740,18 @@ public class Statement implements java.s
// fetchSize of 64 is sent on behalf of the application, so we need to update the fetchSize_
// here to 64.
if (resultSet_.fetchSize_ == 0 &&
- (resultSet_.resultSetType_ == java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE ||
- resultSet_.resultSetType_ == java.sql.ResultSet.TYPE_SCROLL_SENSITIVE)) {
+ (resultSet_.resultSetType_ == ResultSet.TYPE_SCROLL_INSENSITIVE ||
+ resultSet_.resultSetType_ == ResultSet.TYPE_SCROLL_SENSITIVE)) {
resultSet_.setFetchSize_(Configuration.defaultFetchSize);
}
}
- public void completeExecuteCallOpenQuery(Sqlca sqlca, ResultSet resultSet, ColumnMetaData resultSetMetaData, Section generatedSection) {
+ public void completeExecuteCallOpenQuery(
+ Sqlca sqlca,
+ ClientResultSet resultSet,
+ ColumnMetaData resultSetMetaData,
+ Section generatedSection) {
+
resultSet.completeSqlca(sqlca);
// For CallableStatements we can't just clobber the resultSet_ here, must use setResultSetEvent() separately
resultSet.resultSetMetaData_ = resultSetMetaData;
@@ -1740,7 +1799,10 @@ public class Statement implements java.s
materialStatement_.readExecuteCall_();
}
- public void completeExecuteCall(Sqlca sqlca, Cursor singletonParams, ResultSet[] resultSets) {
+ public void completeExecuteCall(
+ Sqlca sqlca,
+ Cursor singletonParams,
+ ClientResultSet[] resultSets) {
completeExecuteCall(sqlca, singletonParams);
resultSetList_ = resultSets;
if (resultSets != null) {
@@ -1803,7 +1865,7 @@ public class Statement implements java.s
*
* @param owner the owning statement, if any
*/
- protected final void setOwner(java.sql.Statement owner) {
+ protected final void setOwner(Statement owner) {
this.owner = owner;
}
@@ -1812,7 +1874,7 @@ public class Statement implements java.s
*
* @return The designated owner of this statement, or {@code null} if none.
*/
- final java.sql.Statement getOwner() {
+ final Statement getOwner() {
return this.owner;
}
@@ -1841,7 +1903,8 @@ public class Statement implements java.s
}
if (connection_.autoCommit_ && requiresAutocommit) { // for the auto-commit;
if (connection_.isXAConnection_) {
- return (connection_.getXAState() == Connection.XA_T0_NOT_ASSOCIATED) ;
+ return connection_.getXAState() ==
+ ClientConnection.XA_T0_NOT_ASSOCIATED;
} else {
return true;
}
@@ -1920,7 +1983,8 @@ public class Statement implements java.s
if (connection_.autoCommit_ && requiresAutocommit && isAutoCommittableStatement_) {
connection_.writeAutoCommit();
if (connection_.isXAConnection_) {
- return (connection_.getXAState() == Connection.XA_T0_NOT_ASSOCIATED) ;
+ return connection_.getXAState() ==
+ ClientConnection.XA_T0_NOT_ASSOCIATED;
} else {
return true;
}
@@ -2151,7 +2215,9 @@ public class Statement implements java.s
}
private void flowExecute(int executeType, String sql) throws SqlException {
- checkForClosedStatement(); // Per jdbc spec (see java.sql.Statement.close() javadoc)
+ // Per jdbc spec (see Statement.close() javadoc)
+ checkForClosedStatement();
+
clearWarningsX(); // Per jdbc spec 0.7, and getWarnings() javadoc
sql = escape(sql);
parseSqlAndSetSqlModes(sql);
@@ -2178,7 +2244,7 @@ public class Statement implements java.s
agent_.beginWriteChain(this);
boolean piggybackedAutoCommit = writeCloseResultSets(true); // true means permit auto-commits
- ResultSet scrollableRS = null;
+ ClientResultSet scrollableRS = null;
Section newSection = null;
boolean repositionedCursor = false;
@@ -2362,7 +2428,8 @@ public class Statement implements java.s
}
}
- void flowExecuteBatch(long[] updateCounts) throws SqlException, java.sql.BatchUpdateException {
+ void flowExecuteBatch(long[] updateCounts)
+ throws SqlException, BatchUpdateException {
SqlException chainBreaker = null;
boolean isCallCataloguedBestGuess = true;
agent_.beginBatchedWriteChain(this);
@@ -2422,7 +2489,7 @@ public class Statement implements java.s
}
} else {
agent_.accumulateReadException(invalidSQLCaughtByClient);
- updateCount_ = java.sql.Statement.EXECUTE_FAILED;
+ updateCount_ = Statement.EXECUTE_FAILED;
invalidSQLCaughtByClient = null;
}
@@ -2479,10 +2546,10 @@ public class Statement implements java.s
public void listenToUnitOfWork() {
} // do nothing for now.
- public void completeLocalCommit(java.util.Iterator listenerIterator) {
+ public void completeLocalCommit(Iterator listenerIterator) {
} // do nothing for now.
- public void completeLocalRollback(java.util.Iterator listenerIterator) {
+ public void completeLocalRollback(Iterator listenerIterator) {
} // do nothing for now.
// This method will not work if e is chained.
@@ -2710,7 +2777,7 @@ public class Statement implements java.s
// the sql is assumed to start with CALL... or ?=CALL...
String getProcedureName(String sql) throws SqlException {
- java.util.StringTokenizer tokenizer = new java.util.StringTokenizer(sql, "\t\n\r\f= (?");
+ StringTokenizer tokenizer = new StringTokenizer(sql, "\t\n\r\f= (?");
if (!tokenizer.hasMoreTokens()) {
throw new SqlException(agent_.logWriter_,
new ClientMessageId(SQLState.NO_TOKENS_IN_SQL_TEXT), sql);
@@ -2919,7 +2986,10 @@ public class Statement implements java.s
int whereIndex = lowerSql.lastIndexOf("where");
if (whereIndex != -1) {
String[] whereCurrentOf = {"where", "current", "of"};
- java.util.StringTokenizer st = new java.util.StringTokenizer(sql.substring(whereIndex));
+
+ StringTokenizer st =
+ new StringTokenizer(sql.substring(whereIndex));
+
while (st.hasMoreTokens()) {
if (st.nextToken().equalsIgnoreCase(whereCurrentOf[0]) &&
st.nextToken().equalsIgnoreCase(whereCurrentOf[1]) &&
@@ -3028,10 +3098,10 @@ public class Statement implements java.s
// buffer at prepare-time.
String cacheCursorAttributesToSendOnPrepare() throws SqlException {
StringBuffer cursorAttributes = new StringBuffer();
- if (resultSetType_ == java.sql.ResultSet.TYPE_SCROLL_SENSITIVE) {
+ if (resultSetType_ == ResultSet.TYPE_SCROLL_SENSITIVE) {
// append "SENSITIVE STATIC SCROLL"
cursorAttributes.append(Configuration.cursorAttribute_SensitiveStatic);
- } else if (resultSetType_ == java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE) {
+ } else if (resultSetType_ == ResultSet.TYPE_SCROLL_INSENSITIVE) {
// if "insensitve, updatable" cursor is asked, then server sends back error
// and we will pass that error back to the user.
// we will not try to catch any errors/warnings here.
@@ -3040,11 +3110,11 @@ public class Statement implements java.s
}
// Default is read-only, forward-only. No attribute needs to be sent.
- if (resultSetConcurrency_ == java.sql.ResultSet.CONCUR_UPDATABLE) {
+ if (resultSetConcurrency_ == ResultSet.CONCUR_UPDATABLE) {
cursorAttributes.append(Configuration.cursorAttribute_ForUpdate); // FOR UPDATE
}
- if ((resultSetHoldability_ == java.sql.ResultSet.HOLD_CURSORS_OVER_COMMIT)) {
+ if ((resultSetHoldability_ == ResultSet.HOLD_CURSORS_OVER_COMMIT)) {
cursorAttributes.append(Configuration.cursorAttribute_WithHold); // WITH HOLD
}
@@ -3061,10 +3131,10 @@ public class Statement implements java.s
String s = "select IDENTITY_VAL_LOCAL() from SYSIBM.SYSDUMMY1";
preparedStatementForAutoGeneratedKeys_ =
connection_.newPreparedStatement_(s,
- java.sql.ResultSet.TYPE_FORWARD_ONLY,
- java.sql.ResultSet.CONCUR_READ_ONLY,
- java.sql.ResultSet.HOLD_CURSORS_OVER_COMMIT,
- java.sql.Statement.NO_GENERATED_KEYS,
+ ResultSet.TYPE_FORWARD_ONLY,
+ ResultSet.CONCUR_READ_ONLY,
+ ResultSet.HOLD_CURSORS_OVER_COMMIT,
+ Statement.NO_GENERATED_KEYS,
null, null);
// need a special case for Derby, since the attribute has to go through the wire.
// This same special casing for Derby is already in place in method PS.cacheCursorAttributesToSendOnPrepare() as called by prepareStatementX().
@@ -3092,8 +3162,8 @@ public class Statement implements java.s
}
void checkAutoGeneratedKeysParameters() throws SqlException {
- if (autoGeneratedKeys_ != java.sql.Statement.NO_GENERATED_KEYS &&
- autoGeneratedKeys_ != java.sql.Statement.RETURN_GENERATED_KEYS) {
+ if (autoGeneratedKeys_ != Statement.NO_GENERATED_KEYS &&
+ autoGeneratedKeys_ != Statement.RETURN_GENERATED_KEYS) {
throw new SqlException(agent_.logWriter_,
new ClientMessageId(SQLState.INVALID_API_PARAMETER),
autoGeneratedKeys_, "autoGeneratedKeys",
@@ -3145,7 +3215,8 @@ public class Statement implements java.s
* @param closingRS The ResultSet to be closed
* @throws SqlException
*/
- public void resultSetCommitting(ResultSet closingRS) throws SqlException {
+ public void resultSetCommitting(ClientResultSet closingRS)
+ throws SqlException {
resultSetCommitting(closingRS, false);
}
@@ -3158,7 +3229,9 @@ public class Statement implements java.s
* is part of a chain of write from client to Server
* @throws SqlException
*/
- public boolean resultSetCommitting(ResultSet closingRS, boolean writeChain) throws SqlException {
+ public boolean resultSetCommitting(
+ ClientResultSet closingRS,
+ boolean writeChain) throws SqlException {
// If the Connection is not in auto commit then this statement completion
// cannot cause a commit.
@@ -3169,7 +3242,7 @@ public class Statement implements java.s
// If so, then no commit. The last result set to close will close the statement.
if (resultSetList_ != null) {
for (int i = 0; i < resultSetList_.length; i++) {
- ResultSet crs = resultSetList_[i];
+ ClientResultSet crs = resultSetList_[i];
if (crs == null)
continue;
if (!crs.openOnClient_)
@@ -3283,7 +3356,7 @@ public class Statement implements java.s
catch (SQLException se) { se.printStackTrace( agent_.getLogWriter() ); }
}
}
- private boolean isOpen( ResultSet rs ) throws SQLException
+ private boolean isOpen( ClientResultSet rs ) throws SQLException
{
return ( (rs != null) && (!rs.isClosed()) );
}
Copied: db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientTypes.java (from r1471244, db/derby/code/trunk/java/client/org/apache/derby/client/am/Types.java)
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientTypes.java?p2=db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientTypes.java&p1=db/derby/code/trunk/java/client/org/apache/derby/client/am/Types.java&r1=1471244&r2=1471245&rev=1471245&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/Types.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ClientTypes.java Wed Apr 24 04:37:28 2013
@@ -20,66 +20,67 @@
*/
package org.apache.derby.client.am;
+import java.sql.Types;
import org.apache.derby.iapi.reference.DRDAConstants;
import org.apache.derby.iapi.reference.JDBC40Translation;
// This enumeration of types represents the typing scheme used by our jdbc driver.
// Once this is finished, we need to review our switches to make sure they are exhaustive
-public class Types {
+public class ClientTypes {
// -------------------------------- Driver types -------------------------------------------------
- public final static int BIT = java.sql.Types.BIT; // -7;
+ public final static int BIT = Types.BIT; // -7;
// Not currently supported as a DERBY column type. Mapped to SMALLINT.
- //public final static int TINYINT = java.sql.Types.TINYINT; // -6;
+ //public final static int TINYINT = Types.TINYINT; // -6;
- public final static int BOOLEAN = java.sql.Types.BOOLEAN; // 16;
+ public final static int BOOLEAN = Types.BOOLEAN; // 16;
- public final static int SMALLINT = java.sql.Types.SMALLINT; // 5;
+ public final static int SMALLINT = Types.SMALLINT; // 5;
- public final static int INTEGER = java.sql.Types.INTEGER; // 4;
+ public final static int INTEGER = Types.INTEGER; // 4;
- public final static int BIGINT = java.sql.Types.BIGINT; // -5;
+ public final static int BIGINT = Types.BIGINT; // -5;
// We type using DOUBLE
- //public final static int FLOAT = java.sql.Types.FLOAT; // 6;
+ //public final static int FLOAT = Types.FLOAT; // 6;
- public final static int REAL = java.sql.Types.REAL; // 7;
+ public final static int REAL = Types.REAL; // 7;
- public final static int DOUBLE = java.sql.Types.DOUBLE; // 8;
+ public final static int DOUBLE = Types.DOUBLE; // 8;
// We type using DECIMAL
- //public final static int NUMERIC = java.sql.Types.NUMERIC; // 2;
+ //public final static int NUMERIC = Types.NUMERIC; // 2;
- public final static int DECIMAL = java.sql.Types.DECIMAL; // 3;
+ public final static int DECIMAL = Types.DECIMAL; // 3;
- public final static int CHAR = java.sql.Types.CHAR; // 1;
+ public final static int CHAR = Types.CHAR; // 1;
- public final static int VARCHAR = java.sql.Types.VARCHAR; // 12;
+ public final static int VARCHAR = Types.VARCHAR; // 12;
- public final static int LONGVARCHAR = java.sql.Types.LONGVARCHAR; // -1;
+ public final static int LONGVARCHAR = Types.LONGVARCHAR; // -1;
- public final static int DATE = java.sql.Types.DATE; // 91;
+ public final static int DATE = Types.DATE; // 91;
- public final static int TIME = java.sql.Types.TIME; // 92;
+ public final static int TIME = Types.TIME; // 92;
- public final static int TIMESTAMP = java.sql.Types.TIMESTAMP; // 93;
+ public final static int TIMESTAMP = Types.TIMESTAMP; // 93;
- public final static int BINARY = java.sql.Types.BINARY; // -2;
+ public final static int BINARY = Types.BINARY; // -2;
- public final static int VARBINARY = java.sql.Types.VARBINARY; // -3;
+ public final static int VARBINARY = Types.VARBINARY; // -3;
- public final static int LONGVARBINARY = java.sql.Types.LONGVARBINARY; // -4;
+ public final static int LONGVARBINARY = Types.LONGVARBINARY; // -4;
- public final static int BLOB = java.sql.Types.BLOB; // 2004;
+ public final static int BLOB = Types.BLOB; // 2004;
- public final static int CLOB = java.sql.Types.CLOB; // 2005;
+ public final static int CLOB = Types.CLOB; // 2005;
- public final static int JAVA_OBJECT = java.sql.Types.JAVA_OBJECT; // 2000;
+ public final static int JAVA_OBJECT = Types.JAVA_OBJECT; // 2000;
// hide the default constructor
- private Types() {
+ private ClientTypes() {
}
static public String getTypeString(int type)
@@ -106,12 +107,12 @@ public class Types {
case VARBINARY: return "VARBINARY";
case VARCHAR: return "VARCHAR";
// Types we don't support:
- case java.sql.Types.ARRAY: return "ARRAY";
- case java.sql.Types.DATALINK: return "DATALINK";
- case java.sql.Types.REF: return "REF";
+ case Types.ARRAY: return "ARRAY";
+ case Types.DATALINK: return "DATALINK";
+ case Types.REF: return "REF";
case JDBC40Translation.ROWID: return "ROWID";
case JDBC40Translation.SQLXML: return "SQLXML";
- case java.sql.Types.STRUCT: return "STRUCT";
+ case Types.STRUCT: return "STRUCT";
// Unknown type:
default: return "<UNKNOWN>";
}
@@ -170,11 +171,11 @@ public class Types {
case DRDAConstants.DB2_SQLTYPE_TIMESTAMP:
return TIMESTAMP;
case DRDAConstants.DB2_SQLTYPE_CLOB: // large object character SBCS/Mixed
- return Types.CLOB;
+ return ClientTypes.CLOB;
case DRDAConstants.DB2_SQLTYPE_BLOB: // large object bytes
- return java.sql.Types.BLOB;
+ return Types.BLOB;
case DRDAConstants.DB2_SQLTYPE_FAKE_UDT: // user defined types
- return java.sql.Types.JAVA_OBJECT;
+ return Types.JAVA_OBJECT;
default:
return 0;
}
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobLocatorInputStream.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobLocatorInputStream.java?rev=1471245&r1=1471244&r2=1471245&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobLocatorInputStream.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobLocatorInputStream.java Wed Apr 24 04:37:28 2013
@@ -22,6 +22,7 @@
package org.apache.derby.client.am;
import java.io.IOException;
+import java.io.InputStream;
import org.apache.derby.shared.common.sanity.SanityManager;
@@ -34,24 +35,24 @@ import org.apache.derby.shared.common.sa
* generating an <code>IOException</code>.
* <p>
* This <code>InputStream</code> implementation is pretty basic. No
- * buffering of data is done. Hence, for efficieny #read(byte[])
+ * buffering of data is done. Hence, for efficiency #read(byte[])
* should be used instead of #read(). Marks are not supported, but it
* should be pretty simple to extend the implementation to support
* this. A more efficient skip implementation should also be
* straight-forward.
*/
-public class ClobLocatorInputStream extends java.io.InputStream {
+public class ClobLocatorInputStream extends InputStream {
/**
* Connection used to read Clob from server.
*/
- private final Connection connection;
+ private final ClientConnection connection;
/**
* The Clob to be accessed.
*/
- private final Clob clob;
+ private final ClientClob clob;
/**
* Current position in the underlying Clob.
@@ -68,7 +69,7 @@ public class ClobLocatorInputStream exte
* @param clob <code>Clob</code> object that contains locator for
* the <code>Clob</code> value on the server.
*/
- public ClobLocatorInputStream(Connection connection, Clob clob)
+ public ClobLocatorInputStream(ClientConnection connection, ClientClob clob)
throws SqlException{
if (SanityManager.DEBUG) {
SanityManager.ASSERT(clob.isLocator());
@@ -90,8 +91,10 @@ public class ClobLocatorInputStream exte
* @param pos the position inside the <code>Clob<code> from which
* the reading must begin.
*/
- public ClobLocatorInputStream(Connection connection, Clob clob, long pos)
- throws SqlException{
+ public ClobLocatorInputStream(
+ ClientConnection connection,
+ ClientClob clob,
+ long pos) throws SqlException{
this(connection, clob);
this.currentPos = pos;
}
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobLocatorOutputStream.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobLocatorOutputStream.java?rev=1471245&r1=1471244&r2=1471245&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobLocatorOutputStream.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobLocatorOutputStream.java Wed Apr 24 04:37:28 2013
@@ -22,6 +22,7 @@
package org.apache.derby.client.am;
import java.io.IOException;
+import java.io.OutputStream;
/**
* An <code>OutputStream</code> that will use an locator to write
@@ -32,20 +33,20 @@ import java.io.IOException;
* generating an <code>IOException</code>.
* <p>
* This <code>OutputStream</code> implementation is pretty basic. No
- * buffering of data is done. Hence, for efficieny #write(byte[])
+ * buffering of data is done. Hence, for efficiency #write(byte[])
* should be used instead of #write(int).
*/
-public class ClobLocatorOutputStream extends java.io.OutputStream {
+public class ClobLocatorOutputStream extends OutputStream {
/**
* Connection used to read Clob from server.
*/
- private final Connection connection;
+ private final ClientConnection connection;
/**
* The Clob to be accessed.
*/
- private final Clob clob;
+ private final ClientClob clob;
/**
* Current position in the underlying Clob.
@@ -65,8 +66,11 @@ public class ClobLocatorOutputStream ext
* @param pos the position in the <code>CLOB</code> value at which
* to start writing; the first position is 1
*/
- public ClobLocatorOutputStream(Connection connection, Clob clob, long pos)
- throws SqlException {
+ public ClobLocatorOutputStream(
+ ClientConnection connection,
+ ClientClob clob,
+ long pos) throws SqlException {
+
if (pos-1 > clob.sqlLength()) {
throw new IndexOutOfBoundsException();
}
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobLocatorReader.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobLocatorReader.java?rev=1471245&r1=1471244&r2=1471245&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobLocatorReader.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobLocatorReader.java Wed Apr 24 04:37:28 2013
@@ -22,6 +22,7 @@
package org.apache.derby.client.am;
import java.io.IOException;
+import java.io.Reader;
import org.apache.derby.shared.common.sanity.SanityManager;
@@ -30,22 +31,22 @@ import org.apache.derby.shared.common.sa
* Clob value from the server.
* <p>
* This <code>Reader</code> implementation is pretty basic. No
- * buffering of data is done. Hence, for efficieny #read(char[])
+ * buffering of data is done. Hence, for efficiency #read(char[])
* should be used instead of #read(). Marks are not supported, but it
* should be pretty simple to extend the implementation to support
* this. A more efficient skip implementation should also be
* straight-forward.
*/
-public class ClobLocatorReader extends java.io.Reader {
+public class ClobLocatorReader extends Reader {
/**
* Connection used to read Clob from server.
*/
- private final Connection connection;
+ private final ClientConnection connection;
/**
* The Clob to be accessed.
*/
- private final Clob clob;
+ private final ClientClob clob;
/**
* Current position in the underlying Clob.
@@ -75,7 +76,7 @@ public class ClobLocatorReader extends j
* @param clob <code>Clob</code> object that contains locator for
* the <code>Clob</code> value on the server.
*/
- public ClobLocatorReader(Connection connection, Clob clob)
+ public ClobLocatorReader(ClientConnection connection, ClientClob clob)
throws SqlException {
if (SanityManager.DEBUG) {
SanityManager.ASSERT(clob.isLocator());
@@ -105,7 +106,7 @@ public class ClobLocatorReader extends j
* retrieved.
* @param len The length in characters of the partial value to be retrieved.
*/
- public ClobLocatorReader(Connection connection, Clob clob,
+ public ClobLocatorReader(ClientConnection connection, ClientClob clob,
long pos, long len) throws SqlException {
if (SanityManager.DEBUG) {
SanityManager.ASSERT(clob.isLocator());
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobLocatorWriter.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobLocatorWriter.java?rev=1471245&r1=1471244&r2=1471245&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobLocatorWriter.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobLocatorWriter.java Wed Apr 24 04:37:28 2013
@@ -22,6 +22,7 @@
package org.apache.derby.client.am;
import java.io.IOException;
+import java.io.Writer;
/**
* An {@code Writer} that will use an locator to write the
@@ -31,16 +32,16 @@ import java.io.IOException;
* buffering of data is done. Hence, for efficiency {@code #write(char[])}
* should be used instead of {@code #write(int)}.
*/
-class ClobLocatorWriter extends java.io.Writer {
+class ClobLocatorWriter extends Writer {
/**
* Connection used to read Clob from server.
*/
- private final Connection connection;
+ private final ClientConnection connection;
/**
* The Clob to be accessed.
*/
- private final Clob clob;
+ private final ClientClob clob;
/**
* Current position in the underlying Clob.
@@ -66,8 +67,11 @@ class ClobLocatorWriter extends java.io.
* @param pos the position in the {@code CLOB} value at which
* to start writing; the first position is 1
*/
- ClobLocatorWriter(Connection connection, Clob clob, long pos)
- throws SqlException {
+ ClobLocatorWriter(
+ ClientConnection connection,
+ ClientClob clob,
+ long pos) throws SqlException {
+
if (pos-1 > clob.sqlLength()) {
throw new IndexOutOfBoundsException();
}
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobOutputStream.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobOutputStream.java?rev=1471245&r1=1471244&r2=1471245&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobOutputStream.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobOutputStream.java Wed Apr 24 04:37:28 2013
@@ -26,10 +26,10 @@ import java.io.OutputStream;
class ClobOutputStream extends OutputStream {
- private Clob clob_;
+ private ClientClob clob_;
private long offset_;
- ClobOutputStream(Clob clob, long offset) throws SqlException {
+ ClobOutputStream(ClientClob clob, long offset) throws SqlException {
clob_ = clob;
offset_ = offset;
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobWriter.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobWriter.java?rev=1471245&r1=1471244&r2=1471245&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobWriter.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobWriter.java Wed Apr 24 04:37:28 2013
@@ -21,14 +21,15 @@
package org.apache.derby.client.am;
+import java.io.IOException;
import java.io.Writer;
import org.apache.derby.shared.common.reference.SQLState;
class ClobWriter extends Writer {
- private final Clob clob_;
+ private final ClientClob clob_;
private long offset_;
- ClobWriter(Clob clob, long offset) throws SqlException {
+ ClobWriter(ClientClob clob, long offset) throws SqlException {
clob_ = clob;
offset_ = offset;
@@ -73,7 +74,7 @@ class ClobWriter extends Writer {
public void flush() {
}
- public void close() throws java.io.IOException {
+ public void close() throws IOException {
}
private void updateClob(StringBuffer sb)
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ColumnMetaData.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/ColumnMetaData.java?rev=1471245&r1=1471244&r2=1471245&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ColumnMetaData.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ColumnMetaData.java Wed Apr 24 04:37:28 2013
@@ -21,7 +21,11 @@
package org.apache.derby.client.am;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
import java.sql.SQLException;
+import java.sql.Types;
+import java.util.ArrayList;
import java.util.Hashtable;
import org.apache.derby.iapi.reference.DRDAConstants;
import org.apache.derby.iapi.reference.JDBC30Translation;
@@ -30,7 +34,7 @@ import org.apache.derby.shared.common.re
// Under JDBC 2, we must new up our parameter meta data as column meta data instances
// Once we move to JDK 1.4 pre-req, create a ResultSetMetaData class and make this class abstract
-public class ColumnMetaData implements java.sql.ResultSetMetaData {
+public class ColumnMetaData implements ResultSetMetaData {
public int columns_;
@@ -85,8 +89,8 @@ public class ColumnMetaData implements j
// For performance only, not part of logical model.
public transient int[][] protocolTypesCache_ = null;
- public transient java.util.Hashtable protocolTypeToOverrideLidMapping_ = null;
- public transient java.util.ArrayList mddOverrideArray_ = null;
+ public transient Hashtable protocolTypeToOverrideLidMapping_ = null;
+ public transient ArrayList mddOverrideArray_ = null;
public transient int[] types_;
public transient int[] clientParamtertype_;
@@ -197,10 +201,10 @@ public class ColumnMetaData implements j
//return true if the SQLTYPE is CHAR, VARCHAR, LOGVARCHAR or CLOB
int type = types_[column - 1];
return
- type == Types.CHAR ||
- type == Types.VARCHAR ||
- type == Types.LONGVARCHAR ||
- type == Types.CLOB;
+ type == ClientTypes.CHAR ||
+ type == ClientTypes.VARCHAR ||
+ type == ClientTypes.LONGVARCHAR ||
+ type == ClientTypes.CLOB;
}
catch ( SqlException e )
{
@@ -241,9 +245,9 @@ public class ColumnMetaData implements j
checkForClosedStatement();
checkForValidColumnIndex(column);
if (nullable_[column - 1]) {
- return java.sql.ResultSetMetaData.columnNullable;
+ return ResultSetMetaData.columnNullable;
} else {
- return java.sql.ResultSetMetaData.columnNoNulls;
+ return ResultSetMetaData.columnNoNulls;
}
}
catch ( SqlException e )
@@ -260,14 +264,14 @@ public class ColumnMetaData implements j
//return true only if the SQLType is SMALLINT, INT, BIGINT, FLOAT, REAL, DOUBLE, NUMERIC OR DECIMAL
int type = types_[column - 1];
return
- type == Types.SMALLINT ||
- type == Types.INTEGER ||
- type == Types.BIGINT ||
- type == java.sql.Types.FLOAT ||
- type == Types.REAL ||
- type == Types.DOUBLE ||
- type == java.sql.Types.NUMERIC ||
- type == Types.DECIMAL;
+ type == ClientTypes.SMALLINT ||
+ type == ClientTypes.INTEGER ||
+ type == ClientTypes.BIGINT ||
+ type == Types.FLOAT ||
+ type == ClientTypes.REAL ||
+ type == ClientTypes.DOUBLE ||
+ type == Types.NUMERIC ||
+ type == ClientTypes.DECIMAL;
}
catch ( SqlException e )
{
@@ -282,21 +286,21 @@ public class ColumnMetaData implements j
checkForValidColumnIndex(column);
int jdbcType = types_[column - 1];
switch (jdbcType) {
- case Types.BOOLEAN:
+ case ClientTypes.BOOLEAN:
return 5;
- case Types.INTEGER:
+ case ClientTypes.INTEGER:
return 11;
- case Types.SMALLINT:
+ case ClientTypes.SMALLINT:
return 6;
- case Types.BIGINT:
+ case ClientTypes.BIGINT:
return 20;
- case Types.REAL:
+ case ClientTypes.REAL:
return 15;
- case Types.DOUBLE:
- case java.sql.Types.FLOAT:
+ case ClientTypes.DOUBLE:
+ case Types.FLOAT:
return 24;
- case Types.DECIMAL:
- case java.sql.Types.NUMERIC:
+ case ClientTypes.DECIMAL:
+ case Types.NUMERIC:
// There are 3 possible cases with respect to finding the correct max width for DECIMAL type.
// 1. If scale = 0, only sign should be added to precision.
// 2. scale = precision, 3 should be added to precision for sign, decimal and an additional char '0'.
@@ -304,23 +308,23 @@ public class ColumnMetaData implements j
int scale = getScale(column);
int precision = getPrecision(column);
return (scale == 0) ? (precision + 1) : ((scale == precision) ? (precision + 3) : (precision + 2));
- case Types.CHAR:
- case Types.VARCHAR:
- case Types.LONGVARCHAR:
- case Types.CLOB:
+ case ClientTypes.CHAR:
+ case ClientTypes.VARCHAR:
+ case ClientTypes.LONGVARCHAR:
+ case ClientTypes.CLOB:
return (int) sqlLength_[column - 1];
- case Types.DATE:
+ case ClientTypes.DATE:
return 10;
- case Types.TIME:
+ case ClientTypes.TIME:
return 8;
- case Types.TIMESTAMP:
+ case ClientTypes.TIMESTAMP:
return 29;
- case Types.JAVA_OBJECT:
+ case ClientTypes.JAVA_OBJECT:
return JDBC30Translation.DEFAULT_COLUMN_DISPLAY_SIZE;
- case Types.BINARY:
- case Types.VARBINARY:
- case Types.LONGVARBINARY:
- case Types.BLOB:
+ case ClientTypes.BINARY:
+ case ClientTypes.VARBINARY:
+ case ClientTypes.LONGVARBINARY:
+ case ClientTypes.BLOB:
// Derby-2425. For long length values, size overflows the int
// range. In such cases, the size is limited to the max. int value
// This behavior is consistent with the same in Embedded mode.
@@ -417,39 +421,39 @@ public class ColumnMetaData implements j
int jdbcType = types_[column - 1];
switch (jdbcType) {
- case Types.BOOLEAN:
+ case ClientTypes.BOOLEAN:
return 1;
- case java.sql.Types.NUMERIC:
- case Types.DECIMAL:
+ case Types.NUMERIC:
+ case ClientTypes.DECIMAL:
return sqlPrecision_[column - 1];
- case Types.SMALLINT:
+ case ClientTypes.SMALLINT:
return 5;
- case Types.INTEGER:
+ case ClientTypes.INTEGER:
return 10;
- case Types.BIGINT:
+ case ClientTypes.BIGINT:
return 19;
- case java.sql.Types.FLOAT:
+ case Types.FLOAT:
return 15;
- case Types.REAL:
+ case ClientTypes.REAL:
return 7; // This is the number of signed digits for IEEE float with mantissa 24, ie. 2^24
- case Types.DOUBLE:
+ case ClientTypes.DOUBLE:
return 15; // This is the number of signed digits for IEEE float with mantissa 24, ie. 2^24
- case Types.CHAR:
- case Types.VARCHAR:
- case Types.LONGVARCHAR:
- case Types.BINARY:
- case Types.VARBINARY:
- case Types.LONGVARBINARY:
- case Types.CLOB:
- case Types.BLOB:
+ case ClientTypes.CHAR:
+ case ClientTypes.VARCHAR:
+ case ClientTypes.LONGVARCHAR:
+ case ClientTypes.BINARY:
+ case ClientTypes.VARBINARY:
+ case ClientTypes.LONGVARBINARY:
+ case ClientTypes.CLOB:
+ case ClientTypes.BLOB:
return (int) sqlLength_[column - 1];
- case Types.DATE:
+ case ClientTypes.DATE:
return 10;
- case Types.TIME:
+ case ClientTypes.TIME:
return 8;
- case Types.TIMESTAMP:
+ case ClientTypes.TIMESTAMP:
return 29;
- case Types.JAVA_OBJECT:
+ case ClientTypes.JAVA_OBJECT:
return JDBC30Translation.UNKNOWN_PRECISION;
default:
throw new SqlException(logWriter_,
@@ -561,21 +565,21 @@ public class ColumnMetaData implements j
return "CLOB";
case DRDAConstants.DB2_SQLTYPE_VARCHAR:
case DRDAConstants.DB2_SQLTYPE_NVARCHAR:
- if (jdbcType == Types.VARBINARY) {
+ if (jdbcType == ClientTypes.VARBINARY) {
return "VARCHAR FOR BIT DATA";
} else {
return "VARCHAR";
}
case DRDAConstants.DB2_SQLTYPE_CHAR:
case DRDAConstants.DB2_SQLTYPE_NCHAR:
- if (jdbcType == Types.BINARY) {
+ if (jdbcType == ClientTypes.BINARY) {
return "CHAR FOR BIT DATA";
} else {
return "CHAR";
}
case DRDAConstants.DB2_SQLTYPE_LONG:
case DRDAConstants.DB2_SQLTYPE_NLONG:
- if (jdbcType == Types.LONGVARBINARY) {
+ if (jdbcType == ClientTypes.LONGVARBINARY) {
return "LONG VARCHAR FOR BIT DATA";
} else {
return "LONG VARCHAR";
@@ -585,10 +589,10 @@ public class ColumnMetaData implements j
return "SBCS";
case DRDAConstants.DB2_SQLTYPE_FLOAT:
case DRDAConstants.DB2_SQLTYPE_NFLOAT:
- if (jdbcType == Types.DOUBLE) {
+ if (jdbcType == ClientTypes.DOUBLE) {
return "DOUBLE";
}
- if (jdbcType == Types.REAL) {
+ if (jdbcType == ClientTypes.REAL) {
return "REAL";
}
case DRDAConstants.DB2_SQLTYPE_DECIMAL:
@@ -626,7 +630,9 @@ public class ColumnMetaData implements j
checkForClosedStatement();
checkForValidColumnIndex(column);
if (sqlxUpdatable_ == null) {
- return (resultSetConcurrency_ == java.sql.ResultSet.CONCUR_READ_ONLY); // If no extended describe, return resultSet's concurrecnty
+ // If no extended describe, return resultSet's concurrency
+ return resultSetConcurrency_ ==
+ ResultSet.CONCUR_READ_ONLY;
}
return sqlxUpdatable_[column - 1] == 0; // PROTOCOL 0 means not updatable, 1 means updatable
}
@@ -642,7 +648,9 @@ public class ColumnMetaData implements j
checkForClosedStatement();
checkForValidColumnIndex(column);
if (sqlxUpdatable_ == null) {
- return (resultSetConcurrency_ == java.sql.ResultSet.CONCUR_UPDATABLE); // If no extended describe, return resultSet's concurrency
+ // If no extended describe, return resultSet's concurrency
+ return resultSetConcurrency_ ==
+ ResultSet.CONCUR_UPDATABLE;
}
return sqlxUpdatable_[column - 1] == 1; // PROTOCOL 0 means not updatable, 1 means updatable
}
@@ -678,52 +686,52 @@ public class ColumnMetaData implements j
int jdbcType = types_[column - 1];
switch (jdbcType) {
- case java.sql.Types.BOOLEAN:
+ case Types.BOOLEAN:
return "java.lang.Boolean";
- case java.sql.Types.BIT:
+ case Types.BIT:
return "java.lang.Boolean";
- case java.sql.Types.TINYINT:
+ case Types.TINYINT:
return "java.lang.Integer";
- case Types.SMALLINT:
+ case ClientTypes.SMALLINT:
return "java.lang.Integer";
- case Types.INTEGER:
+ case ClientTypes.INTEGER:
return "java.lang.Integer";
- case Types.BIGINT:
+ case ClientTypes.BIGINT:
return "java.lang.Long";
- case java.sql.Types.FLOAT:
+ case Types.FLOAT:
return "java.lang.Double";
- case Types.REAL:
+ case ClientTypes.REAL:
return "java.lang.Float";
- case Types.DOUBLE:
+ case ClientTypes.DOUBLE:
return "java.lang.Double";
- case java.sql.Types.NUMERIC:
- case Types.DECIMAL:
+ case Types.NUMERIC:
+ case ClientTypes.DECIMAL:
return "java.math.BigDecimal";
- case Types.CHAR:
- case Types.VARCHAR:
- case Types.LONGVARCHAR:
+ case ClientTypes.CHAR:
+ case ClientTypes.VARCHAR:
+ case ClientTypes.LONGVARCHAR:
return "java.lang.String";
- case Types.DATE:
+ case ClientTypes.DATE:
return "java.sql.Date";
- case Types.TIME:
+ case ClientTypes.TIME:
return "java.sql.Time";
- case Types.TIMESTAMP:
+ case ClientTypes.TIMESTAMP:
return "java.sql.Timestamp";
- case Types.BINARY:
- case Types.VARBINARY:
- case Types.LONGVARBINARY:
+ case ClientTypes.BINARY:
+ case ClientTypes.VARBINARY:
+ case ClientTypes.LONGVARBINARY:
return "byte[]";
- case java.sql.Types.STRUCT:
+ case Types.STRUCT:
return "java.sql.Struct";
- case java.sql.Types.ARRAY:
+ case Types.ARRAY:
return "java.sql.Array";
- case Types.BLOB:
+ case ClientTypes.BLOB:
return "java.sql.Blob";
- case Types.CLOB:
+ case ClientTypes.CLOB:
return "java.sql.Clob";
- case java.sql.Types.REF:
+ case Types.REF:
return "java.sql.Ref";
- case java.sql.Types.JAVA_OBJECT:
+ case Types.JAVA_OBJECT:
return sqlUDTclassName_[ column - 1 ];
default:
throw new SqlException(logWriter_,
@@ -750,7 +758,9 @@ public class ColumnMetaData implements j
// Does OUT parm registration rely on extended describe?
// If the output parameter has been registered, return true, else return false.
public boolean isParameterModeGuessedAsOutput(int parameterIndex) {
- return sqlxParmmode_[parameterIndex - 1] >= java.sql.ParameterMetaData.parameterModeInOut;
+ return
+ sqlxParmmode_[parameterIndex - 1] >=
+ ClientParameterMetaData.parameterModeInOut;
}
public void setLogWriter(LogWriter logWriter) {
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/Configuration.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/Configuration.java?rev=1471245&r1=1471244&r2=1471245&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/Configuration.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/Configuration.java Wed Apr 24 04:37:28 2013
@@ -24,7 +24,10 @@ package org.apache.derby.client.am;
import java.io.IOException;
import java.io.InputStream;
import java.security.AccessController;
+import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
+import java.sql.Connection;
+import java.util.StringTokenizer;
import org.apache.derby.iapi.services.info.ProductGenusNames;
import org.apache.derby.iapi.services.info.ProductVersionHolder;
@@ -97,7 +100,8 @@ public class Configuration {
// --------------------------- connection defaults ---------------------------
// This is the DERBY default and maps to DERBY's "Cursor Stability".
- public final static int defaultIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED;
+ public final static int defaultIsolation =
+ Connection.TRANSACTION_READ_COMMITTED;
// ---------------------------- statement defaults----------------------------
@@ -141,14 +145,14 @@ public class Configuration {
_jreLevel = "1.3.0";
} // ignore it, assume 1.3.0
jreLevel = _jreLevel;
- java.util.StringTokenizer st = new java.util.StringTokenizer(jreLevel, ".");
+ StringTokenizer st = new StringTokenizer(jreLevel, ".");
int jreState = 0;
int _jreLevelMajor = 1;
int _jreLevelMinor = 3;
while (st.hasMoreTokens()) {
int i;
try {
- i = java.lang.Integer.parseInt(st.nextToken()); // get int value
+ i = Integer.parseInt(st.nextToken()); // get int value
} catch (NumberFormatException e) {
i = 0;
}
@@ -177,11 +181,11 @@ public class Configuration {
private static void loadProductVersionHolder() throws SqlException {
try {
dncProductVersionHolder__ = buildProductVersionHolder();
- } catch (java.security.PrivilegedActionException e) {
+ } catch (PrivilegedActionException e) {
throw new SqlException(null,
new ClientMessageId (SQLState.ERROR_PRIVILEGED_ACTION),
e.getException());
- } catch (java.io.IOException ioe) {
+ } catch (IOException ioe) {
throw SqlException.javaException(null, ioe);
}
}
@@ -189,7 +193,7 @@ public class Configuration {
// Create ProductVersionHolder in security block for Java 2 security.
private static ProductVersionHolder buildProductVersionHolder() throws
- java.security.PrivilegedActionException, IOException {
+ PrivilegedActionException, IOException {
return AccessController.doPrivileged(
new PrivilegedExceptionAction<ProductVersionHolder>() {