OptionalTool to create wrapper functions and views for all of the user tables in a foreign database.
| Modifier and Type | Field and Description |
|---|---|
| private static final String[] | |
| private static final int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | createDerbySchema(Connection derbyConn, String derbySchemaName)
Create a Derby schema if it does not already exist. |
| private String | |
| private String | dotSeparatedSchemaName(String rawName)
Turn a Derby schema name into a schema name suitable for use in a dot-separated object name. |
| private void | |
| private void | dropObject(Connection conn, String schemaName, String objectName, String objectType, boolean restrict)
Drop a schema object. |
| private void | |
| private Connection | |
| private String | getDerbySchemaName(String schemaPrefix, String foreignSchemaName)
Get the name of the local Derby schema corresponding to a foreign schema name. |
| private Connection | |
| private ResultSet | getForeignTables(DatabaseMetaData foreignDBMD)
Get a cursor through the user tables in the foreign database. |
| public void | loadTool(String... configurationParameters)
Implements org. Creates a local Derby schema for every foreign schema which contains a user table. |
| private String | |
| private String | |
| private String | |
| private PreparedStatement | |
| private void | registerForeignTable(DatabaseMetaData foreignDBMD, String foreignSchemaName, String foreignTableName, String foreignConnectionURL, String schemaPrefix, Connection derbyConn)
|
| private String | |
| public void | unloadTool(String... configurationParameters)
Implements org. Removes the schemas, table functions, and views created by loadTool(). |
| private SQLException |
| SAFE_DROP_SQLSTATES | back to summary |
|---|---|
| private static final String[] SAFE_DROP_SQLSTATES | |
| XML_TYPE | back to summary |
|---|---|
| private static final int XML_TYPE | |
| ForeignDBViews | back to summary |
|---|---|
| public ForeignDBViews() 0-arg constructor required by the OptionalTool contract | |
| createDerbySchema | back to summary |
|---|---|
| private void createDerbySchema(Connection derbyConn, String derbySchemaName) throws SQLException Create a Derby schema if it does not already exist. | |
| delimitedID | back to summary |
|---|---|
| private String delimitedID(String text) | |
| dotSeparatedSchemaName | back to summary |
|---|---|
| private String dotSeparatedSchemaName(String rawName) Turn a Derby schema name into a schema name suitable for use in a dot-separated object name. | |
| dropDerbySchema | back to summary |
|---|---|
| private void dropDerbySchema(Connection derbyConn, String derbySchemaName) throws SQLException Drop a Derby schema. | |
| dropObject | back to summary |
|---|---|
| private void dropObject(Connection conn, String schemaName, String objectName, String objectType, boolean restrict) throws SQLException Drop a schema object. If the object does not exist, silently swallow the error. | |
| executeDDL | back to summary |
|---|---|
| private void executeDDL(Connection conn, String text) throws SQLException | |
| getDerbyConnection | back to summary |
|---|---|
| private Connection getDerbyConnection() throws SQLException | |
| getDerbySchemaName | back to summary |
|---|---|
| private String getDerbySchemaName(String schemaPrefix, String foreignSchemaName) Get the name of the local Derby schema corresponding to a foreign schema name. Returns null if the default (current) schema is to be used. | |
| getForeignConnection | back to summary |
|---|---|
| private Connection getForeignConnection(String connectionURL) throws SQLException | |
| getForeignTables | back to summary |
|---|---|
| private ResultSet getForeignTables(DatabaseMetaData foreignDBMD) throws SQLException Get a cursor through the user tables in the foreign database. | |
| loadTool | back to summary |
|---|---|
| public void loadTool(String... configurationParameters) throws SQLException Implements org. Creates a local Derby schema for every foreign schema which contains a user table. Then creates a table function and convenience view for every user table found in the foreign database. The parameters to this method are:
| |
| mapType | back to summary |
|---|---|
| private String mapType(int jdbcType, int precision, int scale, String foreignTypeName) throws SQLException Get the type of an external database's column as a Derby type name. | |
| precisionAndScale | back to summary |
|---|---|
| private String precisionAndScale(int precision, int scale) Build a precision and scale designator. | |
| precisionToLength | back to summary |
|---|---|
| private String precisionToLength(int precision) Turns precision into a length designator. | |
| prepareStatement | back to summary |
|---|---|
| private PreparedStatement prepareStatement(Connection conn, String text) throws SQLException | |
| registerForeignTable | back to summary |
|---|---|
| private void registerForeignTable(DatabaseMetaData foreignDBMD, String foreignSchemaName, String foreignTableName, String foreignConnectionURL, String schemaPrefix, Connection derbyConn) throws SQLException | |
| stringLiteral | back to summary |
|---|---|
| private String stringLiteral(String text) | |
| unloadTool | back to summary |
|---|---|
| public void unloadTool(String... configurationParameters) throws SQLException Implements org. Removes the schemas, table functions, and views created by loadTool().
| |
| wrap | back to summary |
|---|---|
| private SQLException wrap(String errorMessage) | |