db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r416661 - in /db/derby/code/trunk/java: client/org/apache/derby/client/am/ testing/org/apache/derbyTesting/functionTests/master/ testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/ testing/org/apache/derbyTesting/functionTe...
Date Fri, 23 Jun 2006 10:15:15 GMT
Author: kahatlen
Date: Fri Jun 23 03:15:09 2006
New Revision: 416661

URL: http://svn.apache.org/viewvc?rev=416661&view=rev
Log:
DERBY-1036: Embedded and client differ with regard to
Statement.setCursor Name. client will disallow duplicate cursor
names. Embedded will allow it.

and

DERBY-1183: Client java.sql.ResultSet.getCursorName() does not return
the correct cursor name for Statements after the first execution

Patch description:

The problem underlying DERBY-1183 is the following: A Statement (and by
inheritance, PreparedStatement and CallableStatement) will have a
cursor name associated with result set generated by the statement. Such
names are either set by the user (Statement#setCursorName) or assigned
by the system (aka "canned" cursor names in the client driver). In
either case, the user can get at the cursor name attached to a
statement by calling Resultset#getCursorName. This string can be used
to construct the SQL text of positioned update or delete statement.

Currently, when a cursor name is set on a statement, the following
actions are taken (Statement#setCursorName):

1. The statement's string variable cursorName_ is set to the
           new string. This keeps track of the user cursor name set
           for this statement.

2. A cache (clientCursorNameCache) of cursor names set by
the user for this connection is maintained to avoid having
any two identical cursor name for the same statement/result
set. When the cursor name is set, the check is performed
(2a) and the cache is updated with the new cursor name if
all is well (2b).

If the statement (only applies for PreparedStatement and
CallableStatement) already has a DRDA section (ch 7.14)
allocated, the following is also performed:

3. A map (cursor name -> section) is updated.

4. The section associated with this statement gets its
   variable clientCursorName set to the supplied cursor name.

For Statement, this association (steps 3 and 4) is performed at
statement execution time (inside flowExecute, just after the new
section is allocated for a query).

5. Also in flowExecute (of Statement, PreparedStatement) the
cursor (user set or canned) is associated with the result
set (call to mapCursorNameToResultSet).

The symptom of this bug is that the cursor name set for a statement
seems to be lost after one execution of that statement, reverting to a
canned cursor name for executions 2..n.

This happens because the cursor name is actually reset as part of the
next execute on a statement object:

        6. Open result sets for a statement are closed when
flowExecute calls readCloseResultSets. During the closing
of a result set, ResultSet#markClosed calls
statement_.removeClientCursorNameFromCache, which in
addition to removing the user cursor name from the cache
also sets the statements cursorName_ to null, causing it
effectively to be forgotten.

Since #5 happens *after* #6 in flowExecute, the execution still works,
but with a canned cursor instead of the user named cursor (see
mapCursorNameToResultSet).

This "race condition" suggests deferring the setup of mappings and
insertion into the name cache till execution time (*after* the closing
of open result sets on this statement). When studying this I found
there was already a bug filed (DERBY-1036) which advises that we defer
the check of duplicates till execution time, so this patch fixes both
DERBY-1183 and DERBY-1036.

In the patch, Statement#setCursorName now only sets the string
variable cursorName_.

The patch also removes the resetting of cursorName_ in
removeClientCursorNameFromCache, so it won't be forgotten. It is still
removed from the cache when the result set is closed (and current maps
deleted).

Furthermore, it moves #2, #3 and #4 till execution time (flowExecute).
Item #2a is performed at the start of flowExecute, so we can avoid
starting any protocol action if it turns out that we should not
start execution (duplicate name). The actions needed in
Statement#flowExecute and PreparedStatement#flowExecute are similar,
so I factored these out into the methods Statement#
checkForDuplicateCursorName and Statement#setupCursorNameCacheAndMappings.

Next, I removed code from getCursorName which redundantly performs #3
(now always handled at execute time).

CAVEAT: When working on understanding what goes on here, I found that
the Statement finalizer can lead to cursors being released; this is
part of the client side clean-up for statements that are not
explicitly closed (DERBY-210). This can sometimes lead to time
variability in canned cursor names in client driver tests which do not
close statements explicitly. If the canned cursor name occurs in the
canon file, we can see spurious diff due to this. I think we have seen
this in the past. Avoid it by closing statements or by naming the
cursors explicitly.

Finally, I removed work-around code in jdbcapi/checkDataSource.java
for derby-1036 and derby-1183 and updated masters to reflect that the
cursor names are no longer forgotten.

Patch submitted by Dag H. Wanvik.

Modified:
    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
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource30.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource30.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java

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?rev=416661&r1=416660&r2=416661&view=diff
==============================================================================
--- 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 Fri
Jun 23 03:15:09 2006
@@ -1588,6 +1588,15 @@
             updateCount_ = -1;
         }
 
+        // DERBY-1036: Moved check till execute time to comply with embedded
+        // behavior. Since we check here and not in setCursorName, several
+        // statements can have the same cursor name as long as their result
+        // sets are not simultaneously open.
+
+        if (sqlMode_ == isQuery__) {
+            checkForDuplicateCursorName();
+        }
+
             agent_.beginWriteChain(this);
 
             boolean piggybackedAutocommit = super.writeCloseResultSets(true);  // true means
permit auto-commits
@@ -1757,9 +1766,13 @@
                 if (resultSet_ != null) {
                     resultSet_.parseScrollableRowset();
                     //if (resultSet_.scrollable_) resultSet_.getRowCount();
-                    // If client's cursor name is set, map the client's cursor name to the
ResultSet
-                    // Else map the server's cursor name to the ResultSet
-                    mapCursorNameToResultSet();
+
+                    // DERBY-1183: If we set it up earlier, the entry in
+                    // clientCursorNameCache_ gets wiped out by the closing of
+                    // result sets happening during readCloseResultSets above
+                    // because ResultSet#markClosed calls
+                    // Statement#removeClientCursorNameFromCache.
+                    setupCursorNameCacheAndMappings();
                 }
                 break;
 

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?rev=416661&r1=416660&r2=416661&view=diff
==============================================================================
--- 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 Fri Jun 23 03:15:09
2006
@@ -1889,12 +1889,8 @@
                 if (generatedSection_ != null) {
                     return "stored procedure generated cursor:" + generatedSection_.getServerCursorName();
                 }
-                if (statement_.cursorName_ == null) {// cursor name is not in the maps yet.
+                if (statement_.cursorName_ == null) {// cursor name is not assigned yet
                     statement_.cursorName_ = statement_.section_.getServerCursorName();
-                    if (statement_.section_ instanceof Section) {
-                        agent_.sectionManager_.mapCursorNameToQuerySection(statement_.cursorName_,
-                                (Section) statement_.section_);
-                    }
                 }
                 if (agent_.loggingEnabled()) {
                     agent_.logWriter_.traceExit(this, "getCursorName", statement_.cursorName_);

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?rev=416661&r1=416660&r2=416661&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/Statement.java Fri Jun 23 03:15:09
2006
@@ -110,9 +110,10 @@
     // "...where current of <canned-cursor-name>" when user-defined cursor names are
used.
     // Both "canned" cursor names (from our jdbc package set) and user-defined cursor names
are mapped.
     // Statement.cursorName_ is initialized to null until the cursor name is requested or
set.
-    // When set (s.setCursorName()) with a user-defined name, then it is added to the cursor
map at that time;
+    // s.setCursorName()) adds a user-defined name, but it is not
+    // added to the cursor map until execution time (DERBY-1036);
     // When requested (rs.getCursorName()), if the cursor name is still null,
-    // then is given the canned cursor name as defined by our jdbc package set and added
to the cursor map.
+    // then is given the canned cursor name as defined by our jdbc package set.
     // Still need to consider how positioned updates should interact with multiple result
sets from a stored.
     String cursorName_ = null;
 
@@ -824,22 +825,9 @@
                         "setCursorName()", "Statement");
                 }
 
-                // Duplicate cursor names not allowed.
-                if (connection_.clientCursorNameCache_.containsKey(name)) {
-                    throw new SqlException(agent_.logWriter_, 
-                        new ClientMessageId(SQLState.CURSOR_DUPLICATE_NAME), name);
-                }
-                connection_.clientCursorNameCache_.put(name, name);
-
-                // section_ is null for Statement objects.  We will defer the mapping of
cursorName
-                // to section until when the query is executed.
-                if (section_ != null) {
-                    agent_.sectionManager_.mapCursorNameToQuerySection(name, (Section) section_);
+                // DERBY-1036: Duplicate cursor names not allowed, check
+                // deferred till execute time. 
 
-                    // This means we must subtitute the <users-cursor-name> with the
<canned-cursor-name>
-                    // in the pass-thru sql string "...where current of <canned-cursor-name>".
-                    section_.setClientCursorName(name);
-                }
                 cursorName_ = name;
             }
         }
