proper.relaggs
Class RelaggsAttribute

java.lang.Object
  extended by proper.relaggs.RelaggsAttribute
All Implemented Interfaces:
java.lang.Comparable

public class RelaggsAttribute
extends java.lang.Object
implements java.lang.Comparable

Title: RelaggsAttribute Description: Represents a table attribute. Copyright: 2002 Susanne Streuer
ChangeLog:

Version:
$Revision: 1.1 $
Author:
Susanne Streuer

Field Summary
static int TYPE_CHAR
          Constant representing a short text (less than 256 digits) [char, varchar, tinyblob, tinytext].
static int TYPE_DATE
          Constant representing a date [date].
static int TYPE_DATETIME
          Constant representing a date and a time [timestamp, datetime].
static int TYPE_ENUM
          Constant representing an enumeration [enum].
static int TYPE_INT
          Constant representing an integer [tinyint, smallint, mediumint, int, integer, bigint, year].
static int TYPE_REAL
          Constant representing a real [float, double, real, decimal, numeric].
static int TYPE_SET
          Constant representing a set [set].
static int TYPE_TEXT
          Constant representing a long text (more than 255 digits) [blob, mediumblob, longblob, text, mediumtext, longtext].
static int TYPE_TIME
          Constant representing a time [time].
static int TYPE_UNKNOWN
          Constant representing an unknown data type.
 
Constructor Summary
RelaggsAttribute(java.lang.String name, java.lang.String jdbc_type, java.lang.String type_name, int type_size)
          Creates a new RelaggsAttribute.
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares this attribute to the given object.
 boolean equals(java.lang.Object obj)
          Returns true if the given object is a RelaggsAttribute and its name equals the name of this attribute.
 java.lang.String getAggregateFunctions(java.lang.String table_name, java.lang.String table_short_name, boolean is_primary_key)
          Returns a SQL statement containing the standard aggregate functions of the attribute according to its type.
 java.lang.String getName()
          Returns the name of the attribute.
 int getType()
          Returns the type constant of the attribute.
 java.lang.String getTypeCreate()
          Returns the SQL create description of the attribute type (type_name and type_size).
FracPete: changed to ANSI types
 java.lang.String getTypeName()
          Returns the name of the attribute's type.
 java.lang.String toString()
          Returns the name of the attribute.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_UNKNOWN

public static final int TYPE_UNKNOWN
Constant representing an unknown data type.

See Also:
Constant Field Values

TYPE_INT

public static final int TYPE_INT
Constant representing an integer [tinyint, smallint, mediumint, int, integer, bigint, year].

See Also:
Constant Field Values

TYPE_REAL

public static final int TYPE_REAL
Constant representing a real [float, double, real, decimal, numeric].

See Also:
Constant Field Values

TYPE_CHAR

public static final int TYPE_CHAR
Constant representing a short text (less than 256 digits) [char, varchar, tinyblob, tinytext].

See Also:
Constant Field Values

TYPE_TEXT

public static final int TYPE_TEXT
Constant representing a long text (more than 255 digits) [blob, mediumblob, longblob, text, mediumtext, longtext].

See Also:
Constant Field Values

TYPE_DATE

public static final int TYPE_DATE
Constant representing a date [date].

See Also:
Constant Field Values

TYPE_DATETIME

public static final int TYPE_DATETIME
Constant representing a date and a time [timestamp, datetime].

See Also:
Constant Field Values

TYPE_TIME

public static final int TYPE_TIME
Constant representing a time [time].

See Also:
Constant Field Values

TYPE_ENUM

public static final int TYPE_ENUM
Constant representing an enumeration [enum].

See Also:
Constant Field Values

TYPE_SET

public static final int TYPE_SET
Constant representing a set [set].

See Also:
Constant Field Values
Constructor Detail

RelaggsAttribute

public RelaggsAttribute(java.lang.String name,
                        java.lang.String jdbc_type,
                        java.lang.String type_name,
                        int type_size)
Creates a new RelaggsAttribute.

Parameters:
name - the name of the attribute
jdbc_type - the JDBC type of the attribute
type_name - the type name of the attribute
type_size - the size of the attribute, e.g., 20 for VARCHAR(20)
Method Detail

getTypeName

public java.lang.String getTypeName()
Returns the name of the attribute's type.

Returns:
type of the attribute

getTypeCreate

public java.lang.String getTypeCreate()
Returns the SQL create description of the attribute type (type_name and type_size).
FracPete: changed to ANSI types


toString

public java.lang.String toString()
Returns the name of the attribute.

Overrides:
toString in class java.lang.Object

getName

public java.lang.String getName()
Returns the name of the attribute.

Returns:
name of the attribute

getType

public int getType()
Returns the type constant of the attribute.

Returns:
type constant

getAggregateFunctions

public java.lang.String getAggregateFunctions(java.lang.String table_name,
                                              java.lang.String table_short_name,
                                              boolean is_primary_key)
Returns a SQL statement containing the standard aggregate functions of the attribute according to its type.

Parameters:
table_name - the name of the table which includes this attribute
table_short_name - the short name of the table which includes this attribute
is_primary_key - true if the attribute is the primary key of the table; else false

compareTo

public int compareTo(java.lang.Object o)
Compares this attribute to the given object. If the object is a RelaggsAttribute compares the names of both attributes.

Specified by:
compareTo in interface java.lang.Comparable

equals

public boolean equals(java.lang.Object obj)
Returns true if the given object is a RelaggsAttribute and its name equals the name of this attribute.

Overrides:
equals in class java.lang.Object