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 dj...@apache.org on 2006/03/29 01:44:04 UTC

svn commit: r389630 - in /db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc: EmbedConnection.java EmbedPreparedStatement.java EmbedResultSet.java EmbedStatement.java

Author: djd
Date: Tue Mar 28 15:44:03 2006
New Revision: 389630

URL: http://svn.apache.org/viewcvs?rev=389630&view=rev
Log:
DERBY-1158 (partial) Some cleanup of field & method permissions in the embedded JDBC driver and rename getWarnings to addWarning to
correctly reflect its use.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedPreparedStatement.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java?rev=389630&r1=389629&r2=389630&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedConnection.java Tue Mar 28 15:44:03 2006
@@ -123,10 +123,13 @@
 	private boolean	active;
 	boolean	autoCommit = true;
 	boolean	needCommit;
-	//following is a new feature in JDBC3.0 where you can specify the holdability
-	//of a resultset at the end of the transaction. This gets set by the
-	//new method setHoldability(int) in JDBC3.0
-	int	connectionHoldAbility = JDBC30Translation.HOLD_CURSORS_OVER_COMMIT;
+	/*
+     following is a new feature in JDBC3.0 where you can specify the holdability
+     of a resultset at the end of the transaction. This gets set by the
+	 new method setHoldability(int) in JDBC3.0
+     * 
+	 */
+	private int	connectionHoldAbility = JDBC30Translation.HOLD_CURSORS_OVER_COMMIT;
 
 
 	//////////////////////////////////////////////////////////

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedPreparedStatement.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedPreparedStatement.java?rev=389630&r1=389629&r2=389630&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedPreparedStatement.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedPreparedStatement.java Tue Mar 28 15:44:03 2006
@@ -122,7 +122,7 @@
 			    preparedStatement = lcc.prepareInternalStatement
 				(lcc.getDefaultSchema(), sql, resultSetConcurrency==JDBC20Translation.CONCUR_READ_ONLY, forMetaData);
 			    
-			    getWarnings(preparedStatement.getCompileTimeWarnings());
+			    addWarning(preparedStatement.getCompileTimeWarnings());
 
 			    activation = preparedStatement.getActivation(lcc, resultSetType == JDBC20Translation.TYPE_SCROLL_INSENSITIVE);
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java?rev=389630&r1=389629&r2=389630&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java Tue Mar 28 15:44:03 2006
@@ -116,7 +116,7 @@
 	private Object	currentStream;
 
 	// immutable state
-	protected ResultSet theResults;
+	private ResultSet theResults;
 	private boolean forMetaData;
 	private ResultSetMetaData rMetaData;
 	private SQLWarning topWarning;
@@ -173,9 +173,9 @@
     
     private long timeoutMillis;
 
-	protected final boolean isAtomic;
+	private final boolean isAtomic;
 
-	protected final int concurrencyOfThisResultSet;
+	private final int concurrencyOfThisResultSet;
 
 	//copyOfDatabaseRow will keep the original contents of the columns of the current row which got updated.
 	//These will be used if user decides to cancel the changes made to the row using cancelRowUpdates.
@@ -4166,7 +4166,7 @@
 		be closed (e.g. when executing a server side Java procedure). See bug 4397
 
 	*/
-	public static final SQLException noStateChangeException(Throwable thrownException) {
+	static final SQLException noStateChangeException(Throwable thrownException) {
 
 		// Any exception on a setXXX/getXXX method does not close
 		// the ResultSet or the Statement. So we only need

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java?rev=389630&r1=389629&r2=389630&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java Tue Mar 28 15:44:03 2006
@@ -70,9 +70,9 @@
 	protected String cursorName;
 
 	protected final boolean forMetaData;
-	public final int resultSetType;
-	protected final int resultSetConcurrency;
-	protected final int resultSetHoldability;
+	final int resultSetType;
+	private final int resultSetConcurrency;
+	private final int resultSetHoldability;
 	protected final LanguageConnectionContext lcc;
 
 	private SQLWarning warnings;
@@ -817,7 +817,7 @@
      * ResultSet.CLOSE_CURSORS_AT_COMMIT
      * @exception SQLException Feature not implemented for now.
      */
-    public int getResultSetHoldability() throws SQLException {
+    public final int getResultSetHoldability() throws SQLException {
 		checkStatus();
 		return resultSetHoldability;
 	}
@@ -1134,7 +1134,7 @@
 				// gets it for us, it won't recompile unless it is invalid.
 				PreparedStatement ps = a.getPreparedStatement();
 				ps.rePrepare(lcc);
-				getWarnings(ps.getCompileTimeWarnings());
+				addWarning(ps.getCompileTimeWarnings());
 
 
 				/*
@@ -1150,6 +1150,7 @@
 				{
 					a.setCursorName(cursorName);
 				}
+
 				a.setResultSetHoldability(resultSetHoldability != JDBC30Translation.CLOSE_CURSORS_AT_COMMIT);
 
 				//reset the activation to clear warnings
@@ -1162,7 +1163,7 @@
                                                      executeUpdate,
                                                      false,
                                                      timeoutMillis);
-				getWarnings(a.getWarnings());
+				addWarning(a.getWarnings());
 
 
 				if (resultsToWrap.returnsRows()) {
@@ -1233,7 +1234,14 @@
 		}
 	}
 
-	protected void getWarnings(SQLWarning sw)
+    /**
+     * Add a SQLWarning to this Statement object.
+     * If the Statement already has a SQLWarning then it
+     * is added to the end of the chain.
+     * 
+     * @see #getWarnings()
+     */
+	final void addWarning(SQLWarning sw)
 	{
 		if (sw != null) {
 			if (warnings == null)
@@ -1454,7 +1462,7 @@
 			dynamicResults = sorted;
 
 			if (actualCount > maxDynamicResultSets) {
-				getWarnings(StandardException.newWarning(SQLState.LANG_TOO_MANY_DYNAMIC_RESULTS_RETURNED));
+				addWarning(StandardException.newWarning(SQLState.LANG_TOO_MANY_DYNAMIC_RESULTS_RETURNED));
 
 				for (int i = maxDynamicResultSets; i < actualCount; i++) {
 					sorted[i].close();