org.eclipse.wst.rdb.internal.models.sql.schema.helper
Class DatabaseHelper

java.lang.Object
  |
  +--org.eclipse.wst.rdb.internal.models.sql.schema.helper.DatabaseHelper

public class DatabaseHelper
extends java.lang.Object

Author:
ckadner Helper to provide convenience methods that are related to com.ibm.db.models.sql.schema.Database.

Constructor Summary
DatabaseHelper()
           
 
Method Summary
static int compareIdentifiers(Database database, java.lang.String identifier, java.lang.String lookupName)
          Compares an existing identifier in a Database with the lookup name respecting delimited identifiers otherwise ignoring case.
static Schema findSchema(Database database, java.lang.String schemaName)
          Finds a Schema by its name in a given Database.
static java.util.List findTables(Database database, java.lang.String tableName)
          Finds all Tables with the name tableName in all Schema's of the given database.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseHelper

public DatabaseHelper()
Method Detail

findSchema

public static Schema findSchema(Database database,
                                java.lang.String schemaName)
Finds a Schema by its name in a given Database. If the given schemaName is not delimited, the search is not case sensitive.
Parameters:
database - the Database to find Schemas in
schemaName - the String name of the Schema to find
Returns:
the Schema found or null if no corresponding Schema was found
Throws:
NullPointerException - if given database or given schemaName is null

findTables

public static java.util.List findTables(Database database,
                                        java.lang.String tableName)
Finds all Tables with the name tableName in all Schema's of the given database. Returns a list of Tables with associated Schema. If the given tableName is not delimited, the search is not case sensitive.
Parameters:
database - the Database to search in
tableName - the String name of the Table to find
Returns:
List of Tables with associated Schema
Throws:
NullPointerException - if given schema or given tableName is null

compareIdentifiers

public static int compareIdentifiers(Database database,
                                     java.lang.String identifier,
                                     java.lang.String lookupName)
Compares an existing identifier in a Database with the lookup name respecting delimited identifiers otherwise ignoring case.
Parameters:
database - the Database to determin the delimiter for identifiers
identifier - a String identifier already existing in the Database
lookupName - the String name to compare to a existing identifier
Returns:
0 if lookupName is equal to identifier
See Also:
String.compareTo(java.lang.String)