snap.database
Class DatabaseSchema

java.lang.Object
  |
  +--snap.database.DatabaseSchema

public class DatabaseSchema
extends java.lang.Object

This class retrieves schema information from the database.

Author:
Varun Saini - vsaini@vt.edu, Chris North - north@cs.vt.edu, Nathan Conklin - nathan@conklinfamily.net

Field Summary
static int MANY_TO_ONE
           
static int NO_RELATION
           
static int ONE_TO_MANY
           
static int ONE_TO_ONE
           
 
Constructor Summary
DatabaseSchema(java.sql.Connection connection)
          This is the default constructor for the DatabaseSchema object
 
Method Summary
 java.util.Vector getColumns(java.lang.String table)
          Returns a Vector of column names for a given table
 java.lang.String getPrimaryKey(java.lang.String table)
          Gets the primary key for a particular table.
 int getRelation(java.lang.String tableSrc, java.lang.String tableDest)
          Check from hashtable and return the relation.
 java.util.Vector getTables()
          Returns a Vector of table names
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_RELATION

public static final int NO_RELATION
See Also:
Constant Field Values

ONE_TO_ONE

public static final int ONE_TO_ONE
See Also:
Constant Field Values

ONE_TO_MANY

public static final int ONE_TO_MANY
See Also:
Constant Field Values

MANY_TO_ONE

public static final int MANY_TO_ONE
See Also:
Constant Field Values
Constructor Detail

DatabaseSchema

public DatabaseSchema(java.sql.Connection connection)
This is the default constructor for the DatabaseSchema object

Method Detail

getPrimaryKey

public java.lang.String getPrimaryKey(java.lang.String table)
Gets the primary key for a particular table. Note: This only returns a single String as the primary key. However, the primary key may actually be made up of a combination of columns.


getTables

public java.util.Vector getTables()
Returns a Vector of table names


getColumns

public java.util.Vector getColumns(java.lang.String table)
Returns a Vector of column names for a given table


getRelation

public int getRelation(java.lang.String tableSrc,
                       java.lang.String tableDest)
Check from hashtable and return the relation.