db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r1373137 - /db/derby/code/branches/10.9/java/drda/org/apache/derby/impl/drda/DRDAStatement.java
Date Tue, 14 Aug 2012 22:06:13 GMT
Author: kmarsden
Date: Tue Aug 14 22:06:13 2012
New Revision: 1373137

URL: http://svn.apache.org/viewvc?rev=1373137&view=rev
Log:
Cleanup code in network server's DRDAStatement class

Merged from trunk with 
svn merge -x -b -c 1371677  https://svn.apache.org/repos/asf/db/derby/code/trunk


Modified:
    db/derby/code/branches/10.9/java/drda/org/apache/derby/impl/drda/DRDAStatement.java

Modified: db/derby/code/branches/10.9/java/drda/org/apache/derby/impl/drda/DRDAStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.9/java/drda/org/apache/derby/impl/drda/DRDAStatement.java?rev=1373137&r1=1373136&r2=1373137&view=diff
==============================================================================
--- db/derby/code/branches/10.9/java/drda/org/apache/derby/impl/drda/DRDAStatement.java (original)
+++ db/derby/code/branches/10.9/java/drda/org/apache/derby/impl/drda/DRDAStatement.java Tue
Aug 14 22:06:13 2012
@@ -73,9 +73,7 @@ class DRDAStatement
 
 	protected Database database;		// Database this statement is created for
 	private   Pkgnamcsn pkgnamcsn;		// Package name/section # and  consistency token
-	protected ConsistencyToken pkgcnstkn;       // Consistency token for the first result set
- 	protected String pkgid;              // package id
- 	protected int pkgsn;		// section number
+    
 	int withHoldCursor = -1;	 // hold cursor after commit attribute.
 	protected int isolationLevel;         //JCC isolation level for Statement
 	protected String cursorName;
@@ -625,10 +623,11 @@ class DRDAStatement
 	/**
 	 * This method is used to initialize the default statement of the database
 	 * for re-use. It is different from reset() method since default statements
-	 * get initiliazed differently. e.g: stmt variable used in default statement
+     * get initialized differently. e.g: stmt variable used in default statement
 	 * is created only once in Database.makeConnection. 
-	 * TODO: Need to see what exactly it means to initialize the default 
-	 * statement. (DERBY-1002)
+     * The default statement will be initialized to have the same byte order 
+     * etc as the server. This may be changed when a TYPEDEFNAM is received 
+     * from the client in DRDAConnThread.setStmtOrDbByteOrder()
 	 * 
 	 */
 	protected void initialize() 
@@ -807,7 +806,7 @@ class DRDAStatement
 		// Store the consistency string for the first ResultSet.
 		// this will be used to calculate consistency strings for the 
 		// other result sets.
-		pkgid = pkgnamcsn.getPkgid();
+        String pkgid = pkgnamcsn.getPkgid();
 
 		if (isDynamicPkgid(pkgid))
 		{
@@ -831,7 +830,7 @@ class DRDAStatement
 			// cursor name
 			// trim the SYS off the pkgid so it wont' be in the cursor name
 			String shortPkgid = pkgid.substring(pkgid.length() -5 , pkgid.length());
-			pkgsn = pkgnamcsn.getPkgsn();
+            int pkgsn = pkgnamcsn.getPkgsn();
 			this.cursorName = "SQL_CUR" +  shortPkgid + "C" + pkgsn ;
 		}
 		else // static package
@@ -839,7 +838,6 @@ class DRDAStatement
 			isolationLevel = getStaticPackageIsolation(pkgid);
 		}
 
-		this.pkgcnstkn = pkgnamcsn.getPkgcnstkn();
 
 	}
 
@@ -914,8 +912,7 @@ class DRDAStatement
 	 */
 	protected void setCurrentDrdaResultSet(Pkgnamcsn pkgnamcsn)
 	{
-		pkgid = pkgnamcsn.getPkgid();
-		pkgsn = pkgnamcsn.getPkgsn();
+        this.pkgnamcsn = pkgnamcsn;
 		ConsistencyToken consistToken = pkgnamcsn.getPkgcnstkn();
 		DRDAResultSet newDrdaRs = getDrdaResultSet(consistToken);
 		if (newDrdaRs != null)
@@ -982,6 +979,7 @@ class DRDAStatement
 				// before we store our new resultSet.
 				// For just a single resultSet we don't ever create the Hashtable.
 				resultSetTable = new Hashtable();
+                ConsistencyToken pkgcnstkn = pkgnamcsn.getPkgcnstkn();
 				resultSetTable.put(pkgcnstkn, currentDrdaRs);
 				resultSetKeyList = new ArrayList();
 				resultSetKeyList.add(0, pkgcnstkn);
@@ -1017,7 +1015,7 @@ class DRDAStatement
 	protected ConsistencyToken getResultSetPkgcnstkn(int rsNum)
 	{
 		if (rsNum == 0)
-			return pkgcnstkn;
+            return pkgnamcsn.getPkgcnstkn();
 		else 
 			return (ConsistencyToken) resultSetKeyList.get(rsNum);			   
 	}
@@ -1387,7 +1385,7 @@ class DRDAStatement
 			s += indent + ps;
 		else
 		{
-			s += indent + pkgid + pkgsn ;
+            s += indent + pkgnamcsn.getPkgid() + pkgnamcsn.getPkgsn() ;
 			s += "\t" + getSQLText();
 		}
 		return s;
@@ -1404,9 +1402,9 @@ class DRDAStatement
 
 	protected ConsistencyToken calculateResultSetPkgcnstkn(int rsNum)
 	{	
-		ConsistencyToken consistToken = pkgcnstkn;
+        ConsistencyToken consistToken = pkgnamcsn.getPkgcnstkn();
 
-		if (rsNum == 0 || pkgcnstkn == null)
+        if (rsNum == 0 || consistToken == null)
 			return consistToken;
 		else
 		{
@@ -1656,6 +1654,7 @@ class DRDAStatement
         
 		//First, check if holdability was passed as a SQL attribute "WITH HOLD" for this prepare.
If yes, then withHoldCursor
 		//should not get overwritten by holdability from package name and that is why the check
for -1
+        String pkgid = pkgnamcsn.getPkgid();
 		if (isDynamicPkgid(pkgid))
 		{       
 			if(pkgid.charAt(4) == 'N')



Mime
View raw message