public interface DBAccessProvider
Implementations must have a public default constructor!
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CONF_LOCK_TABLE_POLL_TIME
Configuration key: The time in milliseconds when to poll for a table lock.
|
static java.lang.String |
CONF_MAX_SEQ_COUNT
Configuration key: The amount of IDs (entries) in a sequence table before that table is
cleared.
|
| Modifier and Type | Method and Description |
|---|---|
void |
adaptProperties(java.util.Properties props)
This method gives the DB access provider the chance to set any properties
used in
DriverManager.getConnection(String, Properties). |
int |
adaptResultSetType(int resultSetType,
int resultSetConcurrency) |
void |
addColumn(ExtendedConnection con,
java.lang.String tableName,
java.lang.String columnName,
java.lang.String correspondingDbType)
Adds an additional column to the designated table of the designated type.
|
java.lang.String |
createRecursionTable(ExtendedConnection connection,
java.lang.String[] selectAttributes,
java.lang.String[] rootAttributes,
java.lang.String tableName,
java.lang.String startCondition,
ParentToChildConnection[] parentToChildConnections)
Like
createRecursionTable(ExtendedConnection, String[], String, String, ParentToChildConnection[], int)
but without a maximum depth. |
java.lang.String |
createRecursionTable(ExtendedConnection connection,
java.lang.String[] selectAttributes,
java.lang.String tableName,
java.lang.String startCondition,
ParentToChildConnection[] parentToChildConnections,
int maxDepth)
Creates a (temporary) table or view containing tuples that match a
recursive/hierarchical SQL-query which is based on the specified
parameters.
|
void |
createSequence(ExtendedConnection connection,
java.lang.String sequenceName,
long start,
long increment)
Creates a new sequence in the database.
|
void |
dropAllRecursionTables(ExtendedConnection connection)
All tables that have been created via
createRecursionTable(String[],
String, String, String[], int) are dropped. |
void |
dropColumn(ExtendedConnection con,
java.lang.String tableName,
java.lang.String columnName)
Drops the specified column from the table which corresponds to an
ALTER TABLE DROP COLUMN statement. |
void |
dropRecursionTable(ExtendedConnection connection,
java.lang.String tableName)
The specified table that has been created via
createRecursionTable(String[], String, String, String[], int)
is dropped. |
void |
dropSequence(ExtendedConnection connection,
java.lang.String sequenceName)
Drop the sequence with the given name.
|
java.lang.String |
formatValue(java.lang.Object value,
int typeCode)
Formats the given value to a string that can be used in SQL statements and
queries.
|
java.lang.String |
getAddForeignKey(ExtendedConnection con,
de.aristaflow.adept2.base.dbaccess.model.ForeignKey fk,
boolean quoteIdentifiers)
Gets an SQL string for
ALTER TABLE which adds the designated
foreign key. |
java.lang.String |
getCorrespondingDBType(int jdbcTypeCode)
Converts the given JDBC type code and given size constraints into a vendor
specific SQL type.
|
java.lang.String |
getCorrespondingDBType(int jdbcTypeCode,
int size)
Converts the given JDBC type code and given size constraints into a vendor
specific SQL type.
|
java.lang.String |
getCorrespondingDBType(int jdbcTypeCode,
int size,
int scale)
Converts the given JDBC type code and given size constraints into a vendor
specific SQL type.
|
java.lang.String |
getCurrentSchema(java.sql.Connection con) |
java.sql.Timestamp |
getCurrentTime(ExtendedConnection con)
Gets the current time (as timestamp) from the underlying DBMS in UTC timezone.
|
DatabaseName |
getDatabaseName()
Gets the name of the underlying database.
|
java.lang.String |
getDropForeignKeyConstraintKeyword()
To drop a foreign key constraint from table columns, there are two syntaxes
available.
|
java.lang.String |
getEXCEPTKeyword()
Gets the keyword that is interpreted as EXCEPT by the underlying
database-management-system.
|
java.lang.String |
getStringComparison(int type,
java.lang.String tableName,
java.lang.String columnName,
java.lang.String tableAlias,
int length,
boolean equal)
Gets a string to be used in a WHERE-clause for comparing the designated
column having the designated type with another string.
|
java.lang.String |
getTimeDifference(java.lang.String column,
long seconds)
Gets the string representing the timestamp value (to be calculated within the DBMS) based on
the designated column having the designated difference (in seconds).
|
void |
init(Configuration configuration,
java.lang.String applicationName)
Initialises this access provider using the designated configuration and the
designated application name.
|
boolean |
isForeignKeyViolation(java.sql.SQLException ex) |
boolean |
isLockTimeout(java.sql.SQLException ex)
Gets whether the designated exception indicates a lock timeout, e. g. while
waiting for a
table lock. |
boolean |
isSupportedConnectionURL(java.lang.String subProtocol,
java.lang.String subName)
Checks (and returns) if the provided connection URL of the form 'jdbc:<subprotocol>:<subname>'
can be handled by this implementation of
DBAccess. |
boolean |
isSyntaxError(java.sql.SQLException ex)
Gets whether the designated exception indicates syntax error.
|
boolean |
isTableMissing(java.sql.SQLException ex) |
boolean |
isUniqueViolation(java.sql.SQLException ex) |
void |
lockTable(ExtendedConnection con,
java.lang.String tableName,
long timeout)
Locks the designated table exclusively until the end of the corresponding
transaction.
|
long |
nextID(ExtendedConnection connection,
java.lang.String sequenceName)
Returns the next ID from the sequence with the given name.
|
void |
renameColumn(ExtendedConnection con,
java.lang.String tableName,
java.lang.String oldColumnName,
java.lang.String newColumnName)
Renames the designated column from the table which corresponds to an
ALTER TABLE RENAME COLUMN statement. |
void |
renameTable(ExtendedConnection con,
java.lang.String oldName,
java.lang.String newName)
Renames the designated table using the designated new name.
|
boolean |
sequenceExists(ExtendedConnection connection,
java.lang.String sequenceName)
Returns whether a sequence with the given name exists.
|
void |
setDefaultLockTimeout(ExtendedConnection con)
Sets the default value for the lock timeout.
|
long |
setLockTimeout(ExtendedConnection con,
long timeout)
Sets the lock timeout for the current transaction or connection in the
designated connection to the designated timeout (in milliseconds) and
returns the current lock timeout.
|
boolean |
supportsIntersect()
Gets whether the underlying DBMS supports intersect.
|
void |
terminate(ExtendedConnection con)
Terminates this access provider allowing it to do some clean-up if
required.
|
java.lang.String |
toUpperCase(java.lang.String s)
Gets the designated string converted to upper case as suggested by the underlying
database-management system.
|
void |
updateColumnsNullable(ExtendedConnection con,
java.lang.String tableName,
boolean nullable,
java.lang.String... columns)
Sets the designated columns of the designated table nullable (not
nullable).
|
void |
updateColumnType(ExtendedConnection con,
java.lang.String tableName,
java.lang.String columnName,
java.lang.String correspondingDbType)
Sets the type of the designated column of the designated table to the
provided one.
|
java.lang.String |
useLockTimeout(ExtendedConnection con,
java.lang.String query,
long timeout)
Appends the designated lock timeout in milliseconds to the designated query
(DDL and DML are not supported!).
|
static final java.lang.String CONF_LOCK_TABLE_POLL_TIME
static final java.lang.String CONF_MAX_SEQ_COUNT
DatabaseName getDatabaseName()
void init(Configuration configuration, java.lang.String applicationName)
configuration - The configuration for this access provider or
null if there is no specific configuration.applicationName - The application name used for new connections or
null if no application name should be set.boolean isSupportedConnectionURL(java.lang.String subProtocol,
java.lang.String subName)
DBAccess. The URL is
already split into its components and supplied in the parameters of the
method.subProtocol - the sub-protocol part of the connection URLsubName - the sub-name part of the connection URLvoid adaptProperties(java.util.Properties props)
DriverManager.getConnection(String, Properties).props - java.lang.String getCurrentSchema(java.sql.Connection con)
throws java.sql.SQLException
java.sql.SQLExceptionjava.lang.String getEXCEPTKeyword()
java.lang.String toUpperCase(java.lang.String s)
Locale.ENGLISH will be
used. s - The string which to convert to upper case.boolean supportsIntersect()
java.lang.String getStringComparison(int type,
java.lang.String tableName,
java.lang.String columnName,
java.lang.String tableAlias,
int length,
boolean equal)
? with the real
content of the string. CLOB.
Do not rely on the data type specified when creating the designated column!
For instance long character columns may be CLOB instead of the
data type provided when creating the column.
Make sure that the provided string to compare is never null!
While null in the designated column will be handled
appropriately, providing a null string will usually not work.
type - The JDBC data type of the designated column.tableName - The name of the table which contains the column.columnName - The name of the column which to compare.tableAlias - The table alias to be used as prefix of the column in the
statement. Do not provide the separating . as this
will be added appropriately by the method. If null is
provided, the column name will have no prefix.length - The length of the string. When reusing the prepared statement
for several strings, use the longest one. This allows the
underlying database to cast to VARCHAR for comparing.equal - Whether to compare the strings for whether they are equal (or
whether they are not).java.lang.String getTimeDifference(java.lang.String column,
long seconds)
CURRENT_TIMESTAMP. CURRENT_TIMESTAMP to compare with that column.column - The (fully-qualified) name of the column which contains the time/date/timestamp.
This may also be a pseudo-column.seconds - The difference in seconds (!!) which to add or remove from the time in the
designated column.java.lang.String getDropForeignKeyConstraintKeyword()
ALTER TABLE <tableName> DROP <b>CONSTRAINT</b> <constraintName>ALTER TABLE <tableName> DROP <b>FOREIGN KEY</b> <constraintName>CONSTRAINT or FOREIGN KEY, whichever is
appropriate for the DBMSjava.lang.String getAddForeignKey(ExtendedConnection con, de.aristaflow.adept2.base.dbaccess.model.ForeignKey fk, boolean quoteIdentifiers) throws java.sql.SQLException
ALTER TABLE which adds the designated
foreign key.con - The connection for which to retrieve the SQL statement.fk - The definition of the foreign key to be added.quoteIdentifiers - Whether identifiers should be quoted.ALTER TABLE statement for
adding the designated foreign key.java.sql.SQLException - If there are problems retrieving the required meta
data or the foreign key cannot be created, an
SQLException will be thrown.java.lang.String getCorrespondingDBType(int jdbcTypeCode)
A call to this method is equivalent to
getCorrespondingDBType(jdbcTypeCode, -1, -1). See
getCorrespondingDBType(int, int, int).
jdbcTypeCode - the JDBC type code that should be mapped to a vendor
specific SQL type stringjava.lang.String getCorrespondingDBType(int jdbcTypeCode,
int size)
A call to this method is equivalent to
getCorrespondingDBType(jdbcTypeCode, size, -1). See
getCorrespondingDBType(int, int, int).
jdbcTypeCode - the JDBC type code that should be mapped to a vendor
specific SQL type stringsize - the desired size of the type (i.e. length for string and binary
types, precision for number types or fractional seconds for time
types); use negative value to indicate that size is not usedjava.lang.String getCorrespondingDBType(int jdbcTypeCode,
int size,
int scale)
Please be aware that binary or character types may be mapped to their LOB
variants if the specified size doesn't allow the smaller types. This might
however lead to problems when setting or getting the values in the regular
way. E.g. ResultSet.getString(int) might not always work for CLOBs
or only up to a certain size.
Character types will be translated to Unicode-capable data types if available. Generally, the following types are supported. Implementations are allowed to also support the remaining JDBC types but the requirements for those aren't very clear. E.g. are size and scale enough for them as parameters? Negative values for size and scale indicate that they are not specified.
jdbcTypeCode - the JDBC type code that should be mapped to a vendor
specific SQL type stringsize - the desired size of the type (i.e. length for string and binary
types, precision for number types or fractional seconds for time
types); use negative value to indicate that size is not usedscale - only used for some number types and determines the precision
after the decimal point; use negative value to indicate that scale
is not usednull if the type is not supportedjava.lang.IllegalArgumentException - if the combination of JDBC type code, size
and scale is illegal, e.g. if scale or size is set for
Types.INTEGERjava.lang.String formatValue(java.lang.Object value,
int typeCode)
Types) determines
the target type. The main intention for this method is to be an alternative
where it is not easily possible to use PreparedStatements,
e.g. in highly dynamic and complex queries.
Please be aware that string escaping may not have been implemented in a
100% safe way due to lacking specifications for each database. So for
strings it's much safer to use
PreparedStatements to
prevent any kind of SQL injection.
This method may throw a runtime exception if object type of the value and type code don't fit together. However it does NOT guarantee to do so, which may result in improperly formatted or even illegal values.
For all date-related types (i.e. DATE, TIME and TIMESTAMP) not only
Date is allowed, but also Date,
Time and Timestamp.
A null value will result in the string "null".
Booleans are properly formatted to 1 or 0 if the target
type is Types.BIT.
value - the value to formattypeCode - the JDBC type code of the target typevoid renameTable(ExtendedConnection con, java.lang.String oldName, java.lang.String newName) throws java.sql.SQLException
con - The connection on which to execute the operation.oldName - The name of the table which to rename.newName - The new name of the table.java.sql.SQLException - If a database access error occurs, the specified table
name is invalid, a SQLException will be thrown.void addColumn(ExtendedConnection con, java.lang.String tableName, java.lang.String columnName, java.lang.String correspondingDbType) throws java.sql.SQLException
getCorrespondingDBType(int) or one of the overloaded methods
to determine the database-specific type of the column. update
the column afterwards.con - The connection on which to execute the operation.tableName - The name of the table to which to add a new column.columnName - The name of the column which to add.correspondingDbType - The string representation of the desired type of
the column. Use the string returned by
getCorrespondingDBType(int) (or the overloaded methods).java.sql.SQLException - If a database access error occurs, the specified table
name or column name is invalid, a SQLException
will be thrown.void updateColumnType(ExtendedConnection con, java.lang.String tableName, java.lang.String columnName, java.lang.String correspondingDbType) throws java.sql.SQLException
getCorrespondingDBType(int) or one of the
overloaded methods to determine the database-specific type of the column.
Note that not all DBMS support shortening the type of a column, for instance Derby. This requires creating a new column, copying the data, dropping the old column and renaming the new one. Do not forget to handle indexes and key columns appropriately if required.
con - The connection on which to execute the operation.tableName - The table containing the column to change the data type.columnName - The name of the column to change the data type.correspondingDbType - The string representation of the desired type of
the column. Use the string returned by
getCorrespondingDBType(int) (or the overloaded methods).java.sql.SQLException - If a database access error occurs, the specified table
name or column name is invalid, a SQLException
will be thrown.void updateColumnsNullable(ExtendedConnection con, java.lang.String tableName, boolean nullable, java.lang.String... columns) throws java.sql.SQLException
SQLException.con - The connection on which to execute the operation.tableName - The table containing the columns to change the
nullable-state.nullable - Whether the columns should allow null values or not.columns - The names of the columns to change the nullable-state.java.sql.SQLException - If there are problems checking the metadata or
changing the nullable-state, an SQLException will be
thrown.void renameColumn(ExtendedConnection con, java.lang.String tableName, java.lang.String oldColumnName, java.lang.String newColumnName) throws java.sql.SQLException
ALTER TABLE RENAME COLUMN statement.con - The connection on which to execute the operation.tableName - The name of the table to which to rename a column.oldColumnName - The old name of column which to rename.newColumnName - The new name of the column.java.sql.SQLException - If a database access error occurs, the specified table
name or column name is invalid, a SQLException
will be thrown.void dropColumn(ExtendedConnection con, java.lang.String tableName, java.lang.String columnName) throws java.sql.SQLException
ALTER TABLE DROP COLUMN statement.
Do not try to drop columns that are referenced in any (primary key, foreign key, unique, ...) constraints. This may have unpredictable results or even fail (in a data-destroying way).
con - The connection on which to execute the operation.tableName - The name of the table of which the column type is of
interest.columnName - The name of column of which the type is of interest.java.sql.SQLException - If a database access error occurs, the specified table
name or column name is invalid, a SQLException
will be thrown.int adaptResultSetType(int resultSetType,
int resultSetConcurrency)
boolean isTableMissing(java.sql.SQLException ex)
boolean isUniqueViolation(java.sql.SQLException ex)
boolean isForeignKeyViolation(java.sql.SQLException ex)
boolean isLockTimeout(java.sql.SQLException ex)
table lock.ex - The exception to be testedboolean isSyntaxError(java.sql.SQLException ex)
ex - The exception to be testedjava.sql.Timestamp getCurrentTime(ExtendedConnection con) throws java.sql.SQLException
con - The connection with which to retrieve the current time.java.sql.SQLException - If there are problems retrieving the current time, an
SQLException will be thrown.void createSequence(ExtendedConnection connection, java.lang.String sequenceName, long start, long increment) throws java.sql.SQLException
connection - the connection on which to execute the operationsequenceName - the name of the sequence to be createdstart - the initial value of the sequence, i.e. the first value that
will be returned by nextID(ExtendedConnection, String);
may be negativeincrement - the value by which to increment the ID after a call to
nextID(ExtendedConnection, String); may be negativejava.sql.SQLException - if a database access error occursvoid dropSequence(ExtendedConnection connection, java.lang.String sequenceName) throws java.sql.SQLException
connection - the connection on which to execute the operationsequenceName - the name of the sequence to be droppedjava.sql.SQLException - if a database access error occurs or the specified
sequence doesn't existboolean sequenceExists(ExtendedConnection connection, java.lang.String sequenceName) throws java.sql.SQLException
connection - the connection on which to execute the operationsequenceName - the sequence to be testedjava.sql.SQLException - if a database access error occurslong nextID(ExtendedConnection connection, java.lang.String sequenceName) throws java.sql.SQLException
connection - the connection on which to execute the operationsequenceName - the sequence from which to return the next IDjava.sql.SQLException - if a database access error occursvoid lockTable(ExtendedConnection con, java.lang.String tableName, long timeout) throws java.sql.SQLException, java.util.concurrent.TimeoutException
The designated connection needs to have auto-commit disabled. The table lock is held until the end of the transaction! So be sure to not hold any other locks and usually use a separate transaction for locking the table unless modifying the very same table.
Note that not all DBMS support timed wait. These will throw an
UnsupportedOperationException.
con - The connection on which to lock the table.tableName - The name of the table which to lock. This table has to
exist.timeout - The wait time in milliseconds. Use 0 to not wait at all
(just try to lock) or a negative value to wait forever.java.sql.SQLException - If there are problems locking the designated table, an
SQLException will be thrown.java.util.concurrent.TimeoutException - If the designated timeout elapsed before the lock
can be acquired, a TimeoutException will be thrown.java.lang.String useLockTimeout(ExtendedConnection con, java.lang.String query, long timeout) throws java.sql.SQLException
NOWAIT as
well as waiting forever.
Note that not all DBMS support a lock timeout for each query separately.
These will return the designated query unchanged. In this case you need to
set the lock timeout for the transaction temporarily using
setLockTimeout(ExtendedConnection, long).
DBMS not supporting a lock timeout will also return the designated query unchanged.
con - The connection for which to set a lock timeout for the
designated query.query - The query which should use a specific lock timeout.timeout - The lock timeout in milliseconds. Use 0 to not wait at all,
use -1 to wait forever.java.sql.SQLException - If there are problems appending the lock timeout, e.g.
when accessing the meta data of the designated connection, an
SQLException will be thrown.long setLockTimeout(ExtendedConnection con, long timeout) throws java.sql.SQLException
finally.
Note that not all DBMS support a lock timeout for a transaction but require
the lock timeout for each query separately. So you need to
setLockTimeout(ExtendedConnection, long) as well as
useLockTimeout(ExtendedConnection, String, long).
Note that not all DBMS support a dynamic lock timeout. These will throw an
UnsupportedOperationException.
con - The connection which contains the transaction for which to set
the lock timeout.timeout - The lock timeout in milliseconds. Use 0 to not wait at all,
use -1 to wait forever.java.sql.SQLException - If there are problems setting the lock timeout, an
SQLException will be thrown.void setDefaultLockTimeout(ExtendedConnection con) throws java.sql.SQLException
con - The connection for which to set the default lock timeout.java.sql.SQLException - If there are problems setting the lock timeout, an
SQLException will be thrown.java.lang.String createRecursionTable(ExtendedConnection connection, java.lang.String[] selectAttributes, java.lang.String tableName, java.lang.String startCondition, ParentToChildConnection[] parentToChildConnections, int maxDepth) throws java.sql.SQLException
Therefore not all features are supported. The main restriction are the SELECT-attributes. They are always from the current recursion step which means a tuple always contains only values from the child tables. There are no tuples containing (joined) parent and child attributes. Further aggregation is not supported. This can be achieved by grouping all resulting tuples by their level.
Following are examples for translations of the method parameters to DB2- and Oracle-syntax. in DB2:
CREATE TABLE return AS
WITH RecRel(Depth, selectAttributes[]) AS
(SELECT 1, selectAttributes[]
FROM tableName
WHERE startCondition
UNION ALL
SELECT Parent.Depth + 1, Child.selectAttributes[]
FROM RecRel AS Parent, tableName AS Child
WHERE Parent.parentToChildConnection[0].getParentAttribute()
parentToChildConnection[0].getOperator()
Child.parentToChildConnection[0].getChildAttribute()
AND Parent.parentToChildConnection[1].getParentAttribute()
parentToChildConnection[1].getOperator()
Child.parentToChildConnection[1].getChildAttribute()
AND ...
AND Parent.Depth < maxDepth
)
SELECT *
FROM RecRel
in Oracle:
CREATE TABLE return AS
SELECT Depth, selectAttributes[]
FROM tableName
START WITH startCondition
CONNECT BY PRIOR parentToChildConnection[0]
AND PRIOR parentToChildConnection[1]
AND ...
AND Depth <= maxDepth
connection - the connection on which to execute the operationselectAttributes - Array of the names of the columns to be in the
created recursion table. The names have to be valid column names
of the specified table.tableName - The name of the table which contains the hierarchical
data. If the hierarchical data spans several tables, a new
temporary table will have to be created by joining these tables.
Thus the name of the temporary table is to be used as parameter.startCondition - A string forming a valid WHERE-condition which
specifies the conditions which have to hold for the top-level
tuples respectively the tuples for the start of the recursion. The
string may be any valid WHERE-condition, even complex ones, as
long as it is understood by all database-management-systems. The
names have to be valid column names of the specified table.parentToChildConnections - An array consisting of
ParentToChildConnections that specify WHERE-conditions for joining
the hierarchical data. The individual ParentToChildConnections are
logically linked via AND. These can only contain columns that are
part of the selectAttributes.maxDepth - The maximum depth of the recursion/hierarchical level which
is needed. The recursions will stop when this depth is reached
even if not all tuples are reached.java.sql.SQLException - If a database access error occurs or the specified
attributes, the table name or the conditions are invalid, a
SQLException will be thrown.java.lang.String createRecursionTable(ExtendedConnection connection, java.lang.String[] selectAttributes, java.lang.String[] rootAttributes, java.lang.String tableName, java.lang.String startCondition, ParentToChildConnection[] parentToChildConnections) throws java.sql.SQLException
createRecursionTable(ExtendedConnection, String[], String, String, ParentToChildConnection[], int)
but without a maximum depth. Here the recursion stops as soon as there are
no more tuples in a recursion step.
Following are examples for translations of the method parameters to DB2- and Oracle-syntax. in DB2:
CREATE TABLE return AS
WITH RecRel(Depth, selectAttributes[]) AS
(SELECT 1, selectAttributes[]
FROM tableName
WHERE startCondition
UNION ALL
SELECT Parent.Depth + 1, Parent.rootAttributes[], Child.selectAttributes[]
FROM RecRel AS Parent, tableName AS Child
WHERE Parent.parentToChildConnection[0].getParentAttribute()
parentToChildConnection[0].getOperator()
Child.parentToChildConnection[0].getChildAttribute()
AND Parent.parentToChildConnection[1].getParentAttribute()
parentToChildConnection[1].getOperator()
Child.parentToChildConnection[1].getChildAttribute()
AND ...
)
SELECT *
FROM RecRel
in Oracle:
CREATE TABLE return AS
SELECT Depth, CONNECT_BY_ROOT rootAttributes[], (additional) selectAttributes[]
FROM tableName
START WITH startCondition
CONNECT BY PRIOR parentToChildConnection[0]
AND PRIOR parentToChildConnection[1]
AND ...
connection - the connection on which to execute the operationselectAttributes - Array of the names of the columns to be in the
created recursion table. The names have to be valid column names
of the specified table.rootAttributes - Array of the names of columns of the root table, that
is, these values will be constant in each recursion step and
therefore stem from recursion initialisation. This is a subset of
the selectAttributes. If this is null,
each tuple from a recursion step will have new attributes.tableName - The name of the table which contains the hierarchical
data. If the hierarchical data spans several tables, a new
temporary table will have to be created by joining these tables.
Thus the name of the temporary table is to be used as parameter.startCondition - A string forming a valid WHERE-condition which
specifies the conditions which have to hold for the top-level
tuples respectively the tuples for the start of the recursion. The
string may be any valid WHERE-condition, even complex ones, as
long as it is understood by all database-management-systems. The
names have to be valid column names of the specified table.parentToChildConnections - An array consisting of
ParentToChildConnections that specify WHERE-conditions for joining
the hierarchical data. The individual ParentToChildConnections are
logically linked via AND. These can only contain columns that are
part of the selectAttributes.java.sql.SQLException - If a database access error occurs or the specified
attributes, the table name or the conditions are invalid, a
SQLException will be thrown.void dropAllRecursionTables(ExtendedConnection connection) throws java.sql.SQLException
createRecursionTable(String[],
String, String, String[], int) are dropped. This needs to be done to
clean up the database. The corresponding table names are stored internally
and need not be provided.connection - the connection on which to execute the operationjava.sql.SQLException - If a database access error occurs, a
SQLException will be thrown.createRecursionTable(ExtendedConnection, String[], String[], String,
String, ParentToChildConnection[])void dropRecursionTable(ExtendedConnection connection, java.lang.String tableName) throws java.sql.SQLException
createRecursionTable(String[], String, String, String[], int)
is dropped. This needs to be done to clean up the database. If the provided
table has not been created by
createRecursionTable(String[], String, String,
String[], int),
the call will be ignored. If the table has been created by
createRecursionTable(String[], String, String, String[], int)
but does not exists in the database any more, a DBException
will be raised.
Implementors of this method have to take care not to drop the table again
in dropAllRecursionTables().
connection - the connection on which to execute the operationtableName - The name of the created temporary table. If it has not
been created by
createRecursionTable(String[], String, String,
String[], int),
the call will be ignored. If the table does otherwise not exist in
the database, a DBException will be raised.java.sql.SQLException - If a database access error occurs, a
SQLException will be thrown, especially if the
provided table does not exist.dropAllRecursionTables(ExtendedConnection),
createRecursionTable(ExtendedConnection, String[], String, String,
ParentToChildConnection[], int)void terminate(ExtendedConnection con)
con - The connection with which to access the database for clean-up.