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 2007/07/31 16:19:52 UTC

svn commit: r561338 - in /db/derby/code/trunk/java/client/org/apache/derby/client/am: Connection.java PreparedStatement.java ResultSet.java Statement.java

Author: djd
Date: Tue Jul 31 07:19:51 2007
New Revision: 561338

URL: http://svn.apache.org/viewvc?view=rev&rev=561338
Log:
Minor cleanup in the client code, make some fields non-public and don't use super to
call a method when not required.

Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/Connection.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/Statement.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/Connection.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/Connection.java?view=diff&rev=561338&r1=561337&r2=561338
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/Connection.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/Connection.java Tue Jul 31 07:19:51 2007
@@ -91,7 +91,7 @@
     // ------------------------dynamic properties---------------------------------
 
     protected boolean open_ = true;
-    protected boolean availableForReuse_ = false;
+    private boolean availableForReuse_ = false;
 
     public int isolation_ = Configuration.defaultIsolation;
     public boolean autoCommit_ = true;
@@ -141,7 +141,7 @@
     public int portNumber_;
     public int clientSSLMode_ = ClientBaseDataSource.SSL_OFF;
 
-    public java.util.Hashtable clientCursorNameCache_ = new java.util.Hashtable();
+    java.util.Hashtable clientCursorNameCache_ = new java.util.Hashtable();
     public boolean canUseCachedConnectBytes_ = false;
     public int commBufferSize_ = 32767;
 

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java?view=diff&rev=561338&r1=561337&r2=561338
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java Tue Jul 31 07:19:51 2007
@@ -1795,7 +1795,7 @@
         materialPreparedStatement_.readExecute_();
     }
 
-    public void writeOpenQuery(Section section,
+    private void writeOpenQuery(Section section,
                                int fetchSize,
                                int resultSetType,
                                int numInputColumns,
@@ -1954,10 +1954,10 @@
         }
     }
 
