org.eclipse.datatools.modelbase.sql.schema.helper
Class DatabaseHelper
java.lang.Object
org.eclipse.datatools.modelbase.sql.schema.helper.DatabaseHelper
public class DatabaseHelper
- extends java.lang.Object
- Author:
- ckadner
Helper to provide convenience methods that are related to
Database.
|
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 |
DatabaseHelper
public DatabaseHelper()
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 inschemaName - the String name of the Schema to find
- Returns:
- the
Schema found or null if no
corresponding Schema was found
- Throws:
java.lang.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 intableName - the String name of the Table to find
- Returns:
- List of
Tables with associated Schema
- Throws:
java.lang.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 identifiersidentifier - a String identifier already existing in the DatabaselookupName - the String name to compare to a existing identifier
- Returns:
- 0 if lookupName is equal to identifier
- See Also:
String.compareTo(java.lang.String)