db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r559143 - in /db/derby/code/trunk/java: drda/org/apache/derby/impl/drda/ engine/org/apache/derby/iapi/jdbc/
Date Tue, 24 Jul 2007 18:07:41 GMT
Author: djd
Date: Tue Jul 24 11:07:39 2007
New Revision: 559143

URL: http://svn.apache.org/viewvc?view=rev&rev=559143
Log:
Minor cleanup in the DRDA code. Remove several methods that are not called.
Remove the JDBC3 version method from EngineConnection as JDBC3 is the minimal supported level
now.

Modified:
    db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DDMWriter.java
    db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAResultSet.java
    db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAStatement.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/EngineConnection.java

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DDMWriter.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DDMWriter.java?view=diff&rev=559143&r1=559142&r2=559143
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DDMWriter.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DDMWriter.java Tue Jul 24 11:07:39
2007
@@ -21,22 +21,21 @@
 
 package org.apache.derby.impl.drda;
 
-import java.io.OutputStream;
-import java.io.InputStream;
 import java.io.BufferedOutputStream;
-import org.apache.derby.iapi.services.sanity.SanityManager;
-import java.sql.SQLException;
-import java.math.BigDecimal;
-import java.util.Arrays;
-import org.apache.derby.iapi.reference.Property;
-import org.apache.derby.iapi.services.property.PropertyUtil;
-
 import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
 import java.nio.ByteBuffer;
 import java.nio.CharBuffer;
 import java.nio.charset.CharsetEncoder;
 import java.nio.charset.CoderResult;
 import java.nio.charset.CodingErrorAction;
+import java.sql.SQLException;
+import java.util.Arrays;
+
+import org.apache.derby.iapi.reference.Property;
+import org.apache.derby.iapi.services.property.PropertyUtil;
+import org.apache.derby.iapi.services.sanity.SanityManager;
 
 /**
 	The DDMWriter is used to write DRDA protocol.   The DRDA Protocol is
@@ -554,8 +553,6 @@
 
 	protected void writeLDBytes(byte[] buf, int index)
 	{
-
-		int length = buf.length;
 		int writeLen =  buf.length;
 
 		writeShort(writeLen);
@@ -845,16 +842,6 @@
   }
 
 
-	private void writeExtendedLengthBytes (int extendedLengthByteCount, long length)
-	{
-	int shiftSize = (extendedLengthByteCount -1) * 8;
-    for (int i = 0; i < extendedLengthByteCount; i++) {
-      buffer.put((byte) (length >>> shiftSize));
-      shiftSize -= 8;
-    }
-  }
-
-
   // insert a 4 byte length/codepoint pair into the buffer.
   // total of 4 bytes inserted in buffer.
   // Note: the length value inserted in the buffer is the same as the value
@@ -1248,16 +1235,16 @@
 	protected void flush(OutputStream socketOutputStream)
 		throws java.io.IOException
 	{
-		final int offset = buffer.position();
+		final int length = buffer.position();
 		try {
-			socketOutputStream.write (bytes, 0, offset);
+			socketOutputStream.write (bytes, 0, length);
 			socketOutputStream.flush();
 		}
 		finally {
 			if ((dssTrace != null) && dssTrace.isComBufferTraceOn()) {
 			  dssTrace.writeComBufferData (bytes,
 			                               0,
-			                               offset,
+                                           length,
 			                               DssTrace.TYPE_TRACE_SEND,
 			                               "Reply",
 			                               "flush",
@@ -1523,7 +1510,7 @@
 				agent.trace("DANGER - Expensive expansion of  buffer");
 			}
 			int newLength =
-				Math.max(buffer.capacity() << 1, buffer.position() + length);
+				Math.max(buffer.capacity() * 2, buffer.position() + length);
 			// copy the old buffer into a new one
 			buffer.flip();
 			buffer = ByteBuffer.allocate(newLength).put(buffer);

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?view=diff&rev=559143&r1=559142&r2=559143
==============================================================================
--- 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 Tue Jul 24
11:07:39 2007
@@ -110,16 +110,12 @@
 	 * 
 	 */
 
-	protected void setResultSet(ResultSet value) throws SQLException
+	void setResultSet(ResultSet value) throws SQLException
 	{
-		int numCols;
 		rs = value;
 		gotPrctyp = false;
-		if (value != null)
-		{
-		    numCols= rs.getMetaData().getColumnCount();
-			rsDRDATypes = new int[numCols];
-		}
+		int numCols= rs.getMetaData().getColumnCount();
+		rsDRDATypes = new int[numCols];
 		explicitlyClosed = false;
 	}
 
@@ -152,16 +148,6 @@
 		return splitQRYDTA;
 	}
 
-	/** 
-	 * Set ResultSet DRDA DataTypes
-	 * @param value drdaTypes for columns.
-	 **/
-	protected void setRsDRDATypes(int [] value)
-	{
-		rsDRDATypes = value;
-
-	}
-
 	/**
 	 *@return ResultSet DRDA DataTypes
 	 **/
@@ -253,20 +239,6 @@
         return rsDRDATypes[index -1];
 	}
 	