@@ -1893,6 +1881,15 @@
 
         checkForAppropriateSqlMode(executeType, sqlMode_);
 
+        // DERBY-1036: Moved check till execute time to comply with embedded
+        // behavior. Since we check here and not in setCursorName, several
+        // statements can have the same cursor name as long as their result
+        // sets are not simultaneously open.
+
+        if (sqlMode_ == isQuery__) {
+            checkForDuplicateCursorName();
+        }
+
         boolean timeoutSent = false;
 
             agent_.beginWriteChain(this);
@@ -1912,16 +1909,6 @@
             case isQuery__:
                 newSection = agent_.sectionManager_.getDynamicSection(resultSetHoldability_);
 
-                // if client's cursor name is set, map it to the query section in the hashtable
-                // after we obtain the section.
-                if (cursorName_ != null) {
-                    agent_.sectionManager_.mapCursorNameToQuerySection(cursorName_, newSection);
-
-                    // This means we must subtitute the <users-cursor-name> with the
<canned-cursor-name>
-                    // in the pass-thru sql string "...where current of <canned-cursor-name>".
-                    newSection.setClientCursorName(cursorName_);
-                }
-
                 writePrepareDescribeOutput(sql, newSection);
                 writeOpenQuery(newSection,
                         fetchSize_,
@@ -2028,9 +2015,13 @@
                 // no row is returned on open for rowset cursors.
                 if (resultSet_ != null) {
                     resultSet_.parseScrollableRowset();
-                    // If client's cursor name is set, map the client's cursor name to the
ResultSet
-                    // Else map the server's cursor name to the ResultSet
-                    mapCursorNameToResultSet();
+
+                    // DERBY-1183: If we set it up it earlier, the entry in
+                    // clientCursorNameCache_ gets wiped out by the closing of
+                    // result sets happening during readCloseResultSets above
+                    // because ResultSet#markClosed calls
+                    // Statement#removeClientCursorNameFromCache.
+                    setupCursorNameCacheAndMappings();
                 }
 
                 break;
@@ -2411,6 +2402,47 @@
     }
 
 
