org.apache.empire.db
Class DBIndex

java.lang.Object
  extended by org.apache.empire.commons.ErrorObject
      extended by org.apache.empire.db.DBObject
          extended by org.apache.empire.db.DBIndex
All Implemented Interfaces:
java.io.Serializable, ErrorInfo

public class DBIndex
extends DBObject

This class handles the primary key for the tables. The primary key contains one or more columns.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.empire.commons.ErrorObject
ErrorObject.ObjectErrorInfo
 
Field Summary
static int PRIMARYKEY
          SQL Primary key index
static int STANDARD
          SQL Standard index
static int UNIQUE
          SQL Unique index
 
Constructor Summary
DBIndex(java.lang.String name, int type, DBColumn[] columns)
          Constructs a DBIndex object set the specified parameters to this object.
 
Method Summary
 boolean contains(DBColumn col)
          Checks if this index contains the column col
 int getColumnPos(DBColumn col)
          Gets the position of a specified DBColumn object.
 DBColumn[] getColumns()
          Returns the columns belonging to this index.
 DBDatabase getDatabase()
          Returns the database object to which this object belongs to.
 java.lang.String getFullName()
          Returns the full qualified table name.
 java.lang.String getName()
          Returns the primary key name.
 int getType()
          Returns the index type.
 
Methods inherited from class org.apache.empire.db.DBObject
error, error
 
Methods inherited from class org.apache.empire.commons.ErrorObject
clearError, clearErrorInfo, error, error, error, error, error, getErrorInfo, getErrorMessage, getErrorParams, getErrorSource, getErrorType, getMessage, hasError, internalSetError, isExceptionsEnabled, setExceptionsEnabled, success
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STANDARD

public static final int STANDARD
SQL Standard index

See Also:
Constant Field Values

UNIQUE

public static final int UNIQUE
SQL Unique index

See Also:
Constant Field Values

PRIMARYKEY

public static final int PRIMARYKEY
SQL Primary key index

See Also:
Constant Field Values
Constructor Detail

DBIndex

public DBIndex(java.lang.String name,
               int type,
               DBColumn[] columns)
Constructs a DBIndex object set the specified parameters to this object.

Parameters:
name - the primary key name
type - the primary key type (only PRIMARYKEY)
columns - an array of one or more columns of the primary key
Method Detail

getDatabase

public DBDatabase getDatabase()
Description copied from class: DBObject
Returns the database object to which this object belongs to. For the database object itself this function will return the this pointer.

Specified by:
getDatabase in class DBObject
Returns:
the database object

getName

public java.lang.String getName()
Returns the primary key name.

Returns:
the primary key name

getColumns

public DBColumn[] getColumns()
Returns the columns belonging to this index.

Returns:
the columns belonging to this index

getFullName

public java.lang.String getFullName()
Returns the full qualified table name.

Returns:
the full qualified table name

getType

public int getType()
Returns the index type.

Returns:
the type of this index (PRIMARYKEY, UNIQUE, STANDARD)

contains

public boolean contains(DBColumn col)
Checks if this index contains the column col

Parameters:
col - the column
Returns:
true if this index contains this column

getColumnPos

public int getColumnPos(DBColumn col)
Gets the position of a specified DBColumn object.

Parameters:
col - the column
Returns:
the position or -1 if the column was not found


Copyright © 2008-2011 Apache Software Foundation. All Rights Reserved.