| java.lang.Object org.apache.ojb.broker.ant.DBUtility
DBUtility | public class DBUtility (Code) | | DBUtility is a utility class for verifying that various Database objects
exist in a specified database. This utility does not use the jdbc
DatabaseMetaData object because not all jdbc drivers fully implement
it (like org.hsqldb.jdbcDriver - suckers).
author: Daren Drummond version: $Id: $ |
Constructor Summary | |
public | DBUtility(String url, String user, String pwd) DBUtility connects to the database in this constructor.
Parameters: url - String representing the jdbc connection url. |
Method Summary | |
public boolean | exists(String tableName) Checks the database for the existence of this table. | public void | exists(String tableName, String columnName, String jdbcType, boolean ignoreCase) Checks the database for the existence of this table.column of the specified
jdbc type. | public void | exists(String tableName, String columnName, boolean ignoreCase) Checks the database for the existence of this table.column. | public void | existsUseWarnings(String tableName, String columnName, String jdbcType, boolean ignoreCase) Checks the database for the existence of this table.column of the specified
jdbc type. | protected void | finalize() | public int | getJdbcType(String ojbType) Determines the java.sql.Types constant value from an OJB
FIELDDESCRIPTOR value.
Parameters: type - The FIELDDESCRIPTOR which JDBC type is to be determined. | public void | release() |
DBUtility | public DBUtility(String url, String user, String pwd) throws SQLException(Code) | | DBUtility connects to the database in this constructor.
Parameters: url - String representing the jdbc connection url. For example, "jdbc:hsqldb:target/test/OJB". Parameters: user - The database user account to use for logging on. Parameters: pwd - The password for the user throws: SQLException - Throws SQLException if there are problems connecting to the database. throws: ClassNotFoundException - Throws ClassNotFoundException if the jdbc driver class can not be found. |
exists | public boolean exists(String tableName)(Code) | | Checks the database for the existence of this table. Returns true if it
exists, false if it doesn't exist, and throws a SQLException if the
connection is not established. NOTE: If a schema is required for your
database, then it should have been provided in the connection url.
Parameters: tableName - String name of the table that you want check for existence. boolean true if the table exists, false if it doesn't exist. |
exists | public void exists(String tableName, String columnName, String jdbcType, boolean ignoreCase) throws SQLException(Code) | | Checks the database for the existence of this table.column of the specified
jdbc type. Returns true if it exists, false if it doesn't exist, and throws
a SQLException if the connection is not established. NOTE: If a schema is
required for your database, then it should have been provided in the
connection url.
Parameters: tableName - String name of the table to check. Parameters: columnName - String name of the table column to check. Parameters: jdbcType - Case insensitive String representation of the jdbc type of the column. Valid values are string representations of the types listedin java.sql.Types. For example, "bit", "float","varchar", "clob", etc. Parameters: ignoreCase - boolean flag that determines if the utility shouldconsider the column name case when searching for the database table.column. throws: SQLException - if the Table doesn't exist, if the column doesn't exist, if the column type doesn't match the specified jdbcType. |
exists | public void exists(String tableName, String columnName, boolean ignoreCase) throws SQLException(Code) | | Checks the database for the existence of this table.column.
Throws a SQLException if if the Table.Column can not be found.
NOTE: If a schema is required for your
database, then it should have been provided in the connection url.
Parameters: tableName - String name of the table to check. Parameters: columnName - String name of the table column to check. Parameters: ignoreCase - boolean flag that determines if the utility shouldconsider the column name case when searching for the database table.column. throws: SQLException - if the Table doesn't exist, if the column doesn't exist. |
existsUseWarnings | public void existsUseWarnings(String tableName, String columnName, String jdbcType, boolean ignoreCase) throws SQLException, SQLWarning(Code) | | Checks the database for the existence of this table.column of the specified
jdbc type. Throws a SQLException if if the Table.Column can not be found, and
throws a SQLWarning if the column type does not match the passed JDBC type.
NOTE: If a schema is required for your database, then it should have been
provided in the connection url.
Parameters: tableName - String name of the table to check. Parameters: columnName - String name of the table column to check. Parameters: jdbcType - Case insensitive String representation of the jdbc type of the column. Valid values are string representations of the types listedin java.sql.Types. For example, "bit", "float","varchar", "clob", etc. Parameters: ignoreCase - boolean flag that determines if the utility shouldconsider the column name case when searching for the database table.column. throws: SQLException - if the Table doesn't exist, if the column doesn't exist. throws: SQLWarning - if the column type doesn't match the specified jdbcType. |
finalize | protected void finalize()(Code) | | |
getJdbcType | public int getJdbcType(String ojbType) throws SQLException(Code) | | Determines the java.sql.Types constant value from an OJB
FIELDDESCRIPTOR value.
Parameters: type - The FIELDDESCRIPTOR which JDBC type is to be determined. int the int value representing the Type according to throws: SQLException - if the type is not a valid jdbc type.java.sql.Types |
|
|