db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r434083 - in /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog: SYSCHECKSRowFactory.java SYSCOLPERMSRowFactory.java SYSDUMMY1RowFactory.java SYSFILESRowFactory.java
Date Wed, 23 Aug 2006 17:12:02 GMT
Author: djd
Date: Wed Aug 23 10:12:01 2006
New Revision: 434083

URL: http://svn.apache.org/viewvc?rev=434083&view=rev
Log:
DERBY-1734 (partial) Switch to simpler definition of system columns for SYSCHECKS, SYSCOLPERMS,
SYSDUMMY1 and SYSFILES.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSCHECKSRowFactory.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSCOLPERMSRowFactory.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSDUMMY1RowFactory.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSFILESRowFactory.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSCHECKSRowFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSCHECKSRowFactory.java?rev=434083&r1=434082&r2=434083&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSCHECKSRowFactory.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSCHECKSRowFactory.java
Wed Aug 23 10:12:01 2006
@@ -55,6 +55,7 @@
 import org.apache.derby.iapi.services.uuid.UUIDFactory;
 import org.apache.derby.catalog.UUID;
 
+import java.sql.Types;
 import java.util.Properties;
 
 /**
@@ -63,18 +64,16 @@
  * @author jerry
  */
 
-public class SYSCHECKSRowFactory extends CatalogRowFactory
+class SYSCHECKSRowFactory extends CatalogRowFactory
 {
 	private  static final String	TABLENAME_STRING = "SYSCHECKS";
 
-	protected static final int		SYSCHECKS_COLUMN_COUNT = 3;
-	protected static final int		SYSCHECKS_CONSTRAINTID = 1;
-	protected static final int		SYSCHECKS_CHECKDEFINITION = 2;
-	protected static final int		SYSCHECKS_REFERENCEDCOLUMNS = 3;
-
-	// Column widths
-	protected static final int		SYSCHECKS_CONSTRAINTID_WIDTH = 36;
-	protected static final int		SYSCHECKS_INDEX1_ID = 0;
+	private static final int		SYSCHECKS_COLUMN_COUNT = 3;
+	private static final int		SYSCHECKS_CONSTRAINTID = 1;
+	private static final int		SYSCHECKS_CHECKDEFINITION = 2;
+	private static final int		SYSCHECKS_REFERENCEDCOLUMNS = 3;
+
+	static final int		SYSCHECKS_INDEX1_ID = 0;
 
 	// index is unique.
     private	static	final	boolean[]	uniqueness = null;
@@ -99,7 +98,6 @@
 	//
 	/////////////////////////////////////////////////////////////////////////////
 
-    public
 	SYSCHECKSRowFactory(UUIDFactory uuidf, ExecutionFactory ef, DataValueFactory dvf,
                                  boolean convertIdToLower)
 	{
@@ -261,50 +259,14 @@
 	 *
 	 * @return array of SystemColumn suitable for making this catalog.
 	 */
-	public SystemColumn[]	buildColumnList()
-	{
-		int						index = 0;
-		int						columnNumber = 1;
-		SystemColumn[]			columnList = new SystemColumn[SYSCHECKS_COLUMN_COUNT];
-
-		// describe columns
-
-		columnList[index++] = new SystemColumnImpl(	
-							convertIdCase( "CONSTRAINTID"),			// name 
-							SYSCHECKS_CONSTRAINTID,	// column number
-							0,					// precision
-							0,					// scale
-							false,				// nullability
-							"CHAR",				// dataType
-							true,				// built-in type
-							36					// maxLength
-			                );
-		columnList[index++] = 
-					new SystemColumnImpl(	
-							convertIdCase( "CHECKDEFINITION"),		// column name
-							SYSCHECKS_CHECKDEFINITION,	// column number
-							0,					// precision
-							0,					// scale
-							false,				// nullability
-							"LONG VARCHAR",	    // dataType
-							true,				// built-in type
-							TypeId.LONGVARCHAR_MAXWIDTH // maxLength
-			               );
-		columnList[index++] = 
-					new SystemColumnImpl(	
-							convertIdCase( "REFERENCEDCOLUMNS"),		// column name
-							SYSCHECKS_REFERENCEDCOLUMNS,	// column number
-							0,					// precision
-							0,					// scale
-							false,				// nullability
-							"org.apache.derby.catalog.ReferencedColumns",	// datatype
-							false,				// built-in type
-							TypeDescriptor.MAXIMUM_WIDTH_UNKNOWN
-												// maxLength
-			               );
-
-
-		return	columnList;
-	}
 
+    public SystemColumn[] buildColumnList() {
+        
+       return new SystemColumn[] {
+            SystemColumnImpl.getUUIDColumn("CONSTRAINTID", false),
+            SystemColumnImpl.getColumn("CHECKDEFINITION", Types.LONGVARCHAR, false),
+            SystemColumnImpl.getJavaColumn("REFERENCEDCOLUMNS",
+                    "org.apache.derby.catalog.ReferencedColumns", false)             
+        };
+    }
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSCOLPERMSRowFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSCOLPERMSRowFactory.java?rev=434083&r1=434082&r2=434083&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSCOLPERMSRowFactory.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSCOLPERMSRowFactory.java
Wed Aug 23 10:12:01 2006
@@ -54,7 +54,7 @@
  *
  */
 
-public class SYSCOLPERMSRowFactory extends PermissionsCatalogRowFactory
+class SYSCOLPERMSRowFactory extends PermissionsCatalogRowFactory
 {
 	static final String TABLENAME_STRING = "SYSCOLPERMS";
 
@@ -67,9 +67,9 @@
     private static final int COLUMNS_COL_NUM = 6;
     private static final int COLUMN_COUNT = 6;
 
-    public static final int GRANTEE_TABLE_TYPE_GRANTOR_INDEX_NUM = 0;
-    public static final int COLPERMSID_INDEX_NUM = 1;
-    public static final int TABLEID_INDEX_NUM = 2;
+    static final int GRANTEE_TABLE_TYPE_GRANTOR_INDEX_NUM = 0;
+    static final int COLPERMSID_INDEX_NUM = 1;
+    static final int TABLEID_INDEX_NUM = 2;
 	private static final int[][] indexColumnPositions = 
 	{ 
 		{ GRANTEE_COL_NUM, TABLEID_COL_NUM, TYPE_COL_NUM, GRANTOR_COL_NUM},
@@ -90,7 +90,7 @@
 
     private SystemColumn[] columnList;
 
-    public SYSCOLPERMSRowFactory(UUIDFactory uuidf, ExecutionFactory ef, DataValueFactory
dvf,
+    SYSCOLPERMSRowFactory(UUIDFactory uuidf, ExecutionFactory ef, DataValueFactory dvf,
                                  boolean convertIdToLower)
 	{
 		super(uuidf,ef,dvf,convertIdToLower);
@@ -170,71 +170,18 @@
     } // end of buildDescriptor
 
 	/** builds a column list for the catalog */
-	public SystemColumn[] buildColumnList()
+    public SystemColumn[] buildColumnList()
     {
-		if (columnList == null)
-        {
-            columnList = new SystemColumn[ COLUMN_COUNT];
-
-            columnList[ COLPERMSID_COL_NUM - 1] =
-                new SystemColumnImpl( convertIdCase( "COLPERMSID"),
-                                      COLPERMSID_COL_NUM,
-                                      0, // precision
-                                      0, // scale
-                                      false, // nullability
-                                      "CHAR",
-                                      true,
-                                      36);
-            columnList[ GRANTEE_COL_NUM - 1] =
-              new SystemColumnImpl( convertIdCase( "GRANTEE"),
-                                    GRANTEE_COL_NUM,
-                                    0, // precision
-                                    0, // scale
-                                    false, // nullability
-                                    AUTHORIZATION_ID_TYPE,
-                                    AUTHORIZATION_ID_IS_BUILTIN_TYPE,
-                                    AUTHORIZATION_ID_LENGTH);
-            columnList[ GRANTOR_COL_NUM - 1] =
-              new SystemColumnImpl( convertIdCase( "GRANTOR"),
-                                    GRANTOR_COL_NUM,
-                                    0, // precision
-                                    0, // scale
-                                    false, // nullability
-                                    AUTHORIZATION_ID_TYPE,
-                                    AUTHORIZATION_ID_IS_BUILTIN_TYPE,
-                                    AUTHORIZATION_ID_LENGTH);
-            columnList[ TABLEID_COL_NUM - 1] =
-              new SystemColumnImpl( convertIdCase( "TABLEID"),
-                                    TABLEID_COL_NUM,
-                                    0, // precision
-                                    0, // scale
-                                    false, // nullability
-                                    "CHAR", // dataType
-                                    true, // built-in type
-                                    36);
-            columnList[ TYPE_COL_NUM - 1] =
-              new SystemColumnImpl( convertIdCase( "TYPE"),
-                                    TYPE_COL_NUM,
-                                    0, // precision
-                                    0, // scale
-                                    false, // nullability
-                                    "CHAR", // dataType
-                                    true, // built-in type
-                                    1);
-            columnList[ COLUMNS_COL_NUM - 1] =
-              new SystemColumnImpl( convertIdCase( "COLUMNS"),
-                                    COLUMNS_COL_NUM,
-                                    0, // precision
-                                    0, // scale
-                                    false, // nullability
-                                    "org.apache.derby.iapi.services.io.FormatableBitSet",
// datatype
-                                    false,							// built-in type
-                                    DataTypeDescriptor.MAXIMUM_WIDTH_UNKNOWN // maxLength
-                  );
-        }
-		return columnList;
-    } // end of buildColumnList
-
+        return new SystemColumn[] {
+           SystemColumnImpl.getUUIDColumn("COLPERMSID", false),
+           SystemColumnImpl.getIdentifierColumn("GRANTEE", false),
+           SystemColumnImpl.getIdentifierColumn("GRANTOR", false),
+           SystemColumnImpl.getUUIDColumn("TABLEID", false),
+           SystemColumnImpl.getIndicatorColumn("TYPE"),
+           SystemColumnImpl.getJavaColumn("COLUMNS",
+                   "org.apache.derby.iapi.services.io.FormatableBitSet", false)    
+        };
+    }
 	/**
 	 * builds an empty row given for a given index number.
 	 */

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSDUMMY1RowFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSDUMMY1RowFactory.java?rev=434083&r1=434082&r2=434083&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSDUMMY1RowFactory.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSDUMMY1RowFactory.java
Wed Aug 23 10:12:01 2006
@@ -21,6 +21,8 @@
 
 package org.apache.derby.impl.sql.catalog;
 
+import java.sql.Types;
+
 import org.apache.derby.iapi.sql.dictionary.SystemColumn;
 import org.apache.derby.iapi.sql.dictionary.TupleDescriptor;
 import org.apache.derby.iapi.sql.dictionary.DataDictionary;
@@ -46,16 +48,8 @@
  *
  */
 
-public class SYSDUMMY1RowFactory extends CatalogRowFactory
+class SYSDUMMY1RowFactory extends CatalogRowFactory
 {
-	static final String TABLENAME_STRING = "SYSDUMMY1";
-
-	/* column #s for sysstatistics (1 based) */
-	
-	/* only column
-	*/
-	protected static final int 	SYSDUMMY1_IBMREQD = 1;
-
 	protected static final int SYSDUMMY1_COLUMN_COUNT = 1;
 
 	private static final String[] uuids =
@@ -63,22 +57,18 @@
 		"c013800d-00f8-5b70-bea3-00000019ed88", // catalog UUID
 		"c013800d-00f8-5b70-fee8-000000198c88"  // heap UUID.
 	};
-	/*
-	 * STATE
-	 */
-	private	SystemColumn[]		columnList;
 
 	/*
 	 *	CONSTRUCTORS
 	 */
-    public	SYSDUMMY1RowFactory(UUIDFactory uuidf, 
+    SYSDUMMY1RowFactory(UUIDFactory uuidf, 
 									ExecutionFactory ef, 
 									DataValueFactory dvf,
                                     boolean convertIdToLower)
 	{
 		super(uuidf,ef,dvf,convertIdToLower);
 		
-		initInfo(SYSDUMMY1_COLUMN_COUNT, TABLENAME_STRING, 
+		initInfo(SYSDUMMY1_COLUMN_COUNT, "SYSDUMMY1", 
 				 null, null, uuids);
 	}
 
@@ -124,24 +114,10 @@
 	 * @return array of SystemColumn suitable for making this catalog.
 	 */
 	public SystemColumn[] buildColumnList()
-	{
-		if (columnList != null)
-			return columnList;
-
-		columnList = new SystemColumn[SYSDUMMY1_COLUMN_COUNT];
-		
-		columnList[0] = new SystemColumnImpl(
-						   convertIdCase( "IBMREQD"),			// column name
-						   SYSDUMMY1_IBMREQD,    // column number
-						   0,					// precision
-						   0,					// scale
-						   true,				// nullability
-						   "CHAR",				// dataType
-						   true,				// built-in type
-						   1					// maxLength
-						   );
-		
-		return columnList;
+	{        
+        return new SystemColumn[] {
+                SystemColumnImpl.getColumn("IBMREQD", Types.CHAR, true, 1)
+        };
 	}
 
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSFILESRowFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSFILESRowFactory.java?rev=434083&r1=434082&r2=434083&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSFILESRowFactory.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSFILESRowFactory.java
Wed Aug 23 10:12:01 2006
@@ -46,6 +46,8 @@
 import org.apache.derby.iapi.services.uuid.UUIDFactory;
 import org.apache.derby.catalog.TypeDescriptor;
 import org.apache.derby.catalog.UUID;
+
+import java.sql.Types;
 import java.util.Properties;
 
 /**
@@ -56,27 +58,27 @@
  * @author Rick Hillegas (extracted from DataDictionaryImpl).
  */
 
-public class SYSFILESRowFactory extends CatalogRowFactory
+class SYSFILESRowFactory extends CatalogRowFactory
 {
-	protected static final String	TABLENAME_STRING = "SYSFILES";
+	private static final String	TABLENAME_STRING = "SYSFILES";
 
-	protected static final int		SYSFILES_COLUMN_COUNT = 4;
+    private static final int		SYSFILES_COLUMN_COUNT = 4;
 
 	/* Column #s (1 based) */
-	protected static final int		ID_COL_NUM = 1;
-	protected static final String   ID_COL_NAME = "FILEID";
+    private static final int		ID_COL_NUM = 1;
+    private static final String   ID_COL_NAME = "FILEID";
 
-	protected static final int		SCHEMA_ID_COL_NUM = 2;
-	protected static final String   SCHEMA_ID_COL_NAME = "SCHEMAID";
+    private static final int		SCHEMA_ID_COL_NUM = 2;
+    private static final String   SCHEMA_ID_COL_NAME = "SCHEMAID";
 
-	protected static final int		NAME_COL_NUM = 3;
-	protected static final String   NAME_COL_NAME = "FILENAME";
+    private static final int		NAME_COL_NUM = 3;
+    private static final String   NAME_COL_NAME = "FILENAME";
 
-	protected static final int		GENERATION_ID_COL_NUM = 4;
-	protected static final String   GENERATION_ID_COL_NAME = "GENERATIONID";
+    private static final int		GENERATION_ID_COL_NUM = 4;
+    private static final String   GENERATION_ID_COL_NAME = "GENERATIONID";
 
-	protected static final int		SYSFILES_INDEX1_ID = 0;
-	protected static final int		SYSFILES_INDEX2_ID = 1;
+    static final int		SYSFILES_INDEX1_ID = 0;
+    static final int		SYSFILES_INDEX2_ID = 1;
 
 	private static final int[][] indexColumnPositions =
 	{
@@ -100,7 +102,7 @@
 	//
 	/////////////////////////////////////////////////////////////////////////////
 
-    public	SYSFILESRowFactory(UUIDFactory uuidf, ExecutionFactory ef, DataValueFactory dvf,
+    SYSFILESRowFactory(UUIDFactory uuidf, ExecutionFactory ef, DataValueFactory dvf,
                                  boolean convertIdToLower) 
 	{
 		super(uuidf,ef,dvf,convertIdToLower);
@@ -282,52 +284,14 @@
 	 *
 	 * @return array of SystemColumn suitable for making this catalog.
 	 */
-	public SystemColumn[]	buildColumnList()
-	{
-		int						index = 0;
-		SystemColumn[]			columnList = new SystemColumn[SYSFILES_COLUMN_COUNT];
-
-		// describe columns
-
-		columnList[index++] = new SystemColumnImpl(	
-								convertIdCase( ID_COL_NAME),		// column name
-								ID_COL_NUM,	        // column number
-								0,					// precision
-								0,					// scale
-								false,				// nullability
-								"CHAR",				// dataType
-								true,				// built-in type
-								36					// maxLength
-			                   );
-
-		columnList[index++] = new SystemColumnImpl(	
-								convertIdCase( SCHEMA_ID_COL_NAME),	// column name
-								SCHEMA_ID_COL_NUM,	// schema number
-								0,					// precision
-								0,					// scale
-								false,				// nullability
-								"CHAR",				// dataType
-								true,				// built-in type
-								36					// maxLength
-			                   );
-
-		columnList[index++] = new SystemColumnImpl(	
-								convertIdCase( NAME_COL_NAME),		// column name
-								NAME_COL_NUM, 	    // column number
-								false				// nullability
-			                   );
-		columnList[index++] = 
-					new SystemColumnImpl(	
-							convertIdCase( GENERATION_ID_COL_NAME),		// column name
-							GENERATION_ID_COL_NUM,	// column number
-							0,					// precision
-							0,					// scale
-							false,				// nullability
-							"BIGINT",			// dataType
-							true,				// built-in type
-							TypeId.LONGINT_MAXWIDTH	// maxLength
-			               );
-		return	columnList;
-	}
-
+    public SystemColumn[]   buildColumnList()
+    {
+        return new SystemColumn[] {
+           SystemColumnImpl.getUUIDColumn(ID_COL_NAME, false),
+           SystemColumnImpl.getUUIDColumn(SCHEMA_ID_COL_NAME, false),
+           SystemColumnImpl.getIdentifierColumn(NAME_COL_NAME, false),
+           SystemColumnImpl.getColumn(GENERATION_ID_COL_NAME, Types.BIGINT, false)
+                
+        };
+    }
 }



Mime
View raw message