-
-	/**
-	 * set resultset DRDA Len
-	 *
-	 * @param index - starting with 1
-	 * @param value
-	 */
-	protected  void setRsLen(int index, int value)
-	{
-		if (rsLens == null)
-			rsLens = new int[rsDRDATypes.length];
-		rsLens[index -1] = value;
-		
-	}
 	
 	/**
 	 * get  resultset  DRDALen

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAStatement.java?view=diff&rev=559143&r1=559142&r2=559143
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAStatement.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAStatement.java Tue Jul 24
11:07:39 2007
@@ -814,40 +814,6 @@
 	{
 		return currentDrdaRs.getResultSet();
 	}
-
-	
-	/** 
-	 * Just get the resultset. Don't set it to current
-	 * Assumes resultSet rsnum exists.
-	 *
-	 * @param rsNum resultSetNumber starting with 0
-	 * @return  The result set in the order it was retrieved
-	 *         
-	 *          with getMoreResults()
-	 **/
-	private  ResultSet getResultSet(int rsNum)  
-	{
-		if (rsNum == 0)
-			return currentDrdaRs.getResultSet();
-		else
-		{
-			ConsistencyToken key = (ConsistencyToken) resultSetKeyList.get(rsNum);
-			return ((DRDAResultSet) (resultSetTable.get( key))).getResultSet();
-		}
-	}
-
-	/**
- 	 * Set result set
-	 *
-	 * @param value
-	 */
-	protected void setResultSet(ResultSet value) throws SQLException
-	{
-		if (currentDrdaRs.getResultSet() == null)
-			numResultSets = 1;
-		currentDrdaRs.setResultSet(value);
-		setRsDefaultOptions(currentDrdaRs);
-	}
 	
 	/**
 	 * Gets the current DRDA ResultSet
@@ -992,15 +958,6 @@
 	}
 
 
-	/** 
-	 * Set ResultSet DRDA DataTypes
-	 * @param value drdaTypes for columns.
-	 **/
-	protected void setRsDRDATypes(int [] value)
-	{
-		currentDrdaRs.setRsDRDATypes(value);
-	}
-
 	/**
 	 *@return ResultSet DRDA DataTypes
 	 **/
@@ -1012,25 +969,6 @@
 	}
 
 
-	/** 
-	 * Set ResultSet DRDA DataTypes Lengths
-	 * @param value drdaTypes for columns.
-	 **/
-	protected void setRsLens(int [] value)
-	{
-		currentDrdaRs.rsLens = value;
-
-	}
-
-	/**
-	 *@return ResultSet DRDA DataTypes Lengths
-	 **/
-
-	protected int[] getRsLens()
-	{
-		return currentDrdaRs.rsLens;
-	}
-
 	/**
 	 *  Close the current resultSet
 	 */
@@ -1360,16 +1298,6 @@
 	}
 
 	/**
-	 * set resultset column data length
-	 * @param index starting with 1
-	 * @param value length
-	 */
-	protected void  setRsLen(int index, int value)
-	{
-		currentDrdaRs.setRsLen(index,value);
-	}
-
-	/**
 	 * @param rsNum  - result set # starting with 0 
 	 */
 	public String getResultSetCursorName(int rsNum) throws SQLException
@@ -1381,9 +1309,7 @@
 
 
 	protected String toDebugString(String indent)
-	{
-		ResultSet rs = currentDrdaRs.getResultSet();
-		
+	{		
 		String s ="";
 		if (ps == null) 
 			s += indent + ps;
@@ -1674,8 +1600,8 @@
 
 
 	/**
-	 *  prepare a statement using EngineConnection.prepareStatement
-     *  so that server can run on jdk131 and still pass holdability.  
+	 *  prepare a statement using Connection.prepareStatement.
+     *  
 	 *  @param sqlStmt - SQL statement text
 	 *  @param scrollType - scroll type
 	 *  @param concurType - concurrency type
@@ -1751,35 +1677,6 @@
 		}
 		return retVal;
 
-	}
-
-	/** helper method to handle exceptions generated by methods invoked 
-	 * through  reflection.
-	 * @param e - exception thrown
-	 * @throws SQLException - actual exception that occurred
-	 */
-	private void handleReflectionException(Exception e) throws SQLException
-	{
-		if  (e instanceof InvocationTargetException) 
-		{
-			Throwable t = ((InvocationTargetException) e).getTargetException();
-			
-			if (t  instanceof SQLException)
-			{
-				throw (SQLException) t;
-			}
-			else
-			{
-				t.printStackTrace();
-				throw Util.javaException(t);
-			}
-		}
-		else
-			// invoke can throw IllegalAccessException or 
-			// IllegalArgumentException, but these should not 
-			// occur from this code. Just in case we will throw it
-			throw Util.javaException(e);
-		
 	}
 	
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/EngineConnection.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/EngineConnection.java?view=diff&rev=559143&r1=559142&r2=559143
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/EngineConnection.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/jdbc/EngineConnection.java Tue Jul
24 11:07:39 2007
@@ -63,17 +63,6 @@
         throws SQLException;
 
     /**
-     * Prepare a statement with holdability.
-     * Identical to JDBC 3.0 method, to allow holdabilty
-     * to be supported in JDK 1.3 by the network server,
-     * e.g. when the client is jdk 1.4 or above.
-     * Can be removed once JDK 1.3 is no longer supported.
-     */
-    public PreparedStatement prepareStatement(String sql, int resultSetType,
-            int resultSetConcurrency, int resultSetHoldability)
-            throws SQLException;
-
-    /**
      * Get the holdability of the connection. 
      * Identical to JDBC 3.0 method, to allow holdabilty
      * to be supported in JDK 1.3 by the network server,



Mime
View raw message