db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpendle...@apache.org
Subject svn commit: r1497205 - /db/derby/code/trunk/java/engine/org/apache/derby/iapi/db/PropertyInfo.java
Date Thu, 27 Jun 2013 03:58:39 GMT
Author: bpendleton
Date: Thu Jun 27 03:58:38 2013
New Revision: 1497205

URL: http://svn.apache.org/r1497205
Log:
DERBY-6264: Improve test coverage of org.apache.derby.iapi.db.PropertyInfo

This patch was contributed by Ahsan Shamsudeen (ahsan dot competition at gmail dot com)

This patch removes several unused methods from the PropertyInfo class. These
classes were part of the original Cloudscape SQL-J language many years ago,
but are not used in Derby.

Removing the unused methods simplifies the class. Should we ever decide to
revive the features of the SQL-J language, we can recover these methods from
the older versions of the class in Subversion.


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/db/PropertyInfo.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/db/PropertyInfo.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/db/PropertyInfo.java?rev=1497205&r1=1497204&r2=1497205&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/db/PropertyInfo.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/db/PropertyInfo.java Thu Jun 27
03:58:38 2013
@@ -21,70 +21,29 @@
 
 package org.apache.derby.iapi.db;
 
-import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.error.PublicAPI;
+import org.apache.derby.iapi.error.StandardException;
 
 import org.apache.derby.iapi.sql.Activation;
 import org.apache.derby.iapi.sql.conn.Authorizer;
 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
 import org.apache.derby.iapi.sql.conn.ConnectionUtil;
 
-import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor;
-import org.apache.derby.iapi.sql.dictionary.DataDictionary;
-import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
-import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
-
-import org.apache.derby.iapi.store.access.ConglomerateController;
 import org.apache.derby.iapi.store.access.TransactionController;
-
-import org.apache.derby.iapi.services.property.PropertyUtil;
-
-import java.util.Properties;
 import java.sql.SQLException;
 
 /**
-  *	PropertyInfo is a class with static methods that retrieve the properties
-  * associated with a table or index and set and retrieve properties associated
-  * with a database.
+  *	PropertyInfo is a class with static methods that  set  properties associated with a database.
+  * 
   * 
   * <P>
   This class can only be used within an SQL-J statement, a Java procedure or a server side
Java method.
   <p>This class can be accessed using the class alias <code> PROPERTYINFO </code>
in SQL-J statements.
   */
+
 public final class PropertyInfo
 {
 
-    /**
-     * Get the Properties associated with a given table.
-     *
-	 * @param schemaName    The name of the schema that the table is in.
-	 * @param tableName     The name of the table.
-	 * 
-	 * @return Properties   The Properties associated with the specified table.
-     *                      (An empty Properties is returned if the table does not exist.)
-     * @exception SQLException on error
-     */
-    public static Properties getTableProperties(String schemaName, String tableName)
-        throws SQLException
-	{
-		return	PropertyInfo.getConglomerateProperties( schemaName, tableName, false );
-	}
-
-    /**
-     * Get the Properties associated with a given index.
-     *
-	 * @param schemaName    The name of the schema that the index is in.
-	 * @param indexName     The name of the index.
-	 * 
-	 * @return Properties   The Properties associated with the specified index.
-     *                      (An empty Properties is returned if the index does not exist.)
-     * @exception SQLException on error
-     */
-    public static Properties getIndexProperties(String schemaName, String indexName)
-        throws SQLException
-	{
-		return	PropertyInfo.getConglomerateProperties( schemaName, indexName, true );
-	}
 
 	/**
 		Set or delete the value of a property of the database on the current connection.
@@ -94,6 +53,7 @@ public final class PropertyInfo
 
 		@exception SQLException on error
 	*/
+	
 	public static void setDatabaseProperty(String key, String value) throws SQLException
 	{
 		LanguageConnectionContext lcc = ConnectionUtil.getCurrentLCC();
@@ -111,84 +71,8 @@ public final class PropertyInfo
 		}
 	}
 
-	/**
-	  Internal use only.
-	  */
+	
     private	PropertyInfo() {}
-
-
-	//////////////////////////////////////////////////////////////////////////////
-	//
-	//	PRIVATE METHODS
-	//
-	/////////////////////////////////////////////////////////////////////////////
-
-    /**
-     * Get the Properties associated with a given conglomerate
-     *
-	 * @param schemaName    	The name of the schema that the conglomerate is in.
-	 * @param conglomerateName  The name of the conglomerate.
-	 * 
-	 * @return Properties   The Properties associated with the specified conglomerate.
-     *                      (An empty Properties is returned if the conglomerate does not
exist.)
-     * @exception SQLException on error
-     */
-	private static Properties	getConglomerateProperties( String schemaName, String conglomerateName,
boolean isIndex )
-        throws SQLException
-	{
-		long					  conglomerateNumber;
-
-        // find the language context.
-        LanguageConnectionContext lcc = ConnectionUtil.getCurrentLCC();
-
-        // Get the current transaction controller
-        TransactionController tc = lcc.getTransactionExecute();
-
-		try {
-
-		// find the DataDictionary
-		DataDictionary dd = lcc.getDataDictionary();
-
-
-		// get the SchemaDescriptor
-		SchemaDescriptor sd = dd.getSchemaDescriptor(schemaName, tc, true);
-		if ( !isIndex)
-		{
-			// get the TableDescriptor for the table
-			TableDescriptor td = dd.getTableDescriptor(conglomerateName, sd, tc);
-
-			// Return an empty Properties if table does not exist or if it is for a view.
-			if ((td == null) || td.getTableType() == TableDescriptor.VIEW_TYPE) { return new Properties();
}
-
-			conglomerateNumber = td.getHeapConglomerateId();
-		}
-		else
-		{
-			// get the ConglomerateDescriptor for the index
-			ConglomerateDescriptor cd = dd.getConglomerateDescriptor(conglomerateName, sd, false);
-
-			// Return an empty Properties if index does not exist
-			if (cd == null) { return new Properties(); }
-
-			conglomerateNumber = cd.getConglomerateNumber();
-		}
-
-		ConglomerateController cc = tc.openConglomerate(
-                conglomerateNumber,
-                false,
-                0, 
-                TransactionController.MODE_RECORD,
-                TransactionController.ISOLATION_SERIALIZABLE);
-
-		Properties properties = tc.getUserCreateConglomPropList();
-		cc.getTableProperties( properties );
-
-		cc.close();
-        return properties;
-
-		} catch (StandardException se) {
-			throw PublicAPI.wrapStandardException(se);
-		}
-
-	}
+   
 }
+



Mime
View raw message