public interface DatabaseInterface extends Cloneable
Modifier and Type | Method and Description |
---|---|
void |
addExtraOption(String databaseTypeCode,
String option,
String value)
Add an extra option to the attributes list
|
boolean |
checkIndexExists(Database database,
String schemaName,
String tableName,
String[] idxFields)
Verifies on the specified database connection if an index exists on the fields with the specified name.
|
Object |
clone()
Clone this database interface: copy all info to a new object
|
String |
generateColumnAlias(int columnIndex,
String suggestedName)
Generate a column alias given the column index and suggested name.
|
int |
getAccessType() |
int[] |
getAccessTypeList()
Get the list of possible access types for a database.
|
String |
getAddColumnStatement(String tablename,
ValueMetaInterface v,
String tk,
boolean use_autoinc,
String pk,
boolean semicolon)
Generates the SQL statement to add a column to the specified table
|
Properties |
getAttributes() |
Properties |
getConnectionPoolingProperties() |
String |
getConnectSQL() |
String |
getDatabaseFactoryName()
You can use this method to supply an alternate factory for the test method in the dialogs.
|
String |
getDatabaseName() |
String |
getDatabasePortNumberString() |
String |
getDataTablespace() |
String |
getDataTablespaceDDL(VariableSpace variables,
DatabaseMeta databaseMeta)
Returns the tablespace DDL fragment for a "Data" tablespace.
|
int |
getDefaultDatabasePort() |
String |
getDisplayName() |
String |
getDriverClass()
Obtain the name of the JDBC driver class that we need to use!
|
String |
getDropColumnStatement(String tablename,
ValueMetaInterface v,
String tk,
boolean use_autoinc,
String pk,
boolean semicolon)
Generates the SQL statement to drop a column from the specified table
|
String |
getEndQuote() |
String |
getExtraOptionIndicator() |
Map<String,String> |
getExtraOptions() |
String |
getExtraOptionSeparator() |
String |
getExtraOptionsHelpText() |
String |
getExtraOptionValueSeparator() |
String |
getFieldDefinition(ValueMetaInterface v,
String tk,
String pk,
boolean use_autoinc,
boolean add_fieldname,
boolean add_cr)
Describe a Value as a field in the database.
|
String |
getFunctionAverage() |
String |
getFunctionCount() |
String |
getFunctionMaximum() |
String |
getFunctionMinimum() |
String |
getFunctionSum() |
String |
getHostname() |
String |
getIndexTablespace() |
String |
getIndexTablespaceDDL(VariableSpace variables,
DatabaseMeta databaseMeta)
Returns the tablespace DDL fragment for a "Index" tablespace.
|
int |
getInitialPoolSize() |
String |
getLimitClause(int nrRows) |
int |
getMaxColumnsInIndex() |
int |
getMaximumPoolSize() |
int |
getMaxTextFieldLength()
Get the maximum length of a text field for this database connection.
|
int |
getMaxVARCHARLength()
Get the maximum length of a text field (VARCHAR) for this database connection.
|
String |
getModifyColumnStatement(String tablename,
ValueMetaInterface v,
String tk,
boolean use_autoinc,
String pk,
boolean semicolon)
Generates the SQL statement to modify a column in the specified table
|
String |
getName() |
Long |
getNextBatchId(DatabaseMeta dbm,
Database ldb,
String schemaName,
String tableName,
String fieldName)
Get the next Batch ID from the logging tables.
|
int |
getNotFoundTK(boolean use_autoinc)
Get the not found technical key.
|
ObjectId |
getObjectId() |
PartitionDatabaseMeta[] |
getPartitioningInformation() |
String |
getPassword() |
String |
getPluginId() |
String |
getPluginName() |
String |
getPreferredSchemaName() |
String[] |
getReservedWords() |
String |
getSafeFieldname(String fieldname)
Given a String, this will sanitize and return a value safe for usage as a column name
|
String |
getSchemaTableCombination(String schema_name,
String table_part)
Get the schema-table combination to query the right table.
|
String |
getSelectCountStatement(String tableName)
Returns the SQL Statement that counts the number of rows in the table.
|
String |
getServername() |
String |
getSQLColumnExists(String column,
String tablename) |
String |
getSQLCurrentSequenceValue(String sequenceName)
Get the current value of a database sequence
|
String |
getSQLInsertAutoIncUnknownDimensionRow(String schemaTable,
String keyField,
String versionField)
Get the SQL to insert a new empty unknown record in a dimension.
|
String |
getSQLListOfProcedures() |
String |
getSQLListOfSchemas() |
String |
getSQLListOfSequences() |
String |
getSQLLockTables(String[] tableNames) |
String |
getSQLNextSequenceValue(String sequenceName)
Get the SQL to get the next value of a sequence.
|
String |
getSQLQueryFields(String tableName)
Returns the minimal SQL to launch in order to determine the layout of the resultset for a given database table
|
List<SqlScriptStatement> |
getSqlScriptStatements(String sqlScript)
Parse the statements in the provided SQL script, provide more information about where each was found in the script.
|
String |
getSQLSequenceExists(String sequenceName)
Check if a sequence exists.
|
String |
getSQLTableExists(String tablename) |
String |
getSQLUnlockTables(String[] tableNames) |
String |
getSQLValue(ValueMetaInterface valueMeta,
Object valueData,
String dateFormat)
Convert a value in the SQL equivalent.
|
String |
getStartQuote() |
String[] |
getSynonymTypes() |
String[] |
getTableTypes() |
String |
getTruncateTableStatement(String tableName) |
String |
getURL(String hostname,
String port,
String databaseName) |
String[] |
getUsedLibraries() |
String |
getUsername() |
Object |
getValueFromResultSet(ResultSet resultSet,
ValueMetaInterface valueMeta,
int index)
This method allows a database dialect to convert database specific data types to Kettle data types.
|
String[] |
getViewTypes() |
String |
getXulOverlayFile() |
boolean |
isChanged() |
boolean |
isDefaultingToUppercase() |
boolean |
isDisplaySizeTwiceThePrecision() |
boolean |
isExplorable() |
boolean |
isFetchSizeSupported()
Checks whether or not the command setFetchSize() is supported by the JDBC driver...
|
boolean |
isForcingIdentifiersToLowerCase() |
boolean |
isForcingIdentifiersToUpperCase() |
boolean |
isMySQLVariant() |
boolean |
isPartitioned() |
boolean |
isQuoteAllFields() |
boolean |
isRequiringTransactionsOnQueries() |
boolean |
isStreamingResults() |
boolean |
isSystemTable(String tableName) |
boolean |
isUsingConnectionPool() |
boolean |
isUsingDoubleDecimalAsSchemaTableSeparator() |
boolean |
needsPlaceHolder()
Indicates the need to insert a placeholder (0) for auto increment fields.
|
boolean |
needsToLockAllTables() |
List<String> |
parseStatements(String sqlScript)
Parse all possible statements from the provided SQL script.
|
boolean |
preserveReservedCase() |
boolean |
quoteReservedWords() |
String |
quoteSQLString(String string)
Adds quotes around the string according to the database dialect and also escapes special characters like CR, LF and
the quote character itself.
|
boolean |
releaseSavepoint()
Returns a true of savepoints can be release, false if not.
|
boolean |
requiresCastToVariousForIsNull() |
boolean |
requiresCreateTablePrimaryKeyAppend() |
void |
setAccessType(int accessType) |
void |
setAttributes(Properties attributes)
Set extra attributes on this database connection
|
void |
setChanged(boolean changed) |
void |
setConnectionPoolingProperties(Properties properties)
set the connection pooling properties
|
void |
setConnectSQL(String sql) |
void |
setDatabaseName(String databaseName) |
void |
setDatabasePortNumberString(String databasePortNumberString) |
void |
setDataTablespace(String data_tablespace) |
void |
setDisplayName(String displayName) |
void |
setForcingIdentifiersToLowerCase(boolean forceLowerCase) |
void |
setForcingIdentifiersToUpperCase(boolean forceUpperCase) |
void |
setHostname(String hostname) |
void |
setIndexTablespace(String index_tablespace) |
void |
setInitialPoolSize(int initalPoolSize) |
void |
setMaximumPoolSize(int maximumPoolSize) |
void |
setName(String name) |
void |
setObjectId(ObjectId id) |
void |
setPartitioned(boolean partitioned) |
void |
setPartitioningInformation(PartitionDatabaseMeta[] partitionInfo) |
void |
setPassword(String password) |
void |
setPluginId(String pluginId) |
void |
setPluginName(String pluginName) |
void |
setPreferredSchemaName(String preferredSchemaName) |
void |
setPreserveReservedCase(boolean b) |
void |
setQuoteAllFields(boolean quoteAllFields) |
void |
setServername(String servername) |
void |
setStreamingResults(boolean useStreaming) |
void |
setSupportsBooleanDataType(boolean b) |
void |
setSupportsTimestampDataType(boolean b) |
void |
setUsername(String username) |
void |
setUsingConnectionPool(boolean usePool) |
void |
setUsingDoubleDecimalAsSchemaTableSeparator(boolean useDoubleDecimalSeparator) |
boolean |
supportsAutoInc() |
boolean |
supportsBatchUpdates() |
boolean |
supportsBitmapIndex() |
boolean |
supportsBooleanDataType() |
boolean |
supportsCatalogs() |
boolean |
supportsEmptyTransactions() |
boolean |
supportsErrorHandling() |
boolean |
supportsErrorHandlingOnBatchUpdates() |
boolean |
supportsFloatRoundingOnUpdate() |
boolean |
supportsGetBlob() |
boolean |
supportsNewLinesInSQL() |
boolean |
supportsOptionsInURL() |
boolean |
supportsPreparedStatementMetadataRetrieval()
Most databases allow you to retrieve result metadata by preparing a SELECT statement.
|
boolean |
supportsRepository() |
boolean |
supportsResultSetMetadataRetrievalOnly() |
boolean |
supportsSchemas() |
boolean |
supportsSequenceNoMaxValueOption() |
boolean |
supportsSequences() |
boolean |
supportsSetCharacterStream()
See if this database supports the setCharacterStream() method on a PreparedStatement.
|
boolean |
supportsSetLong() |
boolean |
supportsSetMaxRows() |
boolean |
supportsSynonyms() |
boolean |
supportsTimestampDataType() |
boolean |
supportsTimeStampToDateConversion() |
boolean |
supportsTransactions() |
boolean |
supportsViews() |
boolean |
useSafePoints() |
boolean |
useSchemaNameForTableList() |
String getPluginId()
void setPluginId(String pluginId)
pluginId
- set the plugin id of this plugin (after instantiation)String getPluginName()
void setPluginName(String pluginName)
pluginName
- set the plugin name of this plugin (after instantiation)int getAccessType()
void setAccessType(int accessType)
accessType
- The accessType to set.boolean isChanged()
void setChanged(boolean changed)
changed
- The changed to set.String getName()
void setName(String name)
name
- The connection Name to set.String getDisplayName()
void setDisplayName(String displayName)
displayName
- The un-escaped connection Name to set.String getDatabaseName()
void setDatabaseName(String databaseName)
databaseName
- The databaseName to set.String getDatabasePortNumberString()
void setDatabasePortNumberString(String databasePortNumberString)
databasePortNumberString
- The databasePortNumber to set as a string.String getHostname()
void setHostname(String hostname)
hostname
- The hostname to set.ObjectId getObjectId()
void setObjectId(ObjectId id)
id
- The id to set.String getUsername()
void setUsername(String username)
username
- Sets the username to log onto the database with.String getPassword()
void setPassword(String password)
password
- The password to set.String getServername()
void setServername(String servername)
servername
- The servername to set.String getDataTablespace()
void setDataTablespace(String data_tablespace)
data_tablespace
- the tablespace to store data inString getIndexTablespace()
void setIndexTablespace(String index_tablespace)
index_tablespace
- the tablespace to store indexes inProperties getAttributes()
void setAttributes(Properties attributes)
attributes
- The extra attributes to set on this database connection.boolean supportsSetCharacterStream()
boolean supportsAutoInc()
String getFieldDefinition(ValueMetaInterface v, String tk, String pk, boolean use_autoinc, boolean add_fieldname, boolean add_cr)
v
- The value to describetk
- The field that's going to be the technical keypk
- The field that's going to be the primary keyuse_autoinc
- Use autoincrement or notadd_fieldname
- Add the fieldname to the definition or notadd_cr
- Add a cariage return at the end of the definition or not.int[] getAccessTypeList()
int getDefaultDatabasePort()
String getLimitClause(int nrRows)
nrRows
- The number of rows to which we want to limit the result of the query.String getSQLQueryFields(String tableName)
tableName
- The name of the table to determine the layout forint getNotFoundTK(boolean use_autoinc)
use_autoinc
- Whether or not we want to use an auto increment fieldString getDriverClass()
String getURL(String hostname, String port, String databaseName) throws KettleDatabaseException
hostname
- the hostnameport
- the port as a stringdatabaseName
- the database nameKettleDatabaseException
- in case a configuration error is detected.boolean supportsSequences()
String getSQLNextSequenceValue(String sequenceName)
sequenceName
- The sequence nameString getSQLCurrentSequenceValue(String sequenceName)
sequenceName
- The sequence to checkString getSQLSequenceExists(String sequenceName)
sequenceName
- The sequence to checkboolean isFetchSizeSupported()
boolean supportsTransactions()
boolean supportsBitmapIndex()
boolean supportsSetLong()
boolean supportsSchemas()
boolean supportsCatalogs()
boolean supportsEmptyTransactions()
boolean needsPlaceHolder()
String getFunctionSum()
String getFunctionAverage()
String getFunctionMinimum()
String getFunctionMaximum()
String getFunctionCount()
String getSchemaTableCombination(String schema_name, String table_part)
schema_name
- The schema nametable_part
- The tablenameint getMaxTextFieldLength()
int getMaxVARCHARLength()
String getAddColumnStatement(String tablename, ValueMetaInterface v, String tk, boolean use_autoinc, String pk, boolean semicolon)
tablename
- The table to addv
- The column defined as a valuetk
- the name of the technical key fielduse_autoinc
- whether or not this field uses auto incrementpk
- the name of the primary key fieldsemicolon
- whether or not to add a semi-colon behind the statement.String getDropColumnStatement(String tablename, ValueMetaInterface v, String tk, boolean use_autoinc, String pk, boolean semicolon)
tablename
- The table to addv
- The column defined as a valuetk
- the name of the technical key fielduse_autoinc
- whether or not this field uses auto incrementpk
- the name of the primary key fieldsemicolon
- whether or not to add a semi-colon behind the statement.String getModifyColumnStatement(String tablename, ValueMetaInterface v, String tk, boolean use_autoinc, String pk, boolean semicolon)
tablename
- The table to addv
- The column defined as a valuetk
- the name of the technical key fielduse_autoinc
- whether or not this field uses auto incrementpk
- the name of the primary key fieldsemicolon
- whether or not to add a semi-colon behind the statement.Object clone()
String[] getReservedWords()
boolean quoteReservedWords()
String getStartQuote()
String getEndQuote()
boolean supportsRepository()
String[] getTableTypes()
String[] getViewTypes()
String[] getSynonymTypes()
boolean useSchemaNameForTableList()
boolean supportsViews()
boolean supportsSynonyms()
String getSQLListOfProcedures()
String getTruncateTableStatement(String tableName)
tableName
- The table to be truncated.boolean supportsFloatRoundingOnUpdate()
String getSQLLockTables(String[] tableNames)
tableNames
- The names of the tables to lockString getSQLUnlockTables(String[] tableNames)
tableNames
- The names of the tables to unlockboolean supportsTimeStampToDateConversion()
boolean supportsBatchUpdates()
boolean supportsBooleanDataType()
void setSupportsBooleanDataType(boolean b)
b
- Set to true if the database supports a boolean, bit, logical, ... datatypeboolean preserveReservedCase()
void setPreserveReservedCase(boolean b)
b
- Set to true if reserved words' case should be preservedboolean isDefaultingToUppercase()
Map<String,String> getExtraOptions()
void addExtraOption(String databaseTypeCode, String option, String value)
databaseTypeCode
- The database type code for which the option appliesoption
- The option to setvalue
- The value of the optionString getExtraOptionSeparator()
String getExtraOptionValueSeparator()
String getExtraOptionIndicator()
boolean supportsOptionsInURL()
String getExtraOptionsHelpText()
boolean supportsGetBlob()
String getConnectSQL()
void setConnectSQL(String sql)
sql
- The SQL to execute right after connectingboolean supportsSetMaxRows()
boolean isUsingConnectionPool()
void setUsingConnectionPool(boolean usePool)
usePool
- true if we want to use a database connection poolint getMaximumPoolSize()
void setMaximumPoolSize(int maximumPoolSize)
maximumPoolSize
- the maximum pool sizeint getInitialPoolSize()
void setInitialPoolSize(int initalPoolSize)
initalPoolSize
- the initial pool sizeboolean isPartitioned()
void setPartitioned(boolean partitioned)
partitioned
- true if the connection is set to contain partitioning informationPartitionDatabaseMeta[] getPartitioningInformation()
void setPartitioningInformation(PartitionDatabaseMeta[] partitionInfo)
partitionInfo
- the available partition/host/databases/port combinations in the clusterString[] getUsedLibraries()
Properties getConnectionPoolingProperties()
void setConnectionPoolingProperties(Properties properties)
String getSQLTableExists(String tablename)
tablename
- The table to verify the existance forString getSQLColumnExists(String column, String tablename)
column
- The column to verify the existance fortablename
- The table to verify the existance forboolean needsToLockAllTables()
boolean isStreamingResults()
void setStreamingResults(boolean useStreaming)
useStreaming
- true if we want the database to stream results (normally this is an option just for MySQL).boolean isQuoteAllFields()
void setQuoteAllFields(boolean quoteAllFields)
quoteAllFields
- true if all fields in DB should be quoted.boolean isForcingIdentifiersToLowerCase()
void setForcingIdentifiersToLowerCase(boolean forceLowerCase)
forceLowerCase
- true if all identifiers should be forced to lower caseboolean isForcingIdentifiersToUpperCase()
void setForcingIdentifiersToUpperCase(boolean forceUpperCase)
forceUpperCase
- true if all identifiers should be forced to upper caseboolean isUsingDoubleDecimalAsSchemaTableSeparator()
void setUsingDoubleDecimalAsSchemaTableSeparator(boolean useDoubleDecimalSeparator)
useDoubleDecimalSeparator
- true if we should use a double decimal separator to specify schema/table combinations on MS-SQL serverboolean isRequiringTransactionsOnQueries()
String getDatabaseFactoryName()
String getPreferredSchemaName()
void setPreferredSchemaName(String preferredSchemaName)
preferredSchemaName
- The preferred schema name of this database connection.boolean checkIndexExists(Database database, String schemaName, String tableName, String[] idxFields) throws KettleDatabaseException
database
- schemaName
- tableName
- idxFields
- KettleDatabaseException
boolean supportsSequenceNoMaxValueOption()
boolean requiresCreateTablePrimaryKeyAppend()
boolean requiresCastToVariousForIsNull()
boolean isDisplaySizeTwiceThePrecision()
boolean supportsPreparedStatementMetadataRetrieval()
boolean isSystemTable(String tableName)
tableName
- boolean supportsNewLinesInSQL()
String getSQLListOfSchemas()
int getMaxColumnsInIndex()
boolean supportsErrorHandlingOnBatchUpdates()
String getSQLInsertAutoIncUnknownDimensionRow(String schemaTable, String keyField, String versionField)
schemaTable
- the schema-table name to insert intokeyField
- The key fieldversionField
- the version fieldboolean isExplorable()
String getXulOverlayFile()
String getSQLListOfSequences()
String quoteSQLString(String string)
string
- String getSelectCountStatement(String tableName)
tableName
- String generateColumnAlias(int columnIndex, String suggestedName)
columnIndex
- Index of column in querysuggestedName
- Suggested column nameList<String> parseStatements(String sqlScript)
sqlScript
- Raw SQL Script to be parsed into executable statements.List<SqlScriptStatement> getSqlScriptStatements(String sqlScript)
sqlScript
- Raw SQL Script to be parsed into executable statements.boolean isMySQLVariant()
boolean releaseSavepoint()
Long getNextBatchId(DatabaseMeta dbm, Database ldb, String schemaName, String tableName, String fieldName) throws KettleDatabaseException
dbm
- DatabaseMeta objectldb
- Database connectionschemaName
- Logging Schema NametableName
- Logging Table NamefieldName
- Batch Id Field nameKettleDatabaseException
String getDataTablespaceDDL(VariableSpace variables, DatabaseMeta databaseMeta)
variables
- variables used for possible substitutiondatabaseMeta
- databaseMeta the database meta used for possible string enclosure of the tablespace. This method needs
this as this is done after environmental substitution.String getIndexTablespaceDDL(VariableSpace variables, DatabaseMeta databaseMeta)
variables
- variables used for possible substitutiondatabaseMeta
- databaseMeta the database meta used for possible string enclosure of the tablespace. This method needs
this as this is done after environmental substitution.Object getValueFromResultSet(ResultSet resultSet, ValueMetaInterface valueMeta, int index) throws KettleDatabaseException
resultSet
- The result set to usevalueMeta
- The description of the value to retrieveindex
- the index on which we need to retrieve the value, 0-based.KettleDatabaseException
boolean useSafePoints()
boolean supportsErrorHandling()
String getSQLValue(ValueMetaInterface valueMeta, Object valueData, String dateFormat) throws KettleValueException
valueMeta
- The description of the value. The date format used is taken from this value unless dateFormat is specified
(not null or empty)valueData
- The data to convert.KettleValueException
- in case there is a data conversion error.boolean supportsResultSetMetadataRetrievalOnly()
boolean supportsTimestampDataType()
void setSupportsTimestampDataType(boolean b)
b
- Set to true if the database supports the Timestamp data type (nanosecond precision and all)