db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r426887 - in /db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij: AsyncStatement.java AttributeHolder.java Main.java ijResult.java utilMain.java utilMain14.java
Date Sun, 30 Jul 2006 14:40:09 GMT
Author: djd
Date: Sun Jul 30 07:40:08 2006
New Revision: 426887

URL: http://svn.apache.org/viewvc?rev=426887&view=rev
Log:
Minor cleanup in ij code, make methods non-public and remove an un-required method.

Modified:
    db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/AsyncStatement.java
    db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/AttributeHolder.java
    db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/Main.java
    db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ijResult.java
    db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain.java
    db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain14.java

Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/AsyncStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/AsyncStatement.java?rev=426887&r1=426886&r2=426887&view=diff
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/AsyncStatement.java (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/AsyncStatement.java Sun
Jul 30 07:40:08 2006
@@ -54,5 +54,5 @@
 		aStatement = null;
 	}
 
-	public ijResult getResult() { return result; }
+	ijResult getResult() { return result; }
 }

Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/AttributeHolder.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/AttributeHolder.java?rev=426887&r1=426886&r2=426887&view=diff
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/AttributeHolder.java (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/AttributeHolder.java Sun
Jul 30 07:40:08 2006
@@ -32,7 +32,7 @@
 import java.lang.reflect.Field;
 import java.sql.SQLException;
 
-public class AttributeHolder {
+class AttributeHolder {
 
     //This is an inner class.  This class hold the details about each
     //specific attribute which includes what the attribute is and
@@ -42,35 +42,35 @@
     String token;
     Vector errors = new Vector();
 
-    public String getName(){
+    String getName(){
       return name;
     }
-    public void setName(String aString){
+    void setName(String aString){
       name = aString;
     }
-    public String getValue(){
+    String getValue(){
       return value;
     }
-    public void setValue(String aString){
+    void setValue(String aString){
       value = aString;
     }
-    public String getToken(){
+    String getToken(){
       return token;
     }
-    public void setToken(String aString){
+    void setToken(String aString){
       token = aString;
     }
-    public void addError(String aString) {
+    void addError(String aString) {
       //Keep track of error message for later display.
       if (!errors.contains(aString))
         errors.addElement(aString);
     }
-    public void check( Vector validProps){
+    void check( Vector validProps){
       checkName( validProps);
       //checkValue();
       displayErrors();
     }
-    public void displayErrors(){
+    void displayErrors(){
       //If no error are found then nothing is displayed.
       Enumeration e = errors.elements();
       //In the first line, show the exact token that was parsed from
@@ -83,7 +83,7 @@
         displayIndented(aString);
       }
     }
-    public void checkName( Vector validProps){
+    void checkName( Vector validProps){
       if( validProps == null)
           return; // valid properties are unknown
       String anAtt = getName();
@@ -107,7 +107,7 @@
         ex.printStackTrace();
       }
     }
-    public void checkValue(){
+    void checkValue(){
       String anAtt = getName(); 
       String aValue = getValue();
       try {
@@ -122,16 +122,16 @@
         ex.printStackTrace();
       }
     }
-	  public boolean checkBoolean(String aValue) {
+	  boolean checkBoolean(String aValue) {
 		  if (aValue == null)
 			  return false;
 		  return aValue.toLowerCase(Locale.ENGLISH).equals("true") || 
 			  aValue.toLowerCase(Locale.ENGLISH).equals("false");
 	  }
-    public void display(String aString) {
+    void display(String aString) {
 		LocalizedResource.OutputWriter().println(aString);
     }
-    public void displayIndented(String aString) {
+    void displayIndented(String aString) {
 		LocalizedResource.OutputWriter().println("   " + aString);
     }
   }

Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/Main.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/Main.java?rev=426887&r1=426886&r2=426887&view=diff
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/Main.java (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/Main.java Sun Jul 30 07:40:08
2006
@@ -237,7 +237,7 @@
 	public Main(boolean trash)
 	{
 	}
-  public void initAppUI(){
+  private void initAppUI(){
     //To fix a problem in the AppUI implementation, a reference to the AppUI class is
     //maintained by this tool.  Without this reference, it is possible for the
     //AppUI class to be garbage collected and the initialization values lost.

Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ijResult.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ijResult.java?rev=426887&r1=426886&r2=426887&view=diff
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ijResult.java (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/ijResult.java Sun Jul 30
07:40:08 2006
@@ -35,7 +35,7 @@
  * @author ames
  *
  */
-public interface ijResult {
+interface ijResult {
 	boolean isConnection();
 	boolean isStatement();
 	boolean isResultSet() throws SQLException;

Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain.java?rev=426887&r1=426886&r2=426887&view=diff
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain.java (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain.java Sun Jul 30
07:40:08 2006
@@ -132,7 +132,7 @@
 		charStream = new UCode_CharStream(
 						new StringReader(" "), 1, 1);
 		ijTokMgr = new ijTokenManager(charStream);
-		ijParser = new ij(ijTokMgr, getUtilMain());
+		ijParser = new ij(ijTokMgr, this);
 		this.out = out;
 		this.ignoreErrors = ignoreErrors;
 
@@ -496,7 +496,7 @@
 	 * are fatal, an ijFatalException is thrown.
 	 * Lifted from ij/util.java:ShowSQLException
 	 */
-	public void handleSQLException(LocalizedOutput out, SQLException e) 
+	private void handleSQLException(LocalizedOutput out, SQLException e) 
 		throws ijFatalException
 	{
 		String errorCode;
@@ -601,14 +601,6 @@
 
 	// JDBC 2.0 support
 
-	/**
-	 * Return the right utilMain to use.  (JDBC 1.1 or 2.0)
-	 *
-	 */
-	public utilMain getUtilMain()
-	{
-		return this;
-	}
 
 	/**
 	 * Connections by default create ResultSet objects with holdability true. This method can
be used
@@ -620,7 +612,7 @@
 	 *
 	 * @return	The connection object with holdability set to passed value.
 	 */
-	public Connection setHoldability(Connection conn, int holdType)
+	Connection setHoldability(Connection conn, int holdType)
 		throws SQLException
 	{
     //Prior to db2 compatibility work, the default holdability for connections was close
cursors over commit and all the tests
@@ -645,7 +637,7 @@
 	 * or ResultSet.CLOSE_CURSORS_AT_COMMIT
 	 *
 	 */
-	public int getHoldability(Connection conn)
+	int getHoldability(Connection conn)
 		throws SQLException
 	{
     //this method is used to make sure we are not trying to create a statement with holdability
different than the connection holdability
@@ -673,7 +665,7 @@
 	 *
 	 * @return	The statement.
 	 */
-	public Statement createStatement(Connection conn, int scrollType, int holdType)
+	Statement createStatement(Connection conn, int scrollType, int holdType)
 		throws SQLException
 	{
     	//following if is used to make sure we are not trying to create a statement with holdability
different that the connection
@@ -710,18 +702,11 @@
 	 * @exception	SQLException thrown on error.
 	 *				(absolute() not supported pre-JDBC2.0)
 	 */
-	public ijResult absolute(ResultSet rs, int row)
+	ijResult absolute(ResultSet rs, int row)
 		throws SQLException
 	{
-        boolean forwardOnly;
-    	try {
-		// absolute is only allowed on scroll cursors
-		    forwardOnly = (rs.getStatement().getResultSetType() == JDBC20Translation.TYPE_FORWARD_ONLY);
-        } catch (AbstractMethodError ame) {
-        //because weblogic 4.5 doesn't yet implement jdbc 2.0 interfaces, need to go back
-        //to jdbc 1.x functionality
-            forwardOnly = true;
-        }
+        boolean forwardOnly = (rs.getStatement().getResultSetType() == JDBC20Translation.TYPE_FORWARD_ONLY);
+
         if (forwardOnly)
 		{
 			throw ijException.forwardOnlyCursor("ABSOLUTE");
@@ -743,18 +728,12 @@
 	 * @exception	SQLException thrown on error.
 	 *				(relative() not supported pre-JDBC2.0)
 	 */
-	public ijResult relative(ResultSet rs, int row)
+	ijResult relative(ResultSet rs, int row)
 		throws SQLException
 	{
-    	boolean forwardOnly;
-        try {
-        	forwardOnly = (rs.getStatement().getResultSetType() == JDBC20Translation.TYPE_FORWARD_ONLY);
-        } catch (AbstractMethodError ame) {
-        //because weblogic 4.5 doesn't yet implement jdbc 2.0 interfaces, need to go back
-        //to jdbc 1.x functionality
-            forwardOnly = true;
-        }
-		// relative is only allowed on scroll cursors
+    	boolean forwardOnly = (rs.getStatement().getResultSetType() == JDBC20Translation.TYPE_FORWARD_ONLY);
+
+    	// relative is only allowed on scroll cursors
 		if (forwardOnly)
 		{
 			throw ijException.forwardOnlyCursor("RELATIVE");
@@ -774,18 +753,12 @@
 	 * @exception	SQLException thrown on error.
 	 *				(beforeFirst() not supported pre-JDBC2.0)
 	 */
-	public ijResult beforeFirst(ResultSet rs)
+	ijResult beforeFirst(ResultSet rs)
 		throws SQLException
 	{
-    	boolean forwardOnly;
-        try {
-        	forwardOnly = (rs.getStatement().getResultSetType() == JDBC20Translation.TYPE_FORWARD_ONLY);
-        } catch (AbstractMethodError ame) {
-        //because weblogic 4.5 doesn't yet implement jdbc 2.0 interfaces, need to go back
-        //to jdbc 1.x functionality
-            forwardOnly = true;
-        }
-		// before first is only allowed on scroll cursors
+    	boolean forwardOnly = (rs.getStatement().getResultSetType() == JDBC20Translation.TYPE_FORWARD_ONLY);
+
+    	// before first is only allowed on scroll cursors
 		if (forwardOnly)
 		{
 			throw ijException.forwardOnlyCursor("BEFORE FIRST");
@@ -806,18 +779,12 @@
 	 * @exception	SQLException thrown on error.
 	 *				(first() not supported pre-JDBC2.0)
 	 */
-	public ijResult first(ResultSet rs)
+	ijResult first(ResultSet rs)
 		throws SQLException
 	{
-    	boolean forwardOnly;
-        try {
-        	forwardOnly = (rs.getStatement().getResultSetType() == JDBC20Translation.TYPE_FORWARD_ONLY);
-        } catch (AbstractMethodError ame) {
-        //because weblogic 4.5 doesn't yet implement jdbc 2.0 interfaces, need to go back
-        //to jdbc 1.x functionality
-            forwardOnly = true;
-        }
-		// first is only allowed on scroll cursors
+    	boolean forwardOnly = (rs.getStatement().getResultSetType() == JDBC20Translation.TYPE_FORWARD_ONLY);
+
+    	// first is only allowed on scroll cursors
 		if (forwardOnly)
 		{
 			throw ijException.forwardOnlyCursor("FIRST");
@@ -837,7 +804,7 @@
 	 * @exception	SQLException thrown on error.
 	 *				(afterLast() not supported pre-JDBC2.0)
 	 */
-	public ijResult afterLast(ResultSet rs)
+	ijResult afterLast(ResultSet rs)
 		throws SQLException
 	{
     	boolean forwardOnly;
@@ -869,17 +836,11 @@
 	 * @exception	SQLException thrown on error.
 	 *				(last() not supported pre-JDBC2.0)
 	 */
-	public ijResult last(ResultSet rs)
+	ijResult last(ResultSet rs)
 		throws SQLException
 	{
-    	boolean forwardOnly;
-        try {
-        	forwardOnly = (rs.getStatement().getResultSetType() == JDBC20Translation.TYPE_FORWARD_ONLY);
-        } catch (AbstractMethodError ame) {
-        //because weblogic 4.5 doesn't yet implement jdbc 2.0 interfaces, need to go back
-        //to jdbc 1.x functionality
-            forwardOnly = true;
-        }
+    	boolean forwardOnly = (rs.getStatement().getResultSetType() == JDBC20Translation.TYPE_FORWARD_ONLY);
+
 		// last is only allowed on scroll cursors
 		if (forwardOnly)
 		{
@@ -900,18 +861,12 @@
 	 * @exception	SQLException thrown on error.
 	 *				(previous() not supported pre-JDBC2.0)
 	 */
-	public ijResult previous(ResultSet rs)
+	ijResult previous(ResultSet rs)
 		throws SQLException
 	{
-    	boolean forwardOnly;
-        try {
-        	forwardOnly = (rs.getStatement().getResultSetType() == JDBC20Translation.TYPE_FORWARD_ONLY);
-        } catch (AbstractMethodError ame) {
-        //because weblogic 4.5 doesn't yet implement jdbc 2.0 interfaces, need to go back
-        //to jdbc 1.x functionality
-            forwardOnly = true;
-        }
-		// first is only allowed on scroll cursors
+    	boolean forwardOnly = (rs.getStatement().getResultSetType() == JDBC20Translation.TYPE_FORWARD_ONLY);
+ 
+    	// first is only allowed on scroll cursors
 		if (forwardOnly)
 		{
 			throw ijException.forwardOnlyCursor("PREVIOUS");
@@ -930,19 +885,11 @@
 	 * @exception	SQLException thrown on error.
 	 *				(getRow() not supported pre-JDBC2.0)
 	 */
-	public int getCurrentRowNumber(ResultSet rs)
+	int getCurrentRowNumber(ResultSet rs)
 		throws SQLException
 	{
-		boolean forwardOnly;
-		try 
-		{
-			forwardOnly = (rs.getStatement().getResultSetType() == JDBC20Translation.TYPE_FORWARD_ONLY);
-		} catch (AbstractMethodError ame) 
-		{
-			//because weblogic 4.5 doesn't yet implement jdbc 2.0 interfaces, need to go back
-			//to jdbc 1.x functionality
-			forwardOnly = true;
-        }
+
+		boolean forwardOnly = (rs.getStatement().getResultSetType() == JDBC20Translation.TYPE_FORWARD_ONLY);
 
 		// getCurrentRow is only allowed on scroll cursors
 		if (forwardOnly)
@@ -953,7 +900,7 @@
 		return rs.getRow();
 	}
 
-	public Properties getConnAttributeDefaults ()
+	Properties getConnAttributeDefaults ()
 	{
 		return connAttributeDefaults;
 	}

Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain14.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain14.java?rev=426887&r1=426886&r2=426887&view=diff
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain14.java (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/ij/utilMain14.java Sun Jul
30 07:40:08 2006
@@ -71,15 +71,6 @@
 	}
 
 	/**
-	 * Return the right utilMain to use.  (JDBC 1.1 or 2.0 or 3.0)
-	 *
-	 */
-	public utilMain getUtilMain()
-	{
-		return this;
-	}
-
-	/**
 	 * Connections by default create ResultSet objects with holdability true. This method can
be used
 	 * to change the holdability of the connection by passing one of ResultSet.HOLD_CURSORS_OVER_COMMIT
 	 * or ResultSet.CLOSE_CURSORS_AT_COMMIT
@@ -89,7 +80,7 @@
 	 *
 	 * @return	The connection object with holdability set to passed value.
 	 */
-	public Connection setHoldability(Connection conn, int holdType)
+	Connection setHoldability(Connection conn, int holdType)
 		throws SQLException
 	{
 		conn.setHoldability(holdType);
@@ -106,7 +97,7 @@
 	 * or ResultSet.CLOSE_CURSORS_AT_COMMIT
 	 *
 	 */
-	public int getHoldability(Connection conn)
+	int getHoldability(Connection conn)
 		throws SQLException
 	{
 		return conn.getHoldability();
@@ -121,7 +112,7 @@
 	 *
 	 * @return	The statement.
 	 */
-	public Statement createStatement(Connection conn, int scrollType, int holdType)
+	Statement createStatement(Connection conn, int scrollType, int holdType)
 		throws SQLException
 	{
     	Statement stmt;



Mime
View raw message