-    void flowExecute(int executeType) throws SqlException {
-        super.checkForClosedStatement();
-        super.clearWarningsX();
-        super.checkForAppropriateSqlMode(executeType, sqlMode_);
+    private void flowExecute(int executeType) throws SqlException {
+        checkForClosedStatement();
+        clearWarningsX();
+        checkForAppropriateSqlMode(executeType, sqlMode_);
         checkThatAllParametersAreSet();
 
         if (sqlMode_ == isUpdate__) {
@@ -1977,7 +1977,7 @@
 
             agent_.beginWriteChain(this);
 
-            boolean piggybackedAutocommit = super.writeCloseResultSets(true);  // true means permit auto-commits
+            boolean piggybackedAutocommit = writeCloseResultSets(true);  // true means permit auto-commits
 
             int numInputColumns;
             boolean outputExpected;
@@ -2091,7 +2091,7 @@
                 connection_.completeTransactionStart();
             }
 
-            super.markResultSetsClosed(true); // true means remove from list of commit and rollback listeners
+            markResultSetsClosed(true); // true means remove from list of commit and rollback listeners
 
             if (timeoutSent) {
                 readSetSpecialRegister(); // Read response to the EXCSQLSET

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java?view=diff&rev=561338&r1=561337&r2=561338
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java Tue Jul 31 07:19:51 2007
@@ -186,9 +186,9 @@
     // between column not updated and column updated to null.
     private boolean columnUpdated_[];
 
-    public PreparedStatement preparedStatementForUpdate_;
-    public PreparedStatement preparedStatementForDelete_;
-    public PreparedStatement preparedStatementForInsert_;
+    private PreparedStatement preparedStatementForUpdate_;
+    private PreparedStatement preparedStatementForDelete_;
+    private PreparedStatement preparedStatementForInsert_;
 
     // Nesting level of the result set in a stored procedure
     public int nestingLevel_ = -1;

Modified: 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/Statement.java?view=diff&rev=561338&r1=561337&r2=561338
==============================================================================
--- 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/Statement.java Tue Jul 31 07:19:51 2007
@@ -46,11 +46,11 @@
 
     public MaterialStatement materialStatement_ = null;
 
-    public Connection connection_;
+    Connection connection_;
     public Section section_;
-    public Agent agent_;
+    Agent agent_;
 
-    public ResultSet resultSet_ = null;
+    ResultSet resultSet_;
 
     // Use -1, if there is no update count returned, ie. when result set is returned. 0 is a valid update count for DDL.
     int updateCount_ = -1;
@@ -71,7 +71,7 @@
     static final int isUpdate__ = 0x4; // All other sql is categorized as a update DML or DDL.
 
     // sqlUpdateMode_ is only set when the sqlMode_ == isUpdate__
-    public int sqlUpdateMode_ = 0;
+    int sqlUpdateMode_ = 0;
     // Enum for sqlUpdateMode_:
     public final static int isCommitSql__ = 0x1;
     public final static int isRollbackSql__ = 0x2;
@@ -81,7 +81,7 @@
     final static int isUpdateSql__ = 0x80;        // used to recognize "update" for parsing cursorname
 
 
-    public ColumnMetaData resultSetMetaData_; // type information for output sqlda
+    ColumnMetaData resultSetMetaData_; // type information for output sqlda
 
     // these two are used during parsing of literals for call statement.
     // please add a comment desribing what why you can't reuse inputs_ and parameterMetaData_
@@ -90,8 +90,7 @@
     // Caching the Cursor object for reuse.
     public Cursor cachedCursor_ = null;
     public Cursor cachedSingletonRowData_ = null;
-    public boolean isPreparedStatement_ = false;
-    public boolean isCallableStatement_ = false; // we can get rid of this member once we define polymorphic reset() on S/PS/CS
+    boolean isPreparedStatement_ = false;
 
     //---------------------navigational cheat-links-------------------------------
     // Cheat-links are for convenience only, and are not part of the conceptual model.
@@ -99,8 +98,6 @@
     //   Cheat-links should only be defined for invariant state data.
     //   That is, state data that is set by the constructor and never changes.
 
-    // Alias for connection_.databaseMetaData
-    public DatabaseMetaData databaseMetaData_;
 
     //-----------------------------state------------------------------------------
 
@@ -210,7 +207,6 @@
         materialStatement_ = null;
         connection_ = null;
         agent_ = null;
-        databaseMetaData_ = null;
         resultSetType_ = java.sql.ResultSet.TYPE_FORWARD_ONLY;
         resultSetConcurrency_ = java.sql.ResultSet.CONCUR_READ_ONLY;
         resultSetHoldability_ = 0;
@@ -300,7 +296,6 @@
     private void initStatement(Agent agent, Connection connection) {
         agent_ = agent;
         connection_ = connection;
-        databaseMetaData_ = connection.databaseMetaData_;
     }
 
     // For jdbc 2 statements with scroll attributes
@@ -760,7 +755,7 @@
     }
 
     // An untraced version of clearWarnings()
-    public void clearWarningsX() {
+    final void clearWarningsX() {
         warnings_ = null;
     }
 
@@ -1580,7 +1575,7 @@
         readCloseResultSets(allowAutoCommits);
     }
 
-    boolean writeCloseResultSets(boolean allowAutoCommits) throws SqlException {
+    final boolean writeCloseResultSets(boolean allowAutoCommits) throws SqlException {
         int numberOfResultSetsToClose = (resultSetList_ == null) ? 0 : resultSetList_.length;
         return writeCloseResultSets(numberOfResultSetsToClose, allowAutoCommits);
     }
@@ -1636,7 +1631,7 @@
     }
 
     // Helper method for S.flowCloseResultSets() and PS.flowExecute()
-    void readCloseResultSets(boolean allowAutoCommits) throws SqlException {
+    final void readCloseResultSets(boolean allowAutoCommits) throws SqlException {
         int numberOfResultSetsToClose = (resultSetList_ == null) ? 0 : resultSetList_.length;
         readCloseResultSets(numberOfResultSetsToClose, allowAutoCommits);
     }
@@ -1811,7 +1806,7 @@
      * from the commit and rollback listeners list in
      * <code>org.apache.derby.client.am.Connection</code>.
      */
-    void markResultSetsClosed(boolean removeListener) {
+    final void markResultSetsClosed(boolean removeListener) {
         if (resultSetList_ != null) {
             for (int i = 0; i < resultSetList_.length; i++) {
                 if (resultSetList_[i] != null) {
@@ -2335,7 +2330,7 @@
         return new String(charArray);
     }
 
-    void checkForAppropriateSqlMode(int executeType, int sqlMode) throws SqlException {
+    final void checkForAppropriateSqlMode(int executeType, int sqlMode) throws SqlException {
         if (executeType == executeQueryMethod__ && sqlMode == isUpdate__) {
             throw new SqlException(agent_.logWriter_, 
                 new ClientMessageId(SQLState.CANT_USE_EXEC_QUERY_FOR_UPDATE));
@@ -2416,7 +2411,7 @@
         }
     }
 
-    void checkForClosedStatement() throws SqlException {
+    final void checkForClosedStatement() throws SqlException {
         // For some odd reason, there was a JVM hotspot error with Sun's 1.4 JDK
         // when the code was written like this:
         // agent_checkForDeferredExceptions();