You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by dj...@apache.org on 2006/08/21 02:00:22 UTC
svn commit: r433088 - in
/db/derby/code/branches/10.2/java/engine/org/apache/derby:
iapi/sql/dictionary/SystemColumn.java
impl/sql/catalog/DataDictionaryImpl.java
impl/sql/catalog/SystemColumnImpl.java
Author: djd
Date: Sun Aug 20 17:00:16 2006
New Revision: 433088
URL: http://svn.apache.org/viewvc?rev=433088&view=rev
Log:
DERBY-1674 (partial) Clean up SystemColumn interface and implementation to hold the data type of
the column using the standard DataTypeDescriptor class rather than individual fields.
Merge of 432895 from trunk
Modified:
db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/sql/dictionary/SystemColumn.java
db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/catalog/SystemColumnImpl.java
Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/sql/dictionary/SystemColumn.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/sql/dictionary/SystemColumn.java?rev=433088&r1=433087&r2=433088&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/sql/dictionary/SystemColumn.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/iapi/sql/dictionary/SystemColumn.java Sun Aug 20 17:00:16 2006
@@ -20,10 +20,9 @@
*/
package org.apache.derby.iapi.sql.dictionary;
-import org.apache.derby.iapi.error.StandardException;
+
import org.apache.derby.iapi.types.DataTypeDescriptor;
-import org.apache.derby.iapi.types.DataValueDescriptor;
-import org.apache.derby.iapi.types.DataValueFactory;
+
/**
* Implements the description of a column in a system table.
@@ -48,47 +47,11 @@
* @return The column id.
*/
public int getID();
+
+ /**
+ * Return the type of this column.
+ */
+ public DataTypeDescriptor getType();
- /**
- * Gets the precision of this column.
- *
- * @return The precision of data stored in this column.
- */
- public int getPrecision();
-
- /**
- * Gets the scale of this column.
- *
- * @return The scale of data stored in this column.
- */
- public int getScale();
-
- /**
- * Gets the nullability of this column.
- *
- * @return True if this column is nullable. False otherwise.
- */
- public boolean getNullability();
-
- /**
- * Gets the datatype of this column.
- *
- * @return The datatype of this column.
- */
- public String getDataType();
-
- /**
- * Is it a built-in type?
- *
- * @return True if it's a built-in type.
- */
- public boolean builtInType();
-
- /**
- * Gets the maximum length of this column.
- *
- * @return The maximum length of data stored in this column.
- */
- public int getMaxLength();
}
Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java?rev=433088&r1=433087&r2=433088&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java Sun Aug 20 17:00:16 2006
@@ -7240,30 +7240,9 @@
TableDescriptor td )
throws StandardException
{
- DataTypeDescriptor typeDesc;
- TypeId typeId;
-
- if (column.builtInType())
- {
- typeId = TypeId.getBuiltInTypeId(column.getDataType());
- }
- else
- {
-
- typeId = TypeId.getUserDefinedTypeId(column.getDataType(), false);
- }
-
- typeDesc = new DataTypeDescriptor(
- typeId,
- column.getPrecision(),
- column.getScale(),
- column.getNullability(),
- column.getMaxLength()
- );
-
//RESOLVEAUTOINCREMENT
return new ColumnDescriptor
- (column.getName(), column.getID(), typeDesc, null, null, td,
+ (column.getName(), column.getID(), column.getType(), null, null, td,
(UUID) null, // No defaults yet for system columns
0, 0
);
Modified: db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/catalog/SystemColumnImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/catalog/SystemColumnImpl.java?rev=433088&r1=433087&r2=433088&view=diff
==============================================================================
--- db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/catalog/SystemColumnImpl.java (original)
+++ db/derby/code/branches/10.2/java/engine/org/apache/derby/impl/sql/catalog/SystemColumnImpl.java Sun Aug 20 17:00:16 2006
@@ -26,6 +26,7 @@
import org.apache.derby.iapi.types.DataTypeDescriptor;
import org.apache.derby.iapi.types.DataValueDescriptor;
import org.apache.derby.iapi.types.DataValueFactory;
+import org.apache.derby.iapi.types.TypeId;
/**
* Implements the description of a column in a system table.
@@ -37,14 +38,13 @@
public class SystemColumnImpl implements SystemColumn
{
- private String name;
- private int id;
- private int precision;
- private int scale;
- private boolean nullability;
- private String dataType;
- private boolean builtInType;
- private int maxLength;
+ private final String name;
+ private final int id;
+
+ /**
+ * Fully described type of the column.
+ */
+ private final DataTypeDescriptor type;
/**
* Constructor to create a description of a column in a system table.
@@ -68,12 +68,26 @@
{
this.name = name;
this.id = id;
- this.precision = precision;
- this.scale = scale;
- this.nullability = nullability;
- this.dataType = dataType;
- this.builtInType = builtInType;
- this.maxLength = maxLength;
+
+ TypeId typeId;
+
+ if (builtInType)
+ {
+ typeId = TypeId.getBuiltInTypeId(dataType);
+ }
+ else
+ {
+
+ typeId = TypeId.getUserDefinedTypeId(dataType, false);
+ }
+
+ this.type = new DataTypeDescriptor(
+ typeId,
+ precision,
+ scale,
+ nullability,
+ maxLength
+ );
}
/**
@@ -88,12 +102,7 @@
int id,
boolean nullability)
{
- this.name = name;
- this.id = id;
- this.nullability = nullability;
- this.dataType = "VARCHAR";
- this.builtInType = true;
- this.maxLength = 128;
+ this(name, id, 0, 0, nullability, "VARCHAR", true, 128);
}
/**
@@ -116,65 +125,11 @@
return id;
}
- /**
- * Gets the precision of this column.
- *
- * @return The precision of data stored in this column.
- */
- public int getPrecision()
- {
- return precision;
- }
-
- /**
- * Gets the scale of this column.
- *
- * @return The scale of data stored in this column.
- */
- public int getScale()
- {
- return scale;
- }
-
- /**
- * Gets the nullability of this column.
- *
- * @return True if this column is nullable. False otherwise.
- */
- public boolean getNullability()
- {
- return nullability;
- }
-
- /**
- * Gets the datatype of this column.
- *
- * @return The datatype of this column.
- */
- public String getDataType()
- {
- return dataType;
- }
-
- /**
- * Is it a built-in type?
- *
- * @return True if it's a built-in type.
- */
- public boolean builtInType()
- {
- return builtInType;
- }
-
- /**
- * Gets the maximum length of this column.
- *
- * @return The maximum length of data stored in this column.
- */
- public int getMaxLength()
- {
- return maxLength;
- }
-
+ /**
+ * Return the type of this column.
+ */
+ public DataTypeDescriptor getType() {
+ return type;
+ }
}