public interface DBMSHandler
| Modifier and Type | Interface and Description |
|---|---|
static interface |
DBMSHandler.DBSetGenKeys
This interface is used to set the auto generated keys when executing insert statements.
|
| Modifier and Type | Method and Description |
|---|---|
void |
appendEnableRelationStmt(DBRelation r,
boolean enable,
DBSQLScript script)
Appends a statement to enable or disable a foreign key relation.
|
void |
appendObjectName(DBSQLBuilder sql,
String name,
Boolean useQuotes)
Appends a table, view or column name to an SQL phrase.
|
void |
attachDatabase(DBDatabase db,
Connection conn)
Called when a database is opened
|
boolean |
checkExists(DBDatabase db,
Connection conn)
Checks if a database exists
|
void |
closeResultSet(ResultSet rset)
Closes the provided JDBC Resultset
Use it instead of rset.close() and stmt.close()
|
DBCommandExpr |
createCombinedCommand(DBCommandExpr left,
String keyWord,
DBCommandExpr right)
This function gives the dbms a chance to provide a custom implementation
for a combined command such as UNION or INTERSECT
|
DBCommand |
createCommand(boolean autoPrepareStmt)
This function creates a DBCommand for this DBMS
|
DBModelChecker |
createModelChecker(DBDatabase db)
Creates a DataModelChecker instance of this DBMSHandler
|
DBModelParser |
createModelParser(String catalog,
String schema)
Creates a DataModelParser instance of this DBMSHandler
|
DBSQLBuilder |
createSQLBuilder()
This function creates a DBSQLBuilder for this DBMS
|
void |
detachDatabase(DBDatabase db,
Connection conn)
Called when a database is closed
|
int[] |
executeBatch(String[] sqlCmd,
Object[][] sqlCmdParams,
Connection conn)
Executes a list of sql statements as batch
|
ResultSet |
executeQuery(String sqlCmd,
Object[] sqlParams,
boolean scrollable,
Connection conn)
Executes an select SQL-command and returns the query results
|
int |
executeSQL(String sqlCmd,
Object[] sqlParams,
Connection conn,
DBMSHandler.DBSetGenKeys genKeys)
Executes an insert, update or delete SQL-command
|
String |
extractErrorMessage(SQLException e)
Extracts native error message of an sqlExeption.
|
Object |
getColumnAutoValue(DBDatabase db,
DBTableColumn column,
Connection conn)
Returns an auto-generated value for a particular column
|
String |
getConvertPhrase(DataType destType,
DataType srcType,
Object format)
Returns a data type convertion phrase template for this dbms
The returned template must contain a '?' |
void |
getDDLScript(DBDDLGenerator.DDLActionType type,
DBObject dbo,
DBSQLScript script)
Appends the required DLL commands to create, drop or alter an object to the supplied DBDQLScript.
|
Object |
getResultValue(ResultSet rset,
int columnIndex,
DataType dataType)
Reads a single column value from the given JDBC ResultSet and returns a value object of desired data type.
|
String |
getSQLPhrase(DBSqlPhrase phrase)
Returns an sql phrase template for this database system.
|
Timestamp |
getUpdateTimestamp(Connection conn)
Returns a DMBS-Timestamp that is used for record updates.
|
boolean |
isSupported(DBMSFeature type)
Returns whether or not a particular feature is supported by this dbms
|
Object |
querySingleValue(String sqlCmd,
Object[] sqlParams,
DataType dataType,
Connection conn)
Executes an select SQL-command that returns only one scalar value
if no row are returned by the query then ObjectUtils.NO_VALUE is returned
|
boolean checkExists(DBDatabase db, Connection conn)
db - the databaseconn - the Jdbc connectionvoid attachDatabase(DBDatabase db, Connection conn)
db - the databaseconn - the Jdbc connectionvoid detachDatabase(DBDatabase db, Connection conn)
db - the databaseconn - the Jdbc connectionDBSQLBuilder createSQLBuilder()
DBCommand createCommand(boolean autoPrepareStmt)
autoPrepareStmt - whether or not the Command should automatically generate a prepared statement (using ?)DBCommandExpr createCombinedCommand(DBCommandExpr left, String keyWord, DBCommandExpr right)
left - the left commandkeyWord - the key word (either "UNION" or "INTERSECT")right - the right commandboolean isSupported(DBMSFeature type)
type - type of requested feature. @see DBMSFeaturevoid appendObjectName(DBSQLBuilder sql, String name, Boolean useQuotes)
sql - the StringBuilder containing the SQL phrase.name - the name of the object (table, view or column)useQuotes - use quotes or not. When null is passed then detectQuoteName() is calledString getSQLPhrase(DBSqlPhrase phrase)
phrase - the identifier of the phraseString getConvertPhrase(DataType destType, DataType srcType, Object format)
destType - the target data typesrcType - the source data typeformat - additional formatting information (optional)Timestamp getUpdateTimestamp(Connection conn)
conn - the connection that might be usedObject getColumnAutoValue(DBDatabase db, DBTableColumn column, Connection conn)
db - the databasecolumn - the column for which a value is requiredconn - a valid database connectionObject querySingleValue(String sqlCmd, Object[] sqlParams, DataType dataType, Connection conn)
sqlCmd - the SQL-CommandsqlParams - array of sql command parameters used for prepared statements (Optional).dataType - the requested return typeconn - a valid connection to the database.int executeSQL(String sqlCmd, Object[] sqlParams, Connection conn, DBMSHandler.DBSetGenKeys genKeys) throws SQLException
sqlCmd - the SQL-CommandsqlParams - array of sql command parameters used for prepared statements (Optional).conn - a valid connection to the database.genKeys - allows to set the auto generated key of a record (INSERT statements only)SQLException - thrown if a database access error occursint[] executeBatch(String[] sqlCmd, Object[][] sqlCmdParams, Connection conn) throws SQLException
sqlCmd - the sql commandsqlCmdParams - the command paramsconn - the jdbc connectionSQLException - thrown if a database access error occursResultSet executeQuery(String sqlCmd, Object[] sqlParams, boolean scrollable, Connection conn) throws SQLException
sqlCmd - the SQL-CommandsqlParams - array of sql command parameters used for prepared statements (Optional).scrollable - true if scrollable or false otherwiseconn - a valid connection to the database.SQLException - thrown if a database access error occursObject getResultValue(ResultSet rset, int columnIndex, DataType dataType) throws SQLException
rset - the sql Resultset with the current data rowcolumnIndex - one based column Index of the desired columndataType - the required data typeSQLException - if a database access error occursvoid closeResultSet(ResultSet rset)
rset - a ResultSet objectvoid getDDLScript(DBDDLGenerator.DDLActionType type, DBObject dbo, DBSQLScript script)
type - operation to perform (CREATE, DROP, ALTER)dbo - the object for which to perform the operation (DBDatabase, DBTable, DBView, DBColumn, DBRelation)script - the script to which to add the DDL command(s)void appendEnableRelationStmt(DBRelation r, boolean enable, DBSQLScript script)
r - the foreign key relation which should be enabled or disabledenable - true to enable the relation or false to disablescript - the script to which to add the DDL command(s)DBModelParser createModelParser(String catalog, String schema)
catalog - the database catalogschema - the database schemaDBModelChecker createModelChecker(DBDatabase db)
db - the databaseString extractErrorMessage(SQLException e)
e - the SQLExceptionCopyright © 2008–2023 Apache Software Foundation. All rights reserved.