db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r1370674 [7/12] - in /db/derby/code/trunk/java/drda/org/apache/derby: drda/ impl/drda/
Date Wed, 08 Aug 2012 06:54:47 GMT
Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAProtocolException.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAProtocolException.java?rev=1370674&r1=1370673&r2=1370674&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAProtocolException.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAProtocolException.java Wed Aug  8 06:54:46 2012
@@ -22,10 +22,10 @@
 /*
 
 /**
-	DRDAProtocolException is the root of all protocol exceptions that are 
-	handled in a standard fashion by the DRDA AS.
-	If a protocol error message needs to send more than 
-	SVRCOD, an ERRCD and CODPNT arg it should be subclassed
+    DRDAProtocolException is the root of all protocol exceptions that are 
+    handled in a standard fashion by the DRDA AS.
+    If a protocol error message needs to send more than 
+    SVRCOD, an ERRCD and CODPNT arg it should be subclassed
 
 */
 
@@ -35,358 +35,358 @@ import org.apache.derby.iapi.services.sa
 
 class DRDAProtocolException extends Exception
 {
-	
-	/* Static values, used in constructor if there is no associated 
-	   Error Code or the codepoint argument.
-	*/
-	
-	protected static final int NO_ASSOC_ERRCD = 0;
-	protected static final int NO_CODPNT_ARG  = 0;
-
-	
-	private DRDAConnThread agent;
-
-	// request correlation id
-	private int correlationID;
-	
-	// correlation token
-	private byte[] crrtkn;
-
-	//Codepoint arg
-	private int codpntArg;
-
-	private DRDAProtocolExceptionInfo exceptionInfo;
-
-	// CodePoint of this error
-	private int errorCodePoint;
-	
-	// Severity Code
-	private int svrcod;
-	
-	// error code (e.g. SYNERRCD)
-	private int errcd;
-	
-	// messageid for logging errors.
-	private String  messageid;
-
-	// database name
-	private String rdbnam;
-	
-	// database diagnostic information
-	private String srvdgn;
-
-	// message arguments
-	private Object [] messageArgs;
-	
-	// A verbose error message string, will be helpful
-	// when getMessage() is called on this Exception object
-	private String msg;
-    
-	private static Hashtable<String, DRDAProtocolExceptionInfo> errorInfoTable;
-	
-	protected static String DRDA_Proto_CMDCHKRM=	"DRDA_Proto_CMDCHKRM";
-	protected static String DRDA_Proto_CMDNSPRM=	"DRDA_Proto_CMDNSPRM";
-	protected static String DRDA_Proto_DTAMCHRM=	"DRDA_Proto_DTAMCHRM";
-
-	protected static String DRDA_Proto_OBJNSPRM =	"DRDA_Proto_OBJNSPRM";
-	protected static String DRDA_Proto_PKGBNARM=	"DRDA_Proto_PKGBNARM";
-	protected static String DRDA_Proto_PRCCNVRM=   "DRDA_Proto_PRCCNVRM";
-	protected static String DRDA_Proto_PRMNSRM =   "DRDA_Proto_PRMNSPRM";
-
-	protected static String DRDA_Proto_SYNTAXRM=   "DRDA_Proto_SYNTAXRM";
-	protected static String DRDA_Proto_VALNSPRM=   "DRDA_Proto_VALNSPRM";
-	protected static String DRDA_Proto_MGRLVLRM=   "DRDA_Proto_MGRLVLRM";
-	protected static String DRDA_Proto_RDBNFNRM=   "DRDA_Proto_RDBNFNRM";
+    
+    /* Static values, used in constructor if there is no associated 
+       Error Code or the codepoint argument.
+    */
+    
+    protected static final int NO_ASSOC_ERRCD = 0;
+    protected static final int NO_CODPNT_ARG  = 0;
+
+    
+    private DRDAConnThread agent;
+
+    // request correlation id
+    private int correlationID;
+    
+    // correlation token
+    private byte[] crrtkn;
+
+    //Codepoint arg
+    private int codpntArg;
+
+    private DRDAProtocolExceptionInfo exceptionInfo;
+
+    // CodePoint of this error
+    private int errorCodePoint;
+    
+    // Severity Code
+    private int svrcod;
+    
+    // error code (e.g. SYNERRCD)
+    private int errcd;
+    
+    // messageid for logging errors.
+    private String  messageid;
 
-	protected static String DRDA_Disconnect=	   "DRDA_Disconnect";
-	protected static String DRDA_AgentError=	   "DRDA_AgentError";
+    // database name
+    private String rdbnam;
+    
+    // database diagnostic information
+    private String srvdgn;
+
+    // message arguments
+    private Object [] messageArgs;
+    
+    // A verbose error message string, will be helpful
+    // when getMessage() is called on this Exception object
+    private String msg;
+    
+    private static Hashtable<String, DRDAProtocolExceptionInfo> errorInfoTable;
+    
+    protected static String DRDA_Proto_CMDCHKRM=    "DRDA_Proto_CMDCHKRM";
+    protected static String DRDA_Proto_CMDNSPRM=    "DRDA_Proto_CMDNSPRM";
+    protected static String DRDA_Proto_DTAMCHRM=    "DRDA_Proto_DTAMCHRM";
+
+    protected static String DRDA_Proto_OBJNSPRM =    "DRDA_Proto_OBJNSPRM";
+    protected static String DRDA_Proto_PKGBNARM=    "DRDA_Proto_PKGBNARM";
+    protected static String DRDA_Proto_PRCCNVRM=   "DRDA_Proto_PRCCNVRM";
+    protected static String DRDA_Proto_PRMNSRM =   "DRDA_Proto_PRMNSPRM";
+
+    protected static String DRDA_Proto_SYNTAXRM=   "DRDA_Proto_SYNTAXRM";
+    protected static String DRDA_Proto_VALNSPRM=   "DRDA_Proto_VALNSPRM";
+    protected static String DRDA_Proto_MGRLVLRM=   "DRDA_Proto_MGRLVLRM";
+    protected static String DRDA_Proto_RDBNFNRM=   "DRDA_Proto_RDBNFNRM";
+
+    protected static String DRDA_Disconnect=       "DRDA_Disconnect";
+    protected static String DRDA_AgentError=       "DRDA_AgentError";
     protected static String DRDA_Timeout=          "DRDA_Timeout";
     protected static String DRDA_InvalidClient =   "DRDA_InvalidClient";
 
-	static {
-	/* Create the errorInfoTable
-	   The Hashtable is keyed on messageid and holds 
-	   DRDAProtocolExceptionInfo for each of our messages.
-	*/
-	
-	errorInfoTable = new Hashtable<String, DRDAProtocolExceptionInfo>();
-	
-	errorInfoTable.put(
-			   DRDA_Proto_CMDCHKRM,
-			   new  DRDAProtocolExceptionInfo(
-							  CodePoint.CMDCHKRM,
-							  CodePoint.SVRCOD_ERROR,
-							  NO_ASSOC_ERRCD,
-							  false));
-
-	errorInfoTable.put(
-			   DRDA_Proto_CMDNSPRM,
-			   new  DRDAProtocolExceptionInfo(
-							  CodePoint.CMDNSPRM,
-							  CodePoint.SVRCOD_ERROR,
-							  NO_ASSOC_ERRCD,
-							  true));
-	errorInfoTable.put(
-			   DRDA_Proto_DTAMCHRM,
-			   new  DRDAProtocolExceptionInfo(
-							  CodePoint.DTAMCHRM,
-							  CodePoint.SVRCOD_ERROR,
-							  NO_ASSOC_ERRCD,
-							  false));
-	errorInfoTable.put(
-			   DRDA_Proto_OBJNSPRM,
-			   new  DRDAProtocolExceptionInfo(
-							  CodePoint.OBJNSPRM,
-							  CodePoint.SVRCOD_ERROR,
-							  NO_ASSOC_ERRCD,
-							  true));
-		
-	errorInfoTable.put(
-					   DRDA_Proto_PKGBNARM,
-					   new  DRDAProtocolExceptionInfo(
-							   CodePoint.PKGBNARM,
-							   CodePoint.SVRCOD_ERROR,
-							   NO_ASSOC_ERRCD,
-							   false));
-			   
-	errorInfoTable.put(DRDA_Proto_PRCCNVRM,
-			   new DRDAProtocolExceptionInfo(
-							 CodePoint.PRCCNVRM,
-							 CodePoint.SVRCOD_ERROR,
-							 CodePoint.PRCCNVCD,
-							 false));
-
-	errorInfoTable.put(DRDA_Proto_SYNTAXRM,
-			   new DRDAProtocolExceptionInfo(
-							 CodePoint.SYNTAXRM,
-							 CodePoint.SVRCOD_ERROR,
-							 CodePoint.SYNERRCD,
-							 true));
-
-	errorInfoTable.put(DRDA_Proto_VALNSPRM,
-			   new DRDAProtocolExceptionInfo(
-							 CodePoint.VALNSPRM,
-							 CodePoint.SVRCOD_ERROR,
-							 NO_ASSOC_ERRCD,
-							 true));
-
-	errorInfoTable.put(DRDA_Proto_MGRLVLRM,
-			   new DRDAProtocolExceptionInfo(
-							 CodePoint.MGRLVLRM,
-							 CodePoint.SVRCOD_ERROR,
-							 NO_ASSOC_ERRCD,
-							 false));
-
-	errorInfoTable.put(DRDA_Proto_RDBNFNRM,
-			   new DRDAProtocolExceptionInfo(
-							 CodePoint.RDBNFNRM,
-							 CodePoint.SVRCOD_ERROR,
-							 NO_ASSOC_ERRCD,
-							 false));
-
-			   
-	errorInfoTable.put(DRDA_Disconnect,
-			   new DRDAProtocolExceptionInfo(
-							 0,
-							 0,
-							 NO_ASSOC_ERRCD,
-							 false));
+    static {
+    /* Create the errorInfoTable
+       The Hashtable is keyed on messageid and holds 
+       DRDAProtocolExceptionInfo for each of our messages.
+    */
+    
+    errorInfoTable = new Hashtable<String, DRDAProtocolExceptionInfo>();
+    
+    errorInfoTable.put(
+               DRDA_Proto_CMDCHKRM,
+               new  DRDAProtocolExceptionInfo(
+                              CodePoint.CMDCHKRM,
+                              CodePoint.SVRCOD_ERROR,
+                              NO_ASSOC_ERRCD,
+                              false));
+
+    errorInfoTable.put(
+               DRDA_Proto_CMDNSPRM,
+               new  DRDAProtocolExceptionInfo(
+                              CodePoint.CMDNSPRM,
+                              CodePoint.SVRCOD_ERROR,
+                              NO_ASSOC_ERRCD,
+                              true));
+    errorInfoTable.put(
+               DRDA_Proto_DTAMCHRM,
+               new  DRDAProtocolExceptionInfo(
+                              CodePoint.DTAMCHRM,
+                              CodePoint.SVRCOD_ERROR,
+                              NO_ASSOC_ERRCD,
+                              false));
+    errorInfoTable.put(
+               DRDA_Proto_OBJNSPRM,
+               new  DRDAProtocolExceptionInfo(
+                              CodePoint.OBJNSPRM,
+                              CodePoint.SVRCOD_ERROR,
+                              NO_ASSOC_ERRCD,
+                              true));
+        
+    errorInfoTable.put(
+                       DRDA_Proto_PKGBNARM,
+                       new  DRDAProtocolExceptionInfo(
+                               CodePoint.PKGBNARM,
+                               CodePoint.SVRCOD_ERROR,
+                               NO_ASSOC_ERRCD,
+                               false));
+               
+    errorInfoTable.put(DRDA_Proto_PRCCNVRM,
+               new DRDAProtocolExceptionInfo(
+                             CodePoint.PRCCNVRM,
+                             CodePoint.SVRCOD_ERROR,
+                             CodePoint.PRCCNVCD,
+                             false));
+
+    errorInfoTable.put(DRDA_Proto_SYNTAXRM,
+               new DRDAProtocolExceptionInfo(
+                             CodePoint.SYNTAXRM,
+                             CodePoint.SVRCOD_ERROR,
+                             CodePoint.SYNERRCD,
+                             true));
+
+    errorInfoTable.put(DRDA_Proto_VALNSPRM,
+               new DRDAProtocolExceptionInfo(
+                             CodePoint.VALNSPRM,
+                             CodePoint.SVRCOD_ERROR,
+                             NO_ASSOC_ERRCD,
+                             true));
+
+    errorInfoTable.put(DRDA_Proto_MGRLVLRM,
+               new DRDAProtocolExceptionInfo(
+                             CodePoint.MGRLVLRM,
+                             CodePoint.SVRCOD_ERROR,
+                             NO_ASSOC_ERRCD,
+                             false));
+
+    errorInfoTable.put(DRDA_Proto_RDBNFNRM,
+               new DRDAProtocolExceptionInfo(
+                             CodePoint.RDBNFNRM,
+                             CodePoint.SVRCOD_ERROR,
+                             NO_ASSOC_ERRCD,
+                             false));
+
+               
+    errorInfoTable.put(DRDA_Disconnect,
+               new DRDAProtocolExceptionInfo(
+                             0,
+                             0,
+                             NO_ASSOC_ERRCD,
+                             false));
 
     // Permanent Agent Error (AGNPRMRM) Reply Message indicates that the command
     // requested could not be completed because of a permanent error
     // condition detected at the target system.
-	errorInfoTable.put(DRDA_AgentError,
-			   new DRDAProtocolExceptionInfo(
-							 CodePoint.AGNPRMRM,
-							 CodePoint.SVRCOD_PRMDMG,
-							 NO_ASSOC_ERRCD,
-							 false));
-
-
-	errorInfoTable.put(DRDA_Timeout,
-			   new DRDAProtocolExceptionInfo(
-							 0,
-							 0,
-							 NO_ASSOC_ERRCD,
-							 false));
-
-	}
-		
-	
-	/**  Create a new Protocol exception 
-	 *
-	 * @param agent		DRDAConnThread  that threw this exception
-	 *
-	 * @param cpArg		CODPNT value  to pass to send
-	 *
-	 *
-	 * @param msgid		  The messageid for this message. (needs to be
-	 * integrated into logging mechanism)
-	 *
-	 * @param args		   Argments for the message in an Object[]
-	 *
-	 */
-	
-	DRDAProtocolException(String msgid,
-									DRDAConnThread agent, 
-									int cpArg, 
-									int errCdArg, Object []args)
-						
-	{
-		
-		boolean agentError = false;
-
-		exceptionInfo = 
-			(DRDAProtocolExceptionInfo) errorInfoTable.get(msgid);
-				
-		if (agent != null)
-		{
-			this.correlationID = agent.getCorrelationID();
-			this.crrtkn = agent.getCrrtkn();
-		}
-
-		this.codpntArg= cpArg;
-		this.errorCodePoint = exceptionInfo.errorCodePoint;
-		this.errcd = errCdArg;
-		this.messageid = msgid;
-
-		if (msgid.equals(DRDA_AgentError))
-		{
-			this.svrcod = ((Integer)args[0]).intValue();
-			this.rdbnam = (String)args[1];
+    errorInfoTable.put(DRDA_AgentError,
+               new DRDAProtocolExceptionInfo(
+                             CodePoint.AGNPRMRM,
+                             CodePoint.SVRCOD_PRMDMG,
+                             NO_ASSOC_ERRCD,
+                             false));
+
+
+    errorInfoTable.put(DRDA_Timeout,
+               new DRDAProtocolExceptionInfo(
+                             0,
+                             0,
+                             NO_ASSOC_ERRCD,
+                             false));
+
+    }
+        
+    
+    /**  Create a new Protocol exception 
+     *
+     * @param agent        DRDAConnThread  that threw this exception
+     *
+     * @param cpArg        CODPNT value  to pass to send
+     *
+     *
+     * @param msgid          The messageid for this message. (needs to be
+     * integrated into logging mechanism)
+     *
+     * @param args           Argments for the message in an Object[]
+     *
+     */
+    
+    DRDAProtocolException(String msgid,
+                                    DRDAConnThread agent, 
+                                    int cpArg, 
+                                    int errCdArg, Object []args)
+                        
+    {
+        
+        boolean agentError = false;
+
+        exceptionInfo = 
+            (DRDAProtocolExceptionInfo) errorInfoTable.get(msgid);
+                
+        if (agent != null)
+        {
+            this.correlationID = agent.getCorrelationID();
+            this.crrtkn = agent.getCrrtkn();
+        }
+
+        this.codpntArg= cpArg;
+        this.errorCodePoint = exceptionInfo.errorCodePoint;
+        this.errcd = errCdArg;
+        this.messageid = msgid;
+
+        if (msgid.equals(DRDA_AgentError))
+        {
+            this.svrcod = ((Integer)args[0]).intValue();
+            this.rdbnam = (String)args[1];
             // retrieve the server diagnostic error message 
             String srvdgn = (String)args[2];
-			msg = "Execution failed because of Permanent Agent Error: SVRCOD = " +
-				java.lang.Integer.toHexString(this.svrcod) +
-				"; RDBNAM = "+ rdbnam +"; diagnostic msg = "+ srvdgn;
-			agentError = true;
-		}
-		else if (msgid.equals(DRDA_Proto_RDBNFNRM))
-		{
-			this.svrcod = exceptionInfo.svrcod;
-			this.rdbnam = (String)args[0];
-			msg = "Execution failed because of Distributed Protocol Error:  " 
-				+ messageid +
-				"; RDBNAM = "+ rdbnam;
-		}
-		else
-		{
-			this.svrcod = exceptionInfo.svrcod;
-			msg = "Execution failed because of a Distributed Protocol Error:  " 
-				+ messageid +
-				"; CODPNT arg  = " + java.lang.Integer.toHexString(cpArg)  +
-				"; Error Code Value = " + java.lang.Integer.toHexString(errCdArg);
-			if (msgid.equals(DRDA_Proto_SYNTAXRM)) {
-				msg += ". Plaintext connection attempt from an SSL enabled client?";
-			}
-		}
-		
-		
-		if (!agentError && args != null)
-		{
-			messageArgs = args;
-			for (int i = 0; i < args.length; i++)
-			{
-				//args contain managers and manager levels display in hex
-				if (msgid.equals(DRDA_Proto_MGRLVLRM))
-					msg += "," + 
-						java.lang.Integer.toHexString(((Integer)args[i]).intValue());
-				else
-					msg += "," + args[i];
-				
-			}
-		}
-
-
-		// for now dump all errors except disconnects to console		
-		// and log
-		if (!isDisconnectException())
-		{
-			DRDAConnThread.println2Log(agent.getDbName(),
-								   agent.getSession().drdaID, 
-								   msg);
-			NetworkServerControlImpl s = agent.getServer();
-			s.consoleExceptionPrintTrace(this);
-		}
-	}
-	
-	// Constructor with no additional args
-	DRDAProtocolException(String msgid,
-									DRDAConnThread agent, 
-									int cpArg, 
-									int errCdArg)
-	{
-		this(msgid,agent,  cpArg, errCdArg, (Object []) null);
-	}
-
-
-	protected static DRDAProtocolException newDisconnectException(DRDAConnThread
-																  agent,Object[] args)
-	{
-		return new DRDAProtocolException(DRDA_Disconnect,
-										 agent,
-										 NO_CODPNT_ARG,
-										 NO_ASSOC_ERRCD,
-										 args);
-		
-	}
-	
-	protected static DRDAProtocolException newAgentError(DRDAConnThread agent,
-		int svrcod, String rdbnam, String srvdgn)
-	{
+            msg = "Execution failed because of Permanent Agent Error: SVRCOD = " +
+                java.lang.Integer.toHexString(this.svrcod) +
+                "; RDBNAM = "+ rdbnam +"; diagnostic msg = "+ srvdgn;
+            agentError = true;
+        }
+        else if (msgid.equals(DRDA_Proto_RDBNFNRM))
+        {
+            this.svrcod = exceptionInfo.svrcod;
+            this.rdbnam = (String)args[0];
+            msg = "Execution failed because of Distributed Protocol Error:  " 
+                + messageid +
+                "; RDBNAM = "+ rdbnam;
+        }
+        else
+        {
+            this.svrcod = exceptionInfo.svrcod;
+            msg = "Execution failed because of a Distributed Protocol Error:  " 
+                + messageid +
+                "; CODPNT arg  = " + java.lang.Integer.toHexString(cpArg)  +
+                "; Error Code Value = " + java.lang.Integer.toHexString(errCdArg);
+            if (msgid.equals(DRDA_Proto_SYNTAXRM)) {
+                msg += ". Plaintext connection attempt from an SSL enabled client?";
+            }
+        }
+        
+        
+        if (!agentError && args != null)
+        {
+            messageArgs = args;
+            for (int i = 0; i < args.length; i++)
+            {
+                //args contain managers and manager levels display in hex
+                if (msgid.equals(DRDA_Proto_MGRLVLRM))
+                    msg += "," + 
+                        java.lang.Integer.toHexString(((Integer)args[i]).intValue());
+                else
+                    msg += "," + args[i];
+                
+            }
+        }
+
+
+        // for now dump all errors except disconnects to console        
+        // and log
+        if (!isDisconnectException())
+        {
+            DRDAConnThread.println2Log(agent.getDbName(),
+                                   agent.getSession().drdaID, 
+                                   msg);
+            NetworkServerControlImpl s = agent.getServer();
+            s.consoleExceptionPrintTrace(this);
+        }
+    }
+    
+    // Constructor with no additional args
+    DRDAProtocolException(String msgid,
+                                    DRDAConnThread agent, 
+                                    int cpArg, 
+                                    int errCdArg)
+    {
+        this(msgid,agent,  cpArg, errCdArg, (Object []) null);
+    }
+
+
+    protected static DRDAProtocolException newDisconnectException(DRDAConnThread
+                                                                  agent,Object[] args)
+    {
+        return new DRDAProtocolException(DRDA_Disconnect,
+                                         agent,
+                                         NO_CODPNT_ARG,
+                                         NO_ASSOC_ERRCD,
+                                         args);
+        
+    }
+    
+    protected static DRDAProtocolException newAgentError(DRDAConnThread agent,
+        int svrcod, String rdbnam, String srvdgn)
+    {
         if ( SanityManager.DEBUG )
             agent.trace("agentError in " + agent);
         Object[] oa = {svrcod, rdbnam, srvdgn};
-		return new DRDAProtocolException(DRDA_AgentError,
-										agent,
-										NO_CODPNT_ARG,
-										NO_ASSOC_ERRCD,
-										oa);
-	}
-	
-	protected final boolean isDisconnectException()
-	{
-		return (errorCodePoint == 0);
-	}
-	
-	/** write will write the Error information to the buffer.
-	 * Most errors will write only the codepoint and svrcod 
-	 * Where appropriate the codepoint specific error code and
-	 * codePoint of origin will be written
-	 *
-	 * @param writer  The DDMWriter for the agent.
-	 */
-	
-	protected void write(DDMWriter writer)
-	{
-		//Writing Protocol Error
-		writer.createDssReply();
-		writer.startDdm(errorCodePoint);
-		writer.writeScalar2Bytes(CodePoint.SVRCOD,svrcod);
-		if (exceptionInfo.sendsCodpntArg)
-			writer.writeScalar2Bytes(CodePoint.CODPNT,codpntArg);
-		if (exceptionInfo.errCdCodePoint !=  NO_ASSOC_ERRCD)
-			writer.writeScalar1Byte(exceptionInfo.errCdCodePoint,
-									errcd);
-		if (rdbnam != null && agent != null)
-		{
-			try {
-				agent.writeRDBNAM(rdbnam);
-			} catch (DRDAProtocolException e) {} //ignore exceptions while processing
-		}
-		// for MGRLVLRM, need to write out the manager levels
-		if (errorCodePoint == CodePoint.MGRLVLRM)
-		{
-			writer.startDdm(CodePoint.MGRLVLLS);
-			for (int i = 0; i < messageArgs.length ; i += 2)
-			{
-				writer.writeNetworkShort(((Integer)messageArgs[i]).intValue());
-				writer.writeNetworkShort(((Integer)messageArgs[i+1]).intValue());
-			}
-			writer.endDdm();
-		}
-		writer.endDdmAndDss();
-	}
+        return new DRDAProtocolException(DRDA_AgentError,
+                                        agent,
+                                        NO_CODPNT_ARG,
+                                        NO_ASSOC_ERRCD,
+                                        oa);
+    }
+    
+    protected final boolean isDisconnectException()
+    {
+        return (errorCodePoint == 0);
+    }
+    
+    /** write will write the Error information to the buffer.
+     * Most errors will write only the codepoint and svrcod 
+     * Where appropriate the codepoint specific error code and
+     * codePoint of origin will be written
+     *
+     * @param writer  The DDMWriter for the agent.
+     */
+    
+    protected void write(DDMWriter writer)
+    {
+        //Writing Protocol Error
+        writer.createDssReply();
+        writer.startDdm(errorCodePoint);
+        writer.writeScalar2Bytes(CodePoint.SVRCOD,svrcod);
+        if (exceptionInfo.sendsCodpntArg)
+            writer.writeScalar2Bytes(CodePoint.CODPNT,codpntArg);
+        if (exceptionInfo.errCdCodePoint !=  NO_ASSOC_ERRCD)
+            writer.writeScalar1Byte(exceptionInfo.errCdCodePoint,
+                                    errcd);
+        if (rdbnam != null && agent != null)
+        {
+            try {
+                agent.writeRDBNAM(rdbnam);
+            } catch (DRDAProtocolException e) {} //ignore exceptions while processing
+        }
+        // for MGRLVLRM, need to write out the manager levels
+        if (errorCodePoint == CodePoint.MGRLVLRM)
+        {
+            writer.startDdm(CodePoint.MGRLVLLS);
+            for (int i = 0; i < messageArgs.length ; i += 2)
+            {
+                writer.writeNetworkShort(((Integer)messageArgs[i]).intValue());
+                writer.writeNetworkShort(((Integer)messageArgs[i+1]).intValue());
+            }
+            writer.endDdm();
+        }
+        writer.endDdmAndDss();
+    }
     
     /**
      * Override getMessage() 

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAProtocolExceptionInfo.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAProtocolExceptionInfo.java?rev=1370674&r1=1370673&r2=1370674&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAProtocolExceptionInfo.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAProtocolExceptionInfo.java Wed Aug  8 06:54:46 2012
@@ -39,7 +39,7 @@ class DRDAProtocolExceptionInfo {
      * required field called SYNERRCD, and PRCCNVRM has a required field called
      * PRCCNVCD.
      */
-    protected int errorCodePoint;	   
+    protected int errorCodePoint;       
     
     // Severity Code
     protected int svrcod;
@@ -52,15 +52,15 @@ class DRDAProtocolExceptionInfo {
     
     // Sends an originating Codepoint
     protected boolean sendsCodpntArg;
-	
+    
     DRDAProtocolExceptionInfo(int errorCodePoint, int svrcod,  
-					int errCdCodePoint,
-					boolean sendsCodpntArg)
+                    int errCdCodePoint,
+                    boolean sendsCodpntArg)
     {
-	this.errorCodePoint = errorCodePoint;
-	this.svrcod = svrcod;
-	this.errCdCodePoint = errCdCodePoint;
-	this.sendsCodpntArg = sendsCodpntArg;
+    this.errorCodePoint = errorCodePoint;
+    this.svrcod = svrcod;
+    this.errCdCodePoint = errCdCodePoint;
+    this.sendsCodpntArg = sendsCodpntArg;
     }
     
     

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAResultSet.java?rev=1370674&r1=1370673&r2=1370674&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAResultSet.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAResultSet.java Wed Aug  8 06:54:46 2012
@@ -29,518 +29,518 @@ import java.util.ArrayList;
 import org.apache.derby.iapi.jdbc.EngineResultSet;
 
 /**
-	DRDAResultSet holds result set information
+    DRDAResultSet holds result set information
 */
 class DRDAResultSet
 {
-	//NOTE!
-	//
-	// Since DRDAResultSets are reused, ALL variables should be set 
-	// to their default values in reset().
-
-	// resultSet states are NOT_OPENED and SUSPENDED
-	protected static final int NOT_OPENED = 1;
-	protected static final int SUSPENDED = 2;
-	public static final int QRYCLSIMP_DEFAULT = CodePoint.QRYCLSIMP_NO;  
-	
-	boolean explicitlyClosed = false;
-
-	int state;
-	protected boolean hasdata = true;
-	protected int[] rsLens;				// result length for each column
-	private int[] rsDRDATypes;			// DRDA Types of the result set columns
-	private int[] rsPrecision;         // result precision for Decimal types
-	private int[] rsScale;              // result sale for Decimal types
-
-	protected int [] outovr_drdaType;	// Output override DRDA type and length
-
-	protected int withHoldCursor;			// hold cursor after commit attribute
-	protected int scrollType = ResultSet.TYPE_FORWARD_ONLY;			// Sensitive or Insensitive scroll attribute
-	protected int concurType;			// Concurency type
-	protected long rowCount;			// Number of rows we have processed
-	private ResultSet rs;              // Current ResultSet
-
-	protected int blksize;				// Query block size
-	protected int maxblkext;			// Maximum number of extra blocks
-	protected int outovropt;			// Output Override option
-	protected int qryclsimp;			// Implicit Query Close Setting
-	protected boolean qryrelscr;		// Query relative scrolling
-	protected long qryrownbr;			// Query row number
-	protected boolean qryrfrtbl;		// Query refresh answer set table
-	protected int qryscrorn;			// Query scroll orientation
-	protected boolean qryrowsns;		// Query row sensitivity
-	protected boolean qryblkrst;		// Query block reset
-	protected boolean qryrtndta;		// Query returns data
-	protected int qryrowset;			// Query row set
-	private   int qryprctyp;			// Protocol type
-	private   boolean gotPrctyp;		// save the result, for performance
-	protected int rtnextdta;			// Return of EXTDTA option
-	protected int nbrrow;			   // number of fetch or insert rows
-	protected byte [] rslsetflg;		// Result Set Flags
+    //NOTE!
+    //
+    // Since DRDAResultSets are reused, ALL variables should be set 
+    // to their default values in reset().
+
+    // resultSet states are NOT_OPENED and SUSPENDED
+    protected static final int NOT_OPENED = 1;
+    protected static final int SUSPENDED = 2;
+    public static final int QRYCLSIMP_DEFAULT = CodePoint.QRYCLSIMP_NO;  
+    
+    boolean explicitlyClosed = false;
+
+    int state;
+    protected boolean hasdata = true;
+    protected int[] rsLens;                // result length for each column
+    private int[] rsDRDATypes;            // DRDA Types of the result set columns
+    private int[] rsPrecision;         // result precision for Decimal types
+    private int[] rsScale;              // result sale for Decimal types
+
+    protected int [] outovr_drdaType;    // Output override DRDA type and length
+
+    protected int withHoldCursor;            // hold cursor after commit attribute
+    protected int scrollType = ResultSet.TYPE_FORWARD_ONLY;            // Sensitive or Insensitive scroll attribute
+    protected int concurType;            // Concurency type
+    protected long rowCount;            // Number of rows we have processed
+    private ResultSet rs;              // Current ResultSet
+
+    protected int blksize;                // Query block size
+    protected int maxblkext;            // Maximum number of extra blocks
+    protected int outovropt;            // Output Override option
+    protected int qryclsimp;            // Implicit Query Close Setting
+    protected boolean qryrelscr;        // Query relative scrolling
+    protected long qryrownbr;            // Query row number
+    protected boolean qryrfrtbl;        // Query refresh answer set table
+    protected int qryscrorn;            // Query scroll orientation
+    protected boolean qryrowsns;        // Query row sensitivity
+    protected boolean qryblkrst;        // Query block reset
+    protected boolean qryrtndta;        // Query returns data
+    protected int qryrowset;            // Query row set
+    private   int qryprctyp;            // Protocol type
+    private   boolean gotPrctyp;        // save the result, for performance
+    protected int rtnextdta;            // Return of EXTDTA option
+    protected int nbrrow;               // number of fetch or insert rows
+    protected byte [] rslsetflg;        // Result Set Flags
 
     /** List of Blobs and Clobs. Return values to send with extdta objects. */
     private ArrayList<Object> extDtaObjects;
-	
+    
     private ArrayList<Integer> rsExtPositions;
 
-	protected ConsistencyToken pkgcnstkn; // Unique consistency token for ResultSet 0
+    protected ConsistencyToken pkgcnstkn; // Unique consistency token for ResultSet 0
 
-	// splitQRYDTA is normally null. If it is non-null, it means that
-	// the last QRYDTA response which was sent for this statement was
-	// split according to the LMTBLKPRC protocol, and this array contains
-	// the bytes that didn't fit. These bytes should be the first bytes
-	// emitted in the next QRYDTA response to a CNTQRY request.
-	private byte []splitQRYDTA;
-
-	DRDAResultSet()
-	{
-		state = NOT_OPENED;
-		// Initialize qryclsimp to NO. Only result sets requested by
-		// an OPNQRY command should be implicitly closed. OPNQRY will
-		// set qryclsimp later in setOPNQRYOptions().
-		qryclsimp = CodePoint.QRYCLSIMP_NO;
-	}
-
-	/**
- 	 * Set result set and initialize type array.
-	 *
-	 * @param value
-	 * 
-	 */
-
-	void setResultSet(ResultSet value) throws SQLException
-	{
-		rs = value;
-		gotPrctyp = false;
-		int numCols= rs.getMetaData().getColumnCount();
-		rsDRDATypes = new int[numCols];
-		explicitlyClosed = false;
-	}
-
-
-	/**
-	 * set consistency token for this resultSet
-	 *
-	 */
-	protected void setPkgcnstkn(ConsistencyToken pkgcnstkn)
-	{
-		this.pkgcnstkn = pkgcnstkn;
-	}
-
-
-	/**
-	 * 
-	 *  @return the underlying java.sql.ResultSet
-	 */
-	protected ResultSet getResultSet()
-	{
-		return rs;
-	}
-
-	public void setSplitQRYDTA(byte []data)
-	{
-		splitQRYDTA = data;
-	}
-	public byte[]getSplitQRYDTA()
-	{
-		return splitQRYDTA;
-	}
-
-	/**
-	 *@return ResultSet DRDA DataTypes
-	 **/
-
-	protected int[] getRsDRDATypes()
-	{
-		// use the given override if it is present
-		if (outovr_drdaType != null)
-			return outovr_drdaType;
-		return rsDRDATypes;
-	}
-
-	/**
-	 * set resultset/out parameter precision
-	 *
-	 * @param index - starting with 1
-	 * @param precision
-	 */
-	protected void setRsPrecision(int index, int precision)
-	{
-		if (rsPrecision == null)
-			rsPrecision = new int[rsDRDATypes.length];
-		rsPrecision[index -1] = precision;
-	}
-
-	/**
-	 * get resultset /out paramter precision
-	 * @param index -starting with 1
-	 * @return precision of column
-	 */
-	protected int getRsPrecision(int index)
-	{
-		if (rsPrecision == null)
-			return 0;
-		return rsPrecision[index-1];
-	}
-
-	/**
-	 * set resultset/out parameter scale
-	 *
-	 * @param index - starting with 1
-	 * @param scale
-	 */
-	protected void setRsScale(int index, int scale)
-	{
-		if (rsScale == null)
-			rsScale = new int[rsDRDATypes.length];
-		rsScale[index-1] = scale;
-	}
-
-	/**
-	 * get resultset /out paramter scale
-	 * @param index -starting with 1
-	 * @return scale of column
-	 */
-	protected int  getRsScale(int index)
-	{
-		if (rsScale == null)
-			return 0;
-		
-		return rsScale[index -1];
-	}
-	
-	
-	/**
-	 * set resultset/out parameter DRDAType
-	 *
-	 * @param index - starting with 1
-	 * @param type
-	 */
-	protected  void setRsDRDAType(int index, int type)
-	{
-		rsDRDATypes[index -1] =  type;
-		
-	}
-	
-	/**
-	 * get  resultset/out parameter DRDAType
-	 *
-	 * @param index - starting with 1
-	 * @return  DRDA Type of column
-	 */
-	protected int getRsDRDAType(int index)
-	{
+    // splitQRYDTA is normally null. If it is non-null, it means that
+    // the last QRYDTA response which was sent for this statement was
+    // split according to the LMTBLKPRC protocol, and this array contains
+    // the bytes that didn't fit. These bytes should be the first bytes
+    // emitted in the next QRYDTA response to a CNTQRY request.
+    private byte []splitQRYDTA;
+
+    DRDAResultSet()
+    {
+        state = NOT_OPENED;
+        // Initialize qryclsimp to NO. Only result sets requested by
+        // an OPNQRY command should be implicitly closed. OPNQRY will
+        // set qryclsimp later in setOPNQRYOptions().
+        qryclsimp = CodePoint.QRYCLSIMP_NO;
+    }
+
+    /**
+      * Set result set and initialize type array.
+     *
+     * @param value
+     * 
+     */
+
+    void setResultSet(ResultSet value) throws SQLException
+    {
+        rs = value;
+        gotPrctyp = false;
+        int numCols= rs.getMetaData().getColumnCount();
+        rsDRDATypes = new int[numCols];
+        explicitlyClosed = false;
+    }
+
+
+    /**
+     * set consistency token for this resultSet
+     *
+     */
+    protected void setPkgcnstkn(ConsistencyToken pkgcnstkn)
+    {
+        this.pkgcnstkn = pkgcnstkn;
+    }
+
+
+    /**
+     * 
+     *  @return the underlying java.sql.ResultSet
+     */
+    protected ResultSet getResultSet()
+    {
+        return rs;
+    }
+
+    public void setSplitQRYDTA(byte []data)
+    {
+        splitQRYDTA = data;
+    }
+    public byte[]getSplitQRYDTA()
+    {
+        return splitQRYDTA;
+    }
+
+    /**
+     *@return ResultSet DRDA DataTypes
+     **/
+
+    protected int[] getRsDRDATypes()
+    {
+        // use the given override if it is present
+        if (outovr_drdaType != null)
+            return outovr_drdaType;
+        return rsDRDATypes;
+    }
+
+    /**
+     * set resultset/out parameter precision
+     *
+     * @param index - starting with 1
+     * @param precision
+     */
+    protected void setRsPrecision(int index, int precision)
+    {
+        if (rsPrecision == null)
+            rsPrecision = new int[rsDRDATypes.length];
+        rsPrecision[index -1] = precision;
+    }
+
+    /**
+     * get resultset /out paramter precision
+     * @param index -starting with 1
+     * @return precision of column
+     */
+    protected int getRsPrecision(int index)
+    {
+        if (rsPrecision == null)
+            return 0;
+        return rsPrecision[index-1];
+    }
+
+    /**
+     * set resultset/out parameter scale
+     *
+     * @param index - starting with 1
+     * @param scale
+     */
+    protected void setRsScale(int index, int scale)
+    {
+        if (rsScale == null)
+            rsScale = new int[rsDRDATypes.length];
+        rsScale[index-1] = scale;
+    }
+
+    /**
+     * get resultset /out paramter scale
+     * @param index -starting with 1
+     * @return scale of column
+     */
+    protected int  getRsScale(int index)
+    {
+        if (rsScale == null)
+            return 0;
+        
+        return rsScale[index -1];
+    }
+    
+    
+    /**
+     * set resultset/out parameter DRDAType
+     *
+     * @param index - starting with 1
+     * @param type
+     */
+    protected  void setRsDRDAType(int index, int type)
+    {
+        rsDRDATypes[index -1] =  type;
+        
+    }
+    
+    /**
+     * get  resultset/out parameter DRDAType
+     *
+     * @param index - starting with 1
+     * @return  DRDA Type of column
+     */
+    protected int getRsDRDAType(int index)
+    {
         if ((outovr_drdaType != null) && (outovr_drdaType[index-1] != 0)) {
             // Override with requested type.  0 means use default
             return outovr_drdaType[index-1];
         }
         return rsDRDATypes[index -1];
-	}
-	
-	
-	/**
-	 * get  resultset  DRDALen
-	 * @param index - starting with 1
-	 * @return  length of column value
-	 */
-	protected int getRsLen(int index)
-	{
-		return rsLens[index -1];
-	}
-	
-
-	/**
-	 * Add extDtaObject
-	 * @param o - object to  add
-	 */
-	protected void  addExtDtaObject (Object o, int jdbcIndex )
-	{
-		if (extDtaObjects == null)
-			extDtaObjects = new java.util.ArrayList<Object>();
-		extDtaObjects.add (o);
-
-		if (rsExtPositions == null)
-			rsExtPositions = new java.util.ArrayList<Integer>();
-		
-		// need to record the 0 based position so subtract 1
+    }
+    
+    
+    /**
+     * get  resultset  DRDALen
+     * @param index - starting with 1
+     * @return  length of column value
+     */
+    protected int getRsLen(int index)
+    {
+        return rsLens[index -1];
+    }
+    
+
+    /**
+     * Add extDtaObject
+     * @param o - object to  add
+     */
+    protected void  addExtDtaObject (Object o, int jdbcIndex )
+    {
+        if (extDtaObjects == null)
+            extDtaObjects = new java.util.ArrayList<Object>();
+        extDtaObjects.add (o);
+
+        if (rsExtPositions == null)
+            rsExtPositions = new java.util.ArrayList<Integer>();
+        
+        // need to record the 0 based position so subtract 1
         rsExtPositions.add(jdbcIndex - 1);
 
-	}
+    }
 
 
-	/**
-	 * Clear externalized lob objects in current result set
-	 */
-	protected void  clearExtDtaObjects ()
-	{
-		if (extDtaObjects != null)
-			extDtaObjects.clear();
-		if (rsExtPositions != null)
-			rsExtPositions.clear();
-		
-	}
-	
-	/**
-	 * Is lob object nullable
-	 * @param index - offset starting with 0
-	 * @return true if object is nullable
-	 */
-	protected boolean isExtDtaValueNullable(int index)
-	{
-		if ((rsExtPositions == null) || 
-			rsExtPositions.get(index) == null)
-			return false;
-		
+    /**
+     * Clear externalized lob objects in current result set
+     */
+    protected void  clearExtDtaObjects ()
+    {
+        if (extDtaObjects != null)
+            extDtaObjects.clear();
+        if (rsExtPositions != null)
+            rsExtPositions.clear();
+        
+    }
+    
+    /**
+     * Is lob object nullable
+     * @param index - offset starting with 0
+     * @return true if object is nullable
+     */
+    protected boolean isExtDtaValueNullable(int index)
+    {
+        if ((rsExtPositions == null) || 
+            rsExtPositions.get(index) == null)
+            return false;
+        
 
-		// Column number is starting on 1
-		int colnum = ((Integer) rsExtPositions.get(index)).intValue() + 1;
+        // Column number is starting on 1
+        int colnum = ((Integer) rsExtPositions.get(index)).intValue() + 1;
 
         // if there is no type information, then we represent a CallableStatement
         // and all parameters are nullable
         if ( rsDRDATypes == null ) { return true; }
-		else if (FdocaConstants.isNullable(getRsDRDAType(colnum)))
-			return true;
-		else 
-			return false;
-	}
-	
-
-	/**
-	 * Get the extData Objects
-	 *
-	 *  @return ArrayList with extdta
-	 */
-	protected ArrayList<Object> getExtDtaObjects()
-	{
-		return extDtaObjects;
-	}
-
-	/**
-	 * This method closes the JDBC objects and frees up all references held by
-	 * this object.
-	 * 
-	 * @throws SQLException
-	 */
-	protected void close()  throws SQLException
-	{
-		if (rs != null)
-			rs.close();
-		rs = null;
-		outovr_drdaType = null;
-		rsLens = null;
-		rsDRDATypes = null;
-		rsPrecision = null;
-		rsScale = null;
-		extDtaObjects = null;
-		splitQRYDTA = null;
-		rsExtPositions = null;
-	}
-	
-	/**
-	 * This method resets the state of this DRDAResultset object so that it can
-	 * be re-used. This method should reset all variables of this class.
-	 * 
-	 */
-	protected void reset() {
-		explicitlyClosed = false;
-		state = NOT_OPENED;
-		hasdata = true;
-		rsLens = null;
-		rsDRDATypes = null;
-		rsPrecision = null;
-		rsScale = null;
-		
-		outovr_drdaType = null;
-		
-		withHoldCursor = 0;	
-		scrollType = ResultSet.TYPE_FORWARD_ONLY;
-		concurType = 0;
-		rowCount = 0;
-		rs = null;
-		
-		blksize = 0;
-		maxblkext = 0;	
-		outovropt = 0;
-		qryclsimp = CodePoint.QRYCLSIMP_NO;	
-		qryrelscr = false;
-		qryrownbr = 0;
-		qryrfrtbl = false;	
-		qryscrorn = 0;
-		qryrowsns = false; 
-		qryblkrst = false;
-		qryrtndta = false;	
-		qryrowset = 0;
-		qryprctyp = 0;
-		gotPrctyp = false; 	
-		rtnextdta = 0;	
-		nbrrow = 0;
-		rslsetflg = null;	
-
-		extDtaObjects = null;
-		rsExtPositions = null;
-		pkgcnstkn = null;
-		splitQRYDTA = null;	
-	}
-
-
-	/**
-	 * Explicitly close the result set by CLSQRY
-	 * needed to check for double close.
-	 */
-	protected void CLSQRY()
-	{
-		explicitlyClosed = true;
-	}
-
-	/* 
-	 * @return whether CLSQRY has been called on the
-	 *         current result set.
-	 */
-	protected boolean wasExplicitlyClosed()
-	{
-		return explicitlyClosed;
-	}
-
-
-	/****
-	 * Check to see if the result set for this statement
-	 * has at least one column that is BLOB/CLOB.
-	 * @return True if the result has at least one blob/clob
-	 *  column; false otherwise.
-	 ****/
+        else if (FdocaConstants.isNullable(getRsDRDAType(colnum)))
+            return true;
+        else 
+            return false;
+    }
+    
+
+    /**
+     * Get the extData Objects
+     *
+     *  @return ArrayList with extdta
+     */
+    protected ArrayList<Object> getExtDtaObjects()
+    {
+        return extDtaObjects;
+    }
+
+    /**
+     * This method closes the JDBC objects and frees up all references held by
+     * this object.
+     * 
+     * @throws SQLException
+     */
+    protected void close()  throws SQLException
+    {
+        if (rs != null)
+            rs.close();
+        rs = null;
+        outovr_drdaType = null;
+        rsLens = null;
+        rsDRDATypes = null;
+        rsPrecision = null;
+        rsScale = null;
+        extDtaObjects = null;
+        splitQRYDTA = null;
+        rsExtPositions = null;
+    }
+    
+    /**
+     * This method resets the state of this DRDAResultset object so that it can
+     * be re-used. This method should reset all variables of this class.
+     * 
+     */
+    protected void reset() {
+        explicitlyClosed = false;
+        state = NOT_OPENED;
+        hasdata = true;
+        rsLens = null;
+        rsDRDATypes = null;
+        rsPrecision = null;
+        rsScale = null;
+        
+        outovr_drdaType = null;
+        
+        withHoldCursor = 0;    
+        scrollType = ResultSet.TYPE_FORWARD_ONLY;
+        concurType = 0;
+        rowCount = 0;
+        rs = null;
+        
+        blksize = 0;
+        maxblkext = 0;    
+        outovropt = 0;
+        qryclsimp = CodePoint.QRYCLSIMP_NO;    
+        qryrelscr = false;
+        qryrownbr = 0;
+        qryrfrtbl = false;    
+        qryscrorn = 0;
+        qryrowsns = false; 
+        qryblkrst = false;
+        qryrtndta = false;    
+        qryrowset = 0;
+        qryprctyp = 0;
+        gotPrctyp = false;     
+        rtnextdta = 0;    
+        nbrrow = 0;
+        rslsetflg = null;    
+
+        extDtaObjects = null;
+        rsExtPositions = null;
+        pkgcnstkn = null;
+        splitQRYDTA = null;    
+    }
+
+
+    /**
+     * Explicitly close the result set by CLSQRY
+     * needed to check for double close.
+     */
+    protected void CLSQRY()
+    {
+        explicitlyClosed = true;
+    }
+
+    /* 
+     * @return whether CLSQRY has been called on the
+     *         current result set.
+     */
+    protected boolean wasExplicitlyClosed()
+    {
+        return explicitlyClosed;
+    }
+
+
+    /****
+     * Check to see if the result set for this statement
+     * has at least one column that is BLOB/CLOB.
+     * @return True if the result has at least one blob/clob
+     *  column; false otherwise.
+     ****/
  
-	protected boolean hasLobColumns() throws SQLException
-	{
-		ResultSetMetaData rsmd = rs.getMetaData();
-		int ncols = rsmd.getColumnCount();
-		for (int i = 1; i <= ncols; i++)
-		{
-			int type = rsmd.getColumnType(i);
-			if (type == Types.BLOB || type == Types.CLOB)
-				return true;
-		}
-		return false;
-	}
-
-	/**
-	 * Get the cursor name for the ResultSet
-	 */
-	public String getResultSetCursorName() throws SQLException
-	{
-
-		if (rs != null)
-			return rs.getCursorName();
-		else 
-			return null;
-	}
-
-	protected int getQryprctyp()
-		throws SQLException
-	{
-		if (!gotPrctyp && qryprctyp == CodePoint.LMTBLKPRC)
-		{
-			gotPrctyp = true;
-			if (rs == null || ((EngineResultSet)rs).isForUpdate() ||
-				/* for now we are not supporting LOB under LMTBLKPRC.  drda spec only
-				 * disallows LOB under LMTBLKPRC if OUTOVR is also for ANY CNTQRY reply.
-				 * To support LOB, QRYDTA protocols for LOB will need to be changed.
-				 */
-				hasLobColumns())
-			{
-				qryprctyp = CodePoint.FIXROWPRC;
-			}
-		}
-		return qryprctyp;
-	}
-
-	protected void setQryprctyp(int qryprctyp)
-	{
-		this.qryprctyp = qryprctyp;
-	}
-
-	/**
-	 * is ResultSet closed
-	 * @return whether the resultSet  is closed
-	 */
-	protected boolean isClosed()
-	{
-		return (state == NOT_OPENED);
-	}
-
-	/**
-	 * Set state to SUSPENDED (result set is opened)
-	 */
-	protected void suspend()
-	{
-		state = SUSPENDED;
-	}
-
-
-	protected String toDebugString(String indent)
-	{
-		String s = indent + "***** DRDASResultSet toDebugString ******\n";
-		s += indent + "State:" + getStateString(state)+ "\n";
-		s += indent + "pkgcnstkn: {" + pkgcnstkn + "}\n"; 
-		s += indent + "cursor Name: ";
-		String cursorName = null;
-		try {
-			if (rs != null)
-				cursorName = rs.getCursorName();
-		}
-		catch (SQLException se )
-		{
-			cursorName = "invalid rs";
-		}
-		s += indent + cursorName + "\n";
-		   
-		return s;
-	}
-
-
-	private String getStateString( int i )
-	{
-		switch (i)
-		{
-			case NOT_OPENED:
-				return "NOT_OPENED";
-			case SUSPENDED:
-				return "SUSPENDED";
-			default:
-				return "UNKNOWN_STATE";
-		}
-
-	}
-	
-	/**
-	 * Sets the OPNQRYOptions. For more information on the meaning of these
-	 * values consult the DRDA Technical Standard document. 
-	 * 
-	 * @param blksize Query block Size
-	 * @param qryblkctl Use to set the query protocol type
-	 * @param maxblkext Maximum number of extra blocks
-	 * @param outovropt Output override option
-	 * @param qryrowset Query row set
-	 * @param qryclsimpl Implicit query close setting
-	 */
-	protected void setOPNQRYOptions(int blksize, int qryblkctl,
-			int maxblkext, int outovropt,int qryrowset,int qryclsimpl)
-	{
-		this.blksize = blksize;
-		setQryprctyp(qryblkctl);
-		this.maxblkext = maxblkext;
-		this.outovropt = outovropt;
-		this.qryrowset = qryrowset;
-		this.qryclsimp = (qryclsimpl == CodePoint.QRYCLSIMP_SERVER_CHOICE)
-			? DRDAResultSet.QRYCLSIMP_DEFAULT : qryclsimpl;
-
-		// Assume that we are returning data until a CNTQRY command
-		// tells us otherwise. (DERBY-822)
-		qryrtndta = true;
-
-		// For scrollable result sets, we don't know the fetch
-		// orientation until we get a CNTQRY command. Set orientation
-		// and row number to make pre-fetching possible. (DERBY-822)
-		qryscrorn = CodePoint.QRYSCRREL;
-		qryrownbr = 1;
-	}
+    protected boolean hasLobColumns() throws SQLException
+    {
+        ResultSetMetaData rsmd = rs.getMetaData();
+        int ncols = rsmd.getColumnCount();
+        for (int i = 1; i <= ncols; i++)
+        {
+            int type = rsmd.getColumnType(i);
+            if (type == Types.BLOB || type == Types.CLOB)
+                return true;
+        }
+        return false;
+    }
+
+    /**
+     * Get the cursor name for the ResultSet
+     */
+    public String getResultSetCursorName() throws SQLException
+    {
+
+        if (rs != null)
+            return rs.getCursorName();
+        else 
+            return null;
+    }
+
+    protected int getQryprctyp()
+        throws SQLException
+    {
+        if (!gotPrctyp && qryprctyp == CodePoint.LMTBLKPRC)
+        {
+            gotPrctyp = true;
+            if (rs == null || ((EngineResultSet)rs).isForUpdate() ||
+                /* for now we are not supporting LOB under LMTBLKPRC.  drda spec only
+                 * disallows LOB under LMTBLKPRC if OUTOVR is also for ANY CNTQRY reply.
+                 * To support LOB, QRYDTA protocols for LOB will need to be changed.
+                 */
+                hasLobColumns())
+            {
+                qryprctyp = CodePoint.FIXROWPRC;
+            }
+        }
+        return qryprctyp;
+    }
+
+    protected void setQryprctyp(int qryprctyp)
+    {
+        this.qryprctyp = qryprctyp;
+    }
+
+    /**
+     * is ResultSet closed
+     * @return whether the resultSet  is closed
+     */
+    protected boolean isClosed()
+    {
+        return (state == NOT_OPENED);
+    }
+
+    /**
+     * Set state to SUSPENDED (result set is opened)
+     */
+    protected void suspend()
+    {
+        state = SUSPENDED;
+    }
+
+
+    protected String toDebugString(String indent)
+    {
+        String s = indent + "***** DRDASResultSet toDebugString ******\n";
+        s += indent + "State:" + getStateString(state)+ "\n";
+        s += indent + "pkgcnstkn: {" + pkgcnstkn + "}\n"; 
+        s += indent + "cursor Name: ";
+        String cursorName = null;
+        try {
+            if (rs != null)
+                cursorName = rs.getCursorName();
+        }
+        catch (SQLException se )
+        {
+            cursorName = "invalid rs";
+        }
+        s += indent + cursorName + "\n";
+           
+        return s;
+    }
+
+
+    private String getStateString( int i )
+    {
+        switch (i)
+        {
+            case NOT_OPENED:
+                return "NOT_OPENED";
+            case SUSPENDED:
+                return "SUSPENDED";
+            default:
+                return "UNKNOWN_STATE";
+        }
+
+    }
+    
+    /**
+     * Sets the OPNQRYOptions. For more information on the meaning of these
+     * values consult the DRDA Technical Standard document. 
+     * 
+     * @param blksize Query block Size
+     * @param qryblkctl Use to set the query protocol type
+     * @param maxblkext Maximum number of extra blocks
+     * @param outovropt Output override option
+     * @param qryrowset Query row set
+     * @param qryclsimpl Implicit query close setting
+     */
+    protected void setOPNQRYOptions(int blksize, int qryblkctl,
+            int maxblkext, int outovropt,int qryrowset,int qryclsimpl)
+    {
+        this.blksize = blksize;
+        setQryprctyp(qryblkctl);
+        this.maxblkext = maxblkext;
+        this.outovropt = outovropt;
+        this.qryrowset = qryrowset;
+        this.qryclsimp = (qryclsimpl == CodePoint.QRYCLSIMP_SERVER_CHOICE)
+            ? DRDAResultSet.QRYCLSIMP_DEFAULT : qryclsimpl;
+
+        // Assume that we are returning data until a CNTQRY command
+        // tells us otherwise. (DERBY-822)
+        qryrtndta = true;
+
+        // For scrollable result sets, we don't know the fetch
+        // orientation until we get a CNTQRY command. Set orientation
+        // and row number to make pre-fetching possible. (DERBY-822)
+        qryscrorn = CodePoint.QRYSCRREL;
+        qryrownbr = 1;
+    }
 }



Mime
View raw message