+    // Two open result sets can not have the same cursor name. 
+    protected void checkForDuplicateCursorName() throws SqlException {
+        if (cursorName_ != null && (connection_.clientCursorNameCache_.
+                                    containsKey(cursorName_))) {
+            throw new SqlException
+                (agent_.logWriter_, 
+                 new ClientMessageId(SQLState.CURSOR_DUPLICATE_NAME), 
+                 cursorName_);
+        }
+    }
+
+
+    // Set up information to be able to handle cursor names:
+    // canned or user named (via setCursorName).
+    protected void setupCursorNameCacheAndMappings() {
+        if (cursorName_ != null) {
+            // The user has set a cursor name for this statement.
+            // This means we must subtitute the <users-cursor-name>
+            // with the <canned-cursor-name> in the pass-thru sql
+            // string "...where current of <canned-cursor-name>"
+            // whenever the result set produced by this statement
+            // is referenced in a positioned update/delete statement.
+            agent_.sectionManager_.mapCursorNameToQuerySection
+                (cursorName_, section_);
+            section_.setClientCursorName(cursorName_);
+            
+            // Update cache to avoid duplicates of user set cursor name.
+            connection_.clientCursorNameCache_.put(cursorName_, 
+                                                   cursorName_);
+        } else {
+	    // canned cursor name
+	    agent_.sectionManager_.mapCursorNameToQuerySection
+                (section_.getServerCursorName(), section_);
+	}
+
+        // If client's cursor name is set, map the client's cursor name to the
+        // result set, else map the server's cursor name to the result set.
+        mapCursorNameToResultSet();
+    }
+
+
     String[] extractCursorNameFromWhereCurrentOf(String sql) {
         String lowerSql = sql.toLowerCase();
         int currentIndex = lowerSql.lastIndexOf("current");
@@ -2631,9 +2663,9 @@
     }
 
     protected void removeClientCursorNameFromCache() {
-        if (cursorName_ != null) {
+        if (cursorName_ != null && 
+                connection_.clientCursorNameCache_.containsKey(cursorName_)) {
             connection_.clientCursorNameCache_.remove(cursorName_);
-            cursorName_ = null;
         }
     }
     

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource.out?rev=416661&r1=416660&r2=416661&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource.out
Fri Jun 23 03:15:09 2006
@@ -441,12 +441,12 @@
 sru1-local-1: ru(SN1) contents {1} {2} {3}
 Expecting downgrade because global transaction sru1-global-2 is using a statement with holdability
true
 sru1-global-2: mismatched Statement connection
-sru1-global-2: ru(SQL_CURLH000C) contents {1} {2} {3}
+sru1-global-2: ru(SN1) contents {1} {2} {3}
 sru2-global-3: mismatched Statement connection
 sru2-global-3: ru(OAK2) contents {1} {2} {3}
 Expecting downgrade because global transaction sru1-global-4 is using a statement with holdability
true
 sru1-global-4: mismatched Statement connection
-sru1-global-4: ru(SQL_CURLH000C) contents {1} {2} {3}
+sru1-global-4: ru(SN1) contents {1} {2} {3}
 Statement State @ GLOBAL 
   getResultSetType() SCROLL_INSENSITIVE
   getResultSetConcurrency() READ_ONLY
@@ -468,11 +468,11 @@
   getFetchSize() 999
   getMaxFieldSize() 137
   getMaxRows() 85
-Params-global-1: ru(SQL_CURLH000C) contents {3}
+Params-global-1: ru(params) contents {3}
 sru1-local-5: mismatched Statement connection
-sru1-local-5: ru(SQL_CURLH000C) contents {1} {2} {3}
+sru1-local-5: ru(SN1) contents {1} {2} {3}
 sru2-local-6: mismatched Statement connection
-sru2-local-6: ru(SQL_CURLN000C) contents {1} {2} {3}
+sru2-local-6: ru(OAK2) contents {1} {2} {3}
 sru3-local-7: mismatched Statement connection
 sru3-local-7: ru(SF3) contents {1} {2} {3}
 Statement State @ LOCAL 
@@ -496,17 +496,17 @@
   getFetchSize() 999
   getMaxFieldSize() 137
   getMaxRows() 85
-Params-local-2: ru(SQL_CURLH000C) contents {3}
+Params-local-2: ru(params) contents {3}
 LOCK TABLE
   xid row 0 lock count 14
   xid row 1 lock count 14
 END LOCK TABLE
 sru1-local-8: mismatched Statement connection
-sru1-local-8: ru(SQL_CURLH000C) contents {1} {2} {3}
+sru1-local-8: ru(SN1) contents {1} {2} {3}
 sru2-local-9: mismatched Statement connection
-sru2-local-9: ru(SQL_CURLN000C) contents {1} {2} {3}
+sru2-local-9: ru(OAK2) contents {1} {2} {3}
 sru3-local-10: mismatched Statement connection
-sru3-local-10: ru(SQL_CURLH000C) contents {1} {2} {3}
+sru3-local-10: ru(SF3) contents {1} {2} {3}
 Statement State @ LOCAL 2 
   getResultSetType() SCROLL_INSENSITIVE
   getResultSetConcurrency() READ_ONLY
@@ -534,7 +534,7 @@
 END LOCK TABLE
 sruBatch update counts : 1  1  2  1 :
 sruBatch: mismatched Statement connection
-sruBatch: ru(SQL_CURLH000C) contents {1} {2} {3} {4} {5} {6} {7} {8}
+sruBatch: ru(sruBatch) contents {1} {2} {3} {4} {5} {6} {7} {8}
 XAConnection.getConnection : getConnection() is not valid on a closed PooledConnection.
 XAResource.start : XAException - XAER_RMFAIL : No current connection.
 XAResource.end : XAException - XAER_RMFAIL : No current connection.

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource30.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource30.out?rev=416661&r1=416660&r2=416661&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource30.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/checkDataSource30.out
Fri Jun 23 03:15:09 2006
@@ -534,12 +534,12 @@
 sru1-local-1: ru(SN1) contents {1} {2} {3}
 Expecting downgrade because global transaction sru1-global-2 is using a statement with holdability
true
 sru1-global-2: mismatched Statement connection
-sru1-global-2: ru(SQL_CURLH000C) contents {1} {2} {3}
+sru1-global-2: ru(SN1) contents {1} {2} {3}
 sru2-global-3: mismatched Statement connection
 sru2-global-3: ru(OAK2) contents {1} {2} {3}
 Expecting downgrade because global transaction sru1-global-4 is using a statement with holdability
true
 sru1-global-4: mismatched Statement connection
-sru1-global-4: ru(SQL_CURLH000C) contents {1} {2} {3}
+sru1-global-4: ru(SN1) contents {1} {2} {3}
 Statement State @ GLOBAL 
   getResultSetType() SCROLL_INSENSITIVE
   getResultSetConcurrency() READ_ONLY
@@ -569,11 +569,11 @@
   Parameter Count 2
     1 type 12
     2 type 12
-Params-global-1: ru(SQL_CURLH000C) contents {3}
+Params-global-1: ru(params) contents {3}
 sru1-local-5: mismatched Statement connection
-sru1-local-5: ru(SQL_CURLH000C) contents {1} {2} {3}
+sru1-local-5: ru(SN1) contents {1} {2} {3}
 sru2-local-6: mismatched Statement connection
-sru2-local-6: ru(SQL_CURLN000C) contents {1} {2} {3}
+sru2-local-6: ru(OAK2) contents {1} {2} {3}
 sru3-local-7: mismatched Statement connection
 sru3-local-7: ru(SF3) contents {1} {2} {3}
 Statement State @ LOCAL 
@@ -605,17 +605,17 @@
   Parameter Count 2
     1 type 12
     2 type 12
-Params-local-2: ru(SQL_CURLH000C) contents {3}
+Params-local-2: ru(params) contents {3}
 LOCK TABLE
   xid row 0 lock count 14
   xid row 1 lock count 14
 END LOCK TABLE
 sru1-local-8: mismatched Statement connection
-sru1-local-8: ru(SQL_CURLH000C) contents {1} {2} {3}
+sru1-local-8: ru(SN1) contents {1} {2} {3}
 sru2-local-9: mismatched Statement connection
-sru2-local-9: ru(SQL_CURLN000C) contents {1} {2} {3}
+sru2-local-9: ru(OAK2) contents {1} {2} {3}
 sru3-local-10: mismatched Statement connection
-sru3-local-10: ru(SQL_CURLH000C) contents {1} {2} {3}
+sru3-local-10: ru(SF3) contents {1} {2} {3}
 Statement State @ LOCAL 2 
   getResultSetType() SCROLL_INSENSITIVE
   getResultSetConcurrency() READ_ONLY
@@ -651,7 +651,7 @@
 END LOCK TABLE
 sruBatch update counts : 1  1  2  1 :
 sruBatch: mismatched Statement connection
-sruBatch: ru(SQL_CURLH000C) contents {1} {2} {3} {4} {5} {6} {7} {8}
+sruBatch: ru(sruBatch) contents {1} {2} {3} {4} {5} {6} {7} {8}
 XAConnection.getConnection : getConnection() is not valid on a closed PooledConnection.
 XAResource.start : XAException - XAER_RMFAIL : No current connection.
 XAResource.end : XAException - XAER_RMFAIL : No current connection.

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource.out?rev=416661&r1=416660&r2=416661&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource.out
Fri Jun 23 03:15:09 2006
@@ -531,7 +531,7 @@
   xid row 1 lock count 12
 END LOCK TABLE
 sruBatch update counts : 1  1  2  1 :
-sruBatch: ru(null) contents {1} {2} {3} {4} {5} {6} {7} {8}
+sruBatch: ru(sruBatch) contents {1} {2} {3} {4} {5} {6} {7} {8}
 XAConnection.getXAResource : No current connection.
 XAConnection.getConnection : No current connection.
 XAResource.start : XAException - No current connection.

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource30.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource30.out?rev=416661&r1=416660&r2=416661&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource30.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/checkDataSource30.out
Fri Jun 23 03:15:09 2006
@@ -660,7 +660,7 @@
   xid row 1 lock count 12
 END LOCK TABLE
 sruBatch update counts : 1  1  2  1 :
-sruBatch: ru(null) contents {1} {2} {3} {4} {5} {6} {7} {8}
+sruBatch: ru(sruBatch) contents {1} {2} {3} {4} {5} {6} {7} {8}
 XAConnection.getXAResource : No current connection.
 XAConnection.getConnection : No current connection.
 XAResource.start : XAException - No current connection.

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java?rev=416661&r1=416660&r2=416661&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/checkDataSource.java
Fri Jun 23 03:15:09 2006
@@ -74,9 +74,6 @@
 	// These tests are exempted from other frameworks
 	private boolean testSimpleDataSource = TestUtil.isEmbeddedFramework();
 	
-	// DERBY-1183 getCursorName not correct after first statement execution
-	private static boolean hasGetCursorNameBug = TestUtil.isDerbyNetClientFramework();
-	
     // DERBY-1326 - Network server may abandon sessions when Derby system is shutdown
     // and this causes intermittent hangs in the client
 	private static boolean hangAfterSystemShutdown = TestUtil.isDerbyNetClientFramework();
@@ -459,6 +456,7 @@
 		sru1.executeUpdate("create table ru(i int)");
 		sru1.executeUpdate("insert into ru values 1,2,3");
 		Statement sruBatch = cs1.createStatement();
+		sruBatch.setCursorName("sruBatch");
 		Statement sruState = createFloatStatementForStateChecking(cs1);
 		PreparedStatement psruState = createFloatStatementForStateChecking(cs1, "select i from
ru where i = ?");
 		CallableStatement csruState = createFloatCallForStateChecking(cs1, "CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY(?,?)");
@@ -792,10 +790,7 @@
 	}
 	protected PreparedStatement createFloatStatementForStateChecking(Connection conn, String
sql) throws SQLException {
 		PreparedStatement s = internalCreateFloatStatementForStateChecking(conn, sql);
-		// Need to make a different cursor name here because of DERBY-1036
-		// client won't allow duplicate name.
-		//s.setCursorName("StokeNewington");
-		s.setCursorName("LondonNW17");
+		s.setCursorName("StokeNewington");
 		s.setFetchDirection(ResultSet.FETCH_REVERSE);
 		s.setFetchSize(888);
 		s.setMaxFieldSize(317);
@@ -806,9 +801,7 @@
 	}
 	protected CallableStatement createFloatCallForStateChecking(Connection conn, String sql)
throws SQLException {
 		CallableStatement s = internalCreateFloatCallForStateChecking(conn, sql);
-		//DERBY-1036 - need a new name
-		//s.setCursorName("StokeNewington");
-		s.setCursorName("districtInLondon");
+		s.setCursorName("StokeNewington");
 		s.setFetchDirection(ResultSet.FETCH_REVERSE);
 		s.setFetchSize(999);
 		s.setMaxFieldSize(137);
@@ -902,13 +895,6 @@
 
 	private static void resultSetQuery(String tag, ResultSet rs) throws SQLException {
 		String cursorName = rs.getCursorName();
-		//	DERBY-1183 client cursor name is not correct.
-		// need to truncate the cursor number of the generated name as it might
-		// not be consistent.
-		if (hasGetCursorNameBug && cursorName.startsWith("SQL_CUR"))
-		{
-			cursorName = cursorName.substring(0,13);
-		}
 		System.out.print(tag + ": ru(" + cursorName + ") contents");
 		SecurityCheck.inspect(rs, "java.sql.ResultSet");
 		while (rs.next()) {



Mime
View raw message