Package org.pentaho.di.core.database
Class BaseDatabaseMeta
java.lang.Object
org.pentaho.di.core.database.BaseDatabaseMeta
- All Implemented Interfaces:
Cloneable
,DatabaseInterface
,DatabaseInterfaceExtended
- Direct Known Subclasses:
AS400DatabaseMeta
,AthenaDatabaseMeta
,CacheDatabaseMeta
,DatabricksDatabaseMeta
,DB2DatabaseMeta
,DbaseDatabaseMeta
,DerbyDatabaseMeta
,Exasol4DatabaseMeta
,ExtenDBDatabaseMeta
,FirebirdDatabaseMeta
,GenericDatabaseMeta
,GoogleBigQueryDatabaseMeta
,GuptaDatabaseMeta
,H2DatabaseMeta
,HypersonicDatabaseMeta
,InformixDatabaseMeta
,IngresDatabaseMeta
,InterbaseDatabaseMeta
,KingbaseESDatabaseMeta
,LucidDBDatabaseMeta
,MondrianNativeDatabaseMeta
,MonetDBDatabaseMeta
,MSAccessDatabaseMeta
,MSSQLServerDatabaseMeta
,MySQLDatabaseMeta
,NeoviewDatabaseMeta
,NetezzaDatabaseMeta
,OracleDatabaseMeta
,OracleRDBDatabaseMeta
,PostgreSQLDatabaseMeta
,SAPDBDatabaseMeta
,SnowflakeHVDatabaseMeta
,SQLiteDatabaseMeta
,SybaseDatabaseMeta
,SybaseIQDatabaseMeta
,TeradataDatabaseMeta
,UniVerseDatabaseMeta
,VerticaDatabaseMeta
public abstract class BaseDatabaseMeta
extends Object
implements Cloneable, DatabaseInterfaceExtended
This class contains the basic information on a database connection. It is not intended to be used other than the
inheriting classes such as OracleDatabaseInfo, ...
- Since:
- 11-mrt-2005
- Author:
- Matt
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The clustering database name prefixstatic final String
The clustering hostname prefixstatic final String
The clustering database password prefixstatic final String
The clustering port prefixstatic final String
The clustering database username prefixstatic final String
A flag to determine if we should force all identifiers to lower casestatic final String
A flag to determine if we should force all identifiers to UPPER CASEstatic final String
If we use connection pooling, this would contain the initial pool sizestatic final String
A flag to determine if the connection is clustered or not.static final String
If we use connection pooling, this would contain the maximum pool sizestatic final String
A flag to determine if we should use a double decimal separator to specify schema/table combinations on MS-SQL serverstatic final String
The pooling parametersstatic final String
The port number of the database as string: allows for parameterization.static final String
The preferred schema to use if no other has been specified.static final String
The prefix for all the extra options attributesstatic final String
Checkbox to allow you to configure if the reserved words will have their case changed during the handleCase callstatic final String
A flag to determine if we should quote all fieldsstatic final String
The SQL to execute at connect time (right after connecting)static final String
Checkbox to allow you to configure if the database supports the boolean data type or not.static final String
Checkbox to allow you to configure if the database supports the Timestamp data type or not.static final String
A flag to determine if we should use connection pooling or not.static final String
A flag to determine if we should use result streaming on MySQLstatic final String
static final String
static final DatabaseConnectionPoolParameter[]
protected boolean
Boolean to indicate if savepoints can be released Most databases do, so we set it to true.static final String
The SQL, minus the table name, to select the number of rows from a tablestatic final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttribute
(String attributeId, String value) Add extra attribute on this connectionvoid
Set default options for this databasevoid
addExtraOption
(String databaseTypeCode, String option, String value) Add an extra option to the attributes listboolean
canTest()
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.clone()
Clone the basic settings for this connection!customizeValueFromSQLType
(ValueMetaInterface v, ResultSetMetaData rm, int index) Customizes the ValueMetaInterface defined in the baseboolean
Returns false if exception doesn't require full exception log.generateColumnAlias
(int columnIndex, String suggestedName) Generate a column alias given the column index and suggested name.int
abstract int[]
Get the list of possible access types for a database.getAttribute
(String attributeId, String defaultValue) Gets an attribute from the connectiongetBackwardsCompatibleSchemaTableCombination
(String schemaPart, String tablePart) Deprecated.we should phase this out in 5.0, but it's there to keep backwards compatibility in the 4.x releases.getBackwardsCompatibleTable
(String tablePart) Deprecated.we should phase this out in 5.0, but it's there to keep backwards compatibility in the 4.x releases.Customizes the ValueMetaInterface defined in the baseYou can use this method to supply an alternate factory for the test method in the dialogs.getDataTablespaceDDL
(VariableSpace variables, DatabaseMeta databaseMeta) Returns the tablespace DDL fragment for a "Data" tablespace.int
getDropColumnStatement
(String tablename, ValueMetaInterface v, String tk, boolean useAutoinc, String pk, boolean semicolon) Generates the SQL statement to drop a column from the specified tablegetDropTableIfExistsStatement
(String tableName) Forms drop table statement.protected String
getIndexTablespaceDDL
(VariableSpace variables, DatabaseMeta databaseMeta) Returns the tablespace DDL fragment for a "Index" tablespace.int
getLimitClause
(int nrRows) int
int
int
Get the maximum length of a text field for this database connection.int
Get the maximum length of a text field (VARCHAR) for this database connection.getName()
getNextBatchId
(DatabaseMeta dbm, Database ldb, String schemaName, String tableName, String fieldName) Get the next Batch ID from the logging tables.getNextBatchIdUsingAutoIncSQL
(String autoIncSQL, DatabaseMeta dbm, Database ldb) getNextBatchIdUsingLockTables
(DatabaseMeta dbm, Database ldb, String schemaName, String tableName, String fieldName) getNextBatchIdUsingSequence
(String sequenceName, String schemaName, DatabaseMeta dbm, Database ldb) int
getNotFoundTK
(boolean useAutoinc) Get the not found technical key.String[]
getSafeFieldname
(String fieldName) Sanitize a string for usage as a field name Append an underscore to any field name that matches a reserved word Replaces spaces with underscores Prefixes a string with underscore that begins with a numbergetSchemaTableCombination
(String schemaName, String tablePart) Get the schema-table combination to query the right table.getSelectCountStatement
(String tableName) Build the SQL to count the number of rows in the passed table.getSQLColumnExists
(String columnname, String tablename) getSQLCurrentSequenceValue
(String sequenceName) Get the current value of a database sequencegetSQLInsertAutoIncUnknownDimensionRow
(String schemaTable, String keyField, String versionField) Get the SQL to insert a new empty unknown record in a dimension.getSQLLockTables
(String[] tableNames) getSQLNextSequenceValue
(String sequenceName) Get the SQL to get the next value of a sequence.getSQLQueryFields
(String tableName) Returns the minimal SQL to launch in order to determine the layout of the resultset for a given database tablegetSqlScriptStatements
(String sqlScript) Parse the statements in the provided SQL script, provide more information about where each was found in the script.getSQLSequenceExists
(String sequenceName) Check if a sequence exists.getSQLTableExists
(String tablename) getSQLUnlockTables
(String[] tableNames) getSQLValue
(ValueMetaInterface valueMeta, Object valueData, String dateFormat) Convert a value in the SQL equivalent.String[]
getTablespaceDDL
(VariableSpace variables, DatabaseMeta databaseMeta, String tablespaceName) Returns an empty string as most databases do not support tablespaces.String[]
getTruncateTableStatement
(String tableName) getValueFromResultSet
(ResultSet rs, ValueMetaInterface val, int i) This method allows a database dialect to convert database specific data types to Kettle data types.String[]
boolean
boolean
boolean
boolean
boolean
Checks whether or not the command setFetchSize() is supported by the JDBC driver...boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
isSystemTable
(String tableName) boolean
boolean
boolean
Indicates the need to insert a placeholder (0) for auto increment fields.boolean
protected boolean
onlySpaces
(String str) parseStatements
(String sqlScript) Parse all possible statements from the provided SQL script.boolean
boolean
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
Returns a true of savepoints can be released, false if not.boolean
boolean
boolean
void
setAccessType
(int accessType) void
setAttributes
(Properties attributes) Set extra attributes on this database connectionvoid
setChanged
(boolean changed) void
setConnectionPoolingProperties
(Properties properties) set the connection pooling propertiesvoid
setConnectSQL
(String sql) void
setDatabaseName
(String databaseName) void
setDatabasePortNumberString
(String databasePortNumberString) void
setDataTablespace
(String dataTablespace) void
setDisplayName
(String displayName) void
setForcingIdentifiersToLowerCase
(boolean forceLowerCase) void
setForcingIdentifiersToUpperCase
(boolean forceUpperCase) void
setHostname
(String hostname) void
setIndexTablespace
(String indexTablespace) void
setInitialPoolSize
(int initialPoolSize) void
setInitialPoolSizeString
(String initialPoolSize) void
setMaximumPoolSize
(int maximumPoolSize) void
setMaximumPoolSizeString
(String maximumPoolSize) void
void
setNamedCluster
(String namedCluster) Set the hadoop cluster associated with the connectionvoid
setObjectId
(ObjectId id) void
setPartitioned
(boolean clustered) void
setPartitioningInformation
(PartitionDatabaseMeta[] clusterInfo) 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
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
Most databases round number(7,2) 17.29999999 to 17.30, but some don't.boolean
boolean
boolean
boolean
Most databases allow you to retrieve result metadata by preparing a SELECT statement.boolean
boolean
boolean
boolean
boolean
boolean
See if this database supports the setCharacterStream() method on a PreparedStatement.boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.pentaho.di.core.database.DatabaseInterface
createSqlScriptParser, getAddColumnStatement, getDriverClass, getFieldDefinition, getLegacyColumnName, getModifyColumnStatement, getNamedClusterList, getSchemas, getSQLListOfSchemas, getTables, getUnsupportedTableOutputMessage, getURL, getUsedLibraries, putOptionalOptions, supportsIndexes, supportsStandardTableOutput
-
Field Details
-
ATTRIBUTE_PORT_NUMBER
The port number of the database as string: allows for parameterization.- See Also:
-
ATTRIBUTE_SQL_CONNECT
The SQL to execute at connect time (right after connecting)- See Also:
-
ATTRIBUTE_USE_POOLING
A flag to determine if we should use connection pooling or not.- See Also:
-
ATTRIBUTE_MAXIMUM_POOL_SIZE
If we use connection pooling, this would contain the maximum pool size- See Also:
-
ATTRIBUTE_INITIAL_POOL_SIZE
If we use connection pooling, this would contain the initial pool size- See Also:
-
ATTRIBUTE_PREFIX_EXTRA_OPTION
The prefix for all the extra options attributes- See Also:
-
ATTRIBUTE_IS_CLUSTERED
A flag to determine if the connection is clustered or not.- See Also:
-
ATTRIBUTE_CLUSTER_HOSTNAME_PREFIX
The clustering hostname prefix- See Also:
-
ATTRIBUTE_CLUSTER_PORT_PREFIX
The clustering port prefix- See Also:
-
ATTRIBUTE_CLUSTER_DBNAME_PREFIX
The clustering database name prefix- See Also:
-
ATTRIBUTE_CLUSTER_USERNAME_PREFIX
The clustering database username prefix- See Also:
-
ATTRIBUTE_CLUSTER_PASSWORD_PREFIX
The clustering database password prefix- See Also:
-
ATTRIBUTE_POOLING_PARAMETER_PREFIX
The pooling parameters- See Also:
-
ATTRIBUTE_USE_RESULT_STREAMING
A flag to determine if we should use result streaming on MySQL- See Also:
-
ATTRIBUTE_MSSQL_DOUBLE_DECIMAL_SEPARATOR
A flag to determine if we should use a double decimal separator to specify schema/table combinations on MS-SQL server- See Also:
-
ATTRIBUTE_QUOTE_ALL_FIELDS
A flag to determine if we should quote all fields- See Also:
-
ATTRIBUTE_FORCE_IDENTIFIERS_TO_LOWERCASE
A flag to determine if we should force all identifiers to lower case- See Also:
-
ATTRIBUTE_FORCE_IDENTIFIERS_TO_UPPERCASE
A flag to determine if we should force all identifiers to UPPER CASE- See Also:
-
ATTRIBUTE_PREFERRED_SCHEMA_NAME
The preferred schema to use if no other has been specified.- See Also:
-
ATTRIBUTE_SUPPORTS_BOOLEAN_DATA_TYPE
Checkbox to allow you to configure if the database supports the boolean data type or not. Defaults to "false" for backward compatibility!- See Also:
-
ATTRIBUTE_SUPPORTS_TIMESTAMP_DATA_TYPE
Checkbox to allow you to configure if the database supports the Timestamp data type or not. Defaults to "false" for backward compatibility!- See Also:
-
ATTRIBUTE_PRESERVE_RESERVED_WORD_CASE
Checkbox to allow you to configure if the reserved words will have their case changed during the handleCase call- See Also:
-
SEQUENCE_FOR_BATCH_ID
- See Also:
-
AUTOINCREMENT_SQL_FOR_BATCH_ID
- See Also:
-
NAMED_CLUSTER_ID
- See Also:
-
releaseSavepoint
protected boolean releaseSavepointBoolean to indicate if savepoints can be released Most databases do, so we set it to true. Child classes can overwrite with false if need be. -
SELECT_COUNT_STATEMENT
The SQL, minus the table name, to select the number of rows from a table- See Also:
-
poolingParameters
-
-
Constructor Details
-
BaseDatabaseMeta
public BaseDatabaseMeta()
-
-
Method Details
-
getPluginId
- Specified by:
getPluginId
in interfaceDatabaseInterface
- Returns:
- plugin ID of this class
-
setPluginId
- Specified by:
setPluginId
in interfaceDatabaseInterface
- Parameters:
pluginId
- The plugin ID to set.
-
getPluginName
- Specified by:
getPluginName
in interfaceDatabaseInterface
- Returns:
- plugin name of this class
-
setPluginName
- Specified by:
setPluginName
in interfaceDatabaseInterface
- Parameters:
pluginName
- The plugin name to set.
-
getAccessTypeList
public abstract int[] getAccessTypeList()Description copied from interface:DatabaseInterface
Get the list of possible access types for a database.- Specified by:
getAccessTypeList
in interfaceDatabaseInterface
- Returns:
- the list of possible access types for a database.
-
getAccessType
public int getAccessType()- Specified by:
getAccessType
in interfaceDatabaseInterface
- Returns:
- Returns the accessType.
-
setAccessType
public void setAccessType(int accessType) - Specified by:
setAccessType
in interfaceDatabaseInterface
- Parameters:
accessType
- The accessType to set.
-
isChanged
public boolean isChanged()- Specified by:
isChanged
in interfaceDatabaseInterface
- Returns:
- Returns the changed.
-
setChanged
public void setChanged(boolean changed) - Specified by:
setChanged
in interfaceDatabaseInterface
- Parameters:
changed
- The changed to set.
-
getName
- Specified by:
getName
in interfaceDatabaseInterface
- Returns:
- Returns the connection name.
-
setName
- Specified by:
setName
in interfaceDatabaseInterface
- Parameters:
name
- The connection Name to set.
-
getDisplayName
- Specified by:
getDisplayName
in interfaceDatabaseInterface
- Returns:
- Returns the un-escaped connection Name.
-
setDisplayName
- Specified by:
setDisplayName
in interfaceDatabaseInterface
- Parameters:
displayName
- The un-escaped connection Name to set.
-
getDatabaseName
- Specified by:
getDatabaseName
in interfaceDatabaseInterface
- Returns:
- Returns the databaseName.
-
setDatabaseName
- Specified by:
setDatabaseName
in interfaceDatabaseInterface
- Parameters:
databaseName
- The databaseName to set.
-
setDatabasePortNumberString
- Specified by:
setDatabasePortNumberString
in interfaceDatabaseInterface
- Parameters:
databasePortNumberString
- The databasePortNumber string to set.
-
getDatabasePortNumberString
- Specified by:
getDatabasePortNumberString
in interfaceDatabaseInterface
- Returns:
- Returns the databasePortNumber string.
-
getHostname
- Specified by:
getHostname
in interfaceDatabaseInterface
- Returns:
- Returns the hostname.
-
setHostname
- Specified by:
setHostname
in interfaceDatabaseInterface
- Parameters:
hostname
- The hostname to set.
-
getObjectId
- Specified by:
getObjectId
in interfaceDatabaseInterface
- Returns:
- Returns the id.
-
setObjectId
- Specified by:
setObjectId
in interfaceDatabaseInterface
- Parameters:
id
- The id to set.
-
getPassword
- Specified by:
getPassword
in interfaceDatabaseInterface
- Returns:
- Returns the password.
-
setPassword
- Specified by:
setPassword
in interfaceDatabaseInterface
- Parameters:
password
- The password to set.
-
getServername
- Specified by:
getServername
in interfaceDatabaseInterface
- Returns:
- Returns the servername.
-
setServername
- Specified by:
setServername
in interfaceDatabaseInterface
- Parameters:
servername
- The servername to set.
-
getDataTablespace
- Specified by:
getDataTablespace
in interfaceDatabaseInterface
- Returns:
- Returns the tablespaceData.
-
setDataTablespace
- Specified by:
setDataTablespace
in interfaceDatabaseInterface
- Parameters:
dataTablespace
- The data tablespace to set.
-
getIndexTablespace
- Specified by:
getIndexTablespace
in interfaceDatabaseInterface
- Returns:
- Returns the index tablespace.
-
setIndexTablespace
- Specified by:
setIndexTablespace
in interfaceDatabaseInterface
- Parameters:
indexTablespace
- The index tablespace to set.
-
getUsername
- Specified by:
getUsername
in interfaceDatabaseInterface
- Returns:
- Returns the username.
-
setUsername
- Specified by:
setUsername
in interfaceDatabaseInterface
- Parameters:
username
- The username to set.
-
getAttributes
- Specified by:
getAttributes
in interfaceDatabaseInterface
- Returns:
- The extra attributes for this database connection
-
setAttributes
Set extra attributes on this database connection- Specified by:
setAttributes
in interfaceDatabaseInterface
- Parameters:
attributes
- The extra attributes to set on this database connection.
-
clone
Clone the basic settings for this connection!- Specified by:
clone
in interfaceDatabaseInterface
- Overrides:
clone
in classObject
- Returns:
- the cloned Database Interface object.
-
getDefaultDatabasePort
public int getDefaultDatabasePort()- Specified by:
getDefaultDatabasePort
in interfaceDatabaseInterface
- Returns:
- the default database port number
-
getDefaultOptions
- Specified by:
getDefaultOptions
in interfaceDatabaseInterface
- Returns:
- default extra Options
-
supportsSetCharacterStream
public boolean supportsSetCharacterStream()See if this database supports the setCharacterStream() method on a PreparedStatement.- Specified by:
supportsSetCharacterStream
in interfaceDatabaseInterface
- Returns:
- true if we can set a Stream on a field in a PreparedStatement. False if not.
-
supportsAutoInc
public boolean supportsAutoInc()- Specified by:
supportsAutoInc
in interfaceDatabaseInterface
- Returns:
- Whether or not the database can use auto increment type of fields (pk)
-
getLimitClause
- Specified by:
getLimitClause
in interfaceDatabaseInterface
- Parameters:
nrRows
- The number of rows to which we want to limit the result of the query.- Returns:
- the clause after a select statement to limit the number of rows
-
getNotFoundTK
public int getNotFoundTK(boolean useAutoinc) Description copied from interface:DatabaseInterface
Get the not found technical key.- Specified by:
getNotFoundTK
in interfaceDatabaseInterface
- Parameters:
useAutoinc
- Whether or not we want to use an auto increment field- Returns:
- the lowest possible technical key to be used as the NOT FOUND row in a slowly changing dimension.
-
getSQLNextSequenceValue
Get the SQL to get the next value of a sequence. (Oracle/PGSQL only)- Specified by:
getSQLNextSequenceValue
in interfaceDatabaseInterface
- Parameters:
sequenceName
- The sequence name- Returns:
- the SQL to get the next value of a sequence. (Oracle/PGSQL only)
-
getSQLCurrentSequenceValue
Get the current value of a database sequence- Specified by:
getSQLCurrentSequenceValue
in interfaceDatabaseInterface
- Parameters:
sequenceName
- The sequence to check- Returns:
- The current value of a database sequence
-
getSQLSequenceExists
Check if a sequence exists.- Specified by:
getSQLSequenceExists
in interfaceDatabaseInterface
- Parameters:
sequenceName
- The sequence to check- Returns:
- The SQL to get the name of the sequence back from the databases data dictionary
-
isFetchSizeSupported
public boolean isFetchSizeSupported()Checks whether or not the command setFetchSize() is supported by the JDBC driver...- Specified by:
isFetchSizeSupported
in interfaceDatabaseInterface
- Returns:
- true is setFetchSize() is supported!
-
needsPlaceHolder
public boolean needsPlaceHolder()Indicates the need to insert a placeholder (0) for auto increment fields.- Specified by:
needsPlaceHolder
in interfaceDatabaseInterface
- Returns:
- true if we need a placeholder for auto increment fields in insert statements.
-
supportsSchemas
public boolean supportsSchemas()- Specified by:
supportsSchemas
in interfaceDatabaseInterface
- Returns:
- true if the database supports schemas
-
supportsCatalogs
public boolean supportsCatalogs()- Specified by:
supportsCatalogs
in interfaceDatabaseInterface
- Returns:
- true if the database supports catalogs
-
supportsEmptyTransactions
public boolean supportsEmptyTransactions()- Specified by:
supportsEmptyTransactions
in interfaceDatabaseInterface
- Returns:
- true when the database engine supports empty transaction. (for example Informix does not on a non-ANSI database type!)
-
getFunctionSum
- Specified by:
getFunctionSum
in interfaceDatabaseInterface
- Returns:
- the function for SUM agrregate
-
getFunctionAverage
- Specified by:
getFunctionAverage
in interfaceDatabaseInterface
- Returns:
- the function for Average agrregate
-
getFunctionMinimum
- Specified by:
getFunctionMinimum
in interfaceDatabaseInterface
- Returns:
- the function for Minimum agrregate
-
getFunctionMaximum
- Specified by:
getFunctionMaximum
in interfaceDatabaseInterface
- Returns:
- the function for Maximum agrregate
-
getFunctionCount
- Specified by:
getFunctionCount
in interfaceDatabaseInterface
- Returns:
- the function for Count agrregate
-
getSchemaTableCombination
Get the schema-table combination to query the right table. Usually that is SCHEMA.TABLENAME, however there are exceptions to this rule...- Specified by:
getSchemaTableCombination
in interfaceDatabaseInterface
- Parameters:
schemaName
- The schema nametablePart
- The tablename- Returns:
- the schema-table combination to query the right table.
-
getBackwardsCompatibleSchemaTableCombination
@Deprecated public String getBackwardsCompatibleSchemaTableCombination(String schemaPart, String tablePart) Deprecated.we should phase this out in 5.0, but it's there to keep backwards compatibility in the 4.x releases.Checks for quotes before quoting schema and table. Many dialects had hardcoded quotes, they probably didn't get updated properly when quoteFields() was introduced to DatabaseMeta.- Parameters:
schemaPart
-tablePart
-- Returns:
- quoted schema and table
-
getBackwardsCompatibleTable
Deprecated.we should phase this out in 5.0, but it's there to keep backwards compatibility in the 4.x releases.Checks for quotes before quoting table. Many dialects had hardcoded quotes, they probably didn't get updated properly when quoteFields() was introduced to DatabaseMeta.- Parameters:
tablePart
-- Returns:
- quoted table
-
getMaxTextFieldLength
public int getMaxTextFieldLength()Get the maximum length of a text field for this database connection. This includes optional CLOB, Memo and Text fields. (the maximum!)- Specified by:
getMaxTextFieldLength
in interfaceDatabaseInterface
- Returns:
- The maximum text field length for this database type. (mostly CLOB_LENGTH)
-
getMaxVARCHARLength
public int getMaxVARCHARLength()Get the maximum length of a text field (VARCHAR) for this database connection. If this size is exceeded use a CLOB.- Specified by:
getMaxVARCHARLength
in interfaceDatabaseInterface
- Returns:
- The maximum VARCHAR field length for this database type. (mostly identical to getMaxTextFieldLength() - CLOB_LENGTH)
-
supportsTransactions
public boolean supportsTransactions()- Specified by:
supportsTransactions
in interfaceDatabaseInterface
- Returns:
- true if the database supports transactions.
-
supportsSequences
public boolean supportsSequences()- Specified by:
supportsSequences
in interfaceDatabaseInterface
- Returns:
- true if the database supports sequences
-
supportsBitmapIndex
public boolean supportsBitmapIndex()- Specified by:
supportsBitmapIndex
in interfaceDatabaseInterface
- Returns:
- true if the database supports bitmap indexes
-
supportsSetLong
public boolean supportsSetLong()- Specified by:
supportsSetLong
in interfaceDatabaseInterface
- Returns:
- true if the database JDBC driver supports the setLong command
-
getDropColumnStatement
public String getDropColumnStatement(String tablename, ValueMetaInterface v, String tk, boolean useAutoinc, String pk, boolean semicolon) Generates the SQL statement to drop a column from the specified table- Specified by:
getDropColumnStatement
in interfaceDatabaseInterface
- Parameters:
tablename
- The table to addv
- The column defined as a valuetk
- the name of the technical key fielduseAutoinc
- 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.- Returns:
- the SQL statement to drop a column from the specified table
-
getReservedWords
- Specified by:
getReservedWords
in interfaceDatabaseInterface
- Returns:
- an array of reserved words for the database type...
-
quoteReservedWords
public boolean quoteReservedWords()- Specified by:
quoteReservedWords
in interfaceDatabaseInterface
- Returns:
- true if reserved words need to be double quoted ("password", "select", ...)
-
getStartQuote
- Specified by:
getStartQuote
in interfaceDatabaseInterface
- Returns:
- The start quote sequence, mostly just double quote, but sometimes [, ...
-
getEndQuote
- Specified by:
getEndQuote
in interfaceDatabaseInterface
- Returns:
- The end quote sequence, mostly just double quote, but sometimes ], ...
-
supportsRepository
public boolean supportsRepository()- Specified by:
supportsRepository
in interfaceDatabaseInterface
- Returns:
- true if Kettle can create a repository on this type of database.
-
getTableTypes
- Specified by:
getTableTypes
in interfaceDatabaseInterface
- Returns:
- a list of table types to retrieve tables for the database
-
getViewTypes
- Specified by:
getViewTypes
in interfaceDatabaseInterface
- Returns:
- a list of table types to retrieve views for the database
-
getSynonymTypes
- Specified by:
getSynonymTypes
in interfaceDatabaseInterface
- Returns:
- a list of table types to retrieve synonyms for the database
-
useSchemaNameForTableList
public boolean useSchemaNameForTableList()- Specified by:
useSchemaNameForTableList
in interfaceDatabaseInterface
- Returns:
- true if we need to supply the schema-name to getTables in order to get a correct list of items.
-
supportsViews
public boolean supportsViews()- Specified by:
supportsViews
in interfaceDatabaseInterface
- Returns:
- true if the database supports views
-
supportsSynonyms
public boolean supportsSynonyms()- Specified by:
supportsSynonyms
in interfaceDatabaseInterface
- Returns:
- true if the database supports synonyms
-
getSQLListOfProcedures
- Specified by:
getSQLListOfProcedures
in interfaceDatabaseInterface
- Returns:
- The SQL on this database to get a list of stored procedures.
-
getSQLListOfSequences
- Specified by:
getSQLListOfSequences
in interfaceDatabaseInterface
- Returns:
- The SQL on this database to get a list of sequences.
-
getTruncateTableStatement
- Specified by:
getTruncateTableStatement
in interfaceDatabaseInterface
- Parameters:
tableName
- The table to be truncated.- Returns:
- The SQL statement to truncate a table: remove all rows from it without a transaction
-
getSQLQueryFields
Returns the minimal SQL to launch in order to determine the layout of the resultset for a given database table- Specified by:
getSQLQueryFields
in interfaceDatabaseInterface
- Parameters:
tableName
- The name of the table to determine the layout for- Returns:
- The SQL to launch.
-
supportsFloatRoundingOnUpdate
public boolean supportsFloatRoundingOnUpdate()Most databases round number(7,2) 17.29999999 to 17.30, but some don't.- Specified by:
supportsFloatRoundingOnUpdate
in interfaceDatabaseInterface
- Returns:
- true if the database supports roundinf of floating point data on update/insert
-
getSQLLockTables
- Specified by:
getSQLLockTables
in interfaceDatabaseInterface
- Parameters:
tableNames
- The names of the tables to lock- Returns:
- The SQL command to lock database tables for write purposes. null is returned in case locking is not supported on the target database. null is the default value
-
getSQLUnlockTables
- Specified by:
getSQLUnlockTables
in interfaceDatabaseInterface
- Parameters:
tableNames
- The names of the tables to unlock- Returns:
- The SQL command to unlock database tables. null is returned in case locking is not supported on the target database. null is the default value
-
supportsTimeStampToDateConversion
public boolean supportsTimeStampToDateConversion()- Specified by:
supportsTimeStampToDateConversion
in interfaceDatabaseInterface
- Returns:
- true if the database supports timestamp to date conversion. For example Interbase doesn't support this!
-
supportsBatchUpdates
public boolean supportsBatchUpdates()- Specified by:
supportsBatchUpdates
in interfaceDatabaseInterface
- Returns:
- true if the database JDBC driver supports batch updates For example Interbase doesn't support this!
-
supportsBooleanDataType
public boolean supportsBooleanDataType()- Specified by:
supportsBooleanDataType
in interfaceDatabaseInterface
- Returns:
- true if the database supports a boolean, bit, logical, ... datatype The default is false: map to a string.
-
setSupportsBooleanDataType
public void setSupportsBooleanDataType(boolean b) - Specified by:
setSupportsBooleanDataType
in interfaceDatabaseInterface
- Parameters:
b
- Set to true if the database supports a boolean, bit, logical, ... datatype
-
supportsTimestampDataType
public boolean supportsTimestampDataType()- Specified by:
supportsTimestampDataType
in interfaceDatabaseInterface
- Returns:
- true if the database supports the Timestamp data type (nanosecond precision and all)
-
setSupportsTimestampDataType
public void setSupportsTimestampDataType(boolean b) - Specified by:
setSupportsTimestampDataType
in interfaceDatabaseInterface
- Parameters:
b
- Set to true if the database supports the Timestamp data type (nanosecond precision and all)
-
preserveReservedCase
public boolean preserveReservedCase()- Specified by:
preserveReservedCase
in interfaceDatabaseInterface
- Returns:
- true if reserved words' case should be preserved
-
setPreserveReservedCase
public void setPreserveReservedCase(boolean b) - Specified by:
setPreserveReservedCase
in interfaceDatabaseInterface
- Parameters:
b
- Set to true if reserved words' case should be preserved
-
isDefaultingToUppercase
public boolean isDefaultingToUppercase()- Specified by:
isDefaultingToUppercase
in interfaceDatabaseInterface
- Returns:
- true if the database defaults to naming tables and fields in uppercase. True for most databases except for stuborn stuff like Postgres ;-)
-
getExtraOptions
- Specified by:
getExtraOptions
in interfaceDatabaseInterface
- Returns:
- all the extra options that are set to be used for the database URL
-
addExtraOption
Add an extra option to the attributes list- Specified by:
addExtraOption
in interfaceDatabaseInterface
- Parameters:
databaseTypeCode
- The database type code for which the option appliesoption
- The option to setvalue
- The value of the option
-
getExtraOptionSeparator
- Specified by:
getExtraOptionSeparator
in interfaceDatabaseInterface
- Returns:
- The extra option separator in database URL for this platform (usually this is semicolon ; )
-
getExtraOptionValueSeparator
- Specified by:
getExtraOptionValueSeparator
in interfaceDatabaseInterface
- Returns:
- The extra option value separator in database URL for this platform (usually this is the equal sign = )
-
getExtraOptionIndicator
- Specified by:
getExtraOptionIndicator
in interfaceDatabaseInterface
- Returns:
- This indicator separates the normal URL from the options
-
supportsOptionsInURL
public boolean supportsOptionsInURL()- Specified by:
supportsOptionsInURL
in interfaceDatabaseInterface
- Returns:
- true if the database supports connection options in the URL, false if they are put in a Properties object.
-
getExtraOptionsHelpText
- Specified by:
getExtraOptionsHelpText
in interfaceDatabaseInterface
- Returns:
- extra help text on the supported options on the selected database platform.
-
supportsGetBlob
public boolean supportsGetBlob()- Specified by:
supportsGetBlob
in interfaceDatabaseInterface
- Returns:
- true if the database JDBC driver supports getBlob on the resultset. If not we must use getBytes() to get the data.
-
getConnectSQL
- Specified by:
getConnectSQL
in interfaceDatabaseInterface
- Returns:
- The SQL to execute right after connecting
-
setConnectSQL
- Specified by:
setConnectSQL
in interfaceDatabaseInterface
- Parameters:
sql
- The SQL to execute right after connecting
-
supportsSetMaxRows
public boolean supportsSetMaxRows()- Specified by:
supportsSetMaxRows
in interfaceDatabaseInterface
- Returns:
- true if the database supports setting the maximum number of return rows in a resultset.
-
isUsingConnectionPool
public boolean isUsingConnectionPool()- Specified by:
isUsingConnectionPool
in interfaceDatabaseInterface
- Returns:
- true if we want to use a database connection pool
-
setUsingConnectionPool
public void setUsingConnectionPool(boolean usePool) - Specified by:
setUsingConnectionPool
in interfaceDatabaseInterface
- Parameters:
usePool
- true if we want to use a database connection pool
-
getMaximumPoolSize
public int getMaximumPoolSize()- Specified by:
getMaximumPoolSize
in interfaceDatabaseInterface
- Returns:
- the maximum pool size
-
getMaximumPoolSizeString
- Specified by:
getMaximumPoolSizeString
in interfaceDatabaseInterface
- Returns:
- the maximum pool size variable name
-
setMaximumPoolSize
public void setMaximumPoolSize(int maximumPoolSize) - Specified by:
setMaximumPoolSize
in interfaceDatabaseInterface
- Parameters:
maximumPoolSize
- the maximum pool size
-
setMaximumPoolSizeString
- Specified by:
setMaximumPoolSizeString
in interfaceDatabaseInterface
- Parameters:
maximumPoolSize
- the maximum pool size variable name
-
getInitialPoolSize
public int getInitialPoolSize()- Specified by:
getInitialPoolSize
in interfaceDatabaseInterface
- Returns:
- the initial pool size
-
getInitialPoolSizeString
- Specified by:
getInitialPoolSizeString
in interfaceDatabaseInterface
- Returns:
- the initial pool size variable name
-
setInitialPoolSize
public void setInitialPoolSize(int initialPoolSize) - Specified by:
setInitialPoolSize
in interfaceDatabaseInterface
- Parameters:
initialPoolSize
- the initial pool size
-
setInitialPoolSizeString
- Specified by:
setInitialPoolSizeString
in interfaceDatabaseInterface
- Parameters:
initialPoolSize
- the initial pool size variable name
-
isPartitioned
public boolean isPartitioned()- Specified by:
isPartitioned
in interfaceDatabaseInterface
- Returns:
- true if we want to use a database connection pool
-
setPartitioned
public void setPartitioned(boolean clustered) - Specified by:
setPartitioned
in interfaceDatabaseInterface
- Parameters:
clustered
- true if we want to use a database connection pool
-
getPartitioningInformation
- Specified by:
getPartitioningInformation
in interfaceDatabaseInterface
- Returns:
- the available partition/host/databases/port combinations in the cluster
-
setPartitioningInformation
- Specified by:
setPartitioningInformation
in interfaceDatabaseInterface
- Parameters:
clusterInfo
- the available partition/host/databases/port combinations in the cluster
-
getConnectionPoolingProperties
- Specified by:
getConnectionPoolingProperties
in interfaceDatabaseInterface
- Returns:
- The set of properties (newly created object) that contains the connection pooling parameters All environment variables will be replaced here.
-
setConnectionPoolingProperties
Description copied from interface:DatabaseInterface
set the connection pooling properties- Specified by:
setConnectionPoolingProperties
in interfaceDatabaseInterface
-
getSQLTableExists
- Specified by:
getSQLTableExists
in interfaceDatabaseInterface
- Parameters:
tablename
- The table to verify the existance for- Returns:
- The SQL to execute to verify if the given table exists. If an Exception is thrown for this SQL, we don't have the table.
-
getSQLColumnExists
- Specified by:
getSQLColumnExists
in interfaceDatabaseInterface
- Parameters:
columnname
- The column to verify the existance fortablename
- The table to verify the existance for- Returns:
- The SQL to execute to verify if the given table exists. If an Exception is thrown for this SQL, we don't have the column.
-
needsToLockAllTables
public boolean needsToLockAllTables()- Specified by:
needsToLockAllTables
in interfaceDatabaseInterface
- Returns:
- true if the database needs all repository tables to be locked, not just one ref table (R_REPOSITORY_LOG)
-
isStreamingResults
public boolean isStreamingResults()- Specified by:
isStreamingResults
in interfaceDatabaseInterface
- Returns:
- true if the database is streaming results (normally this is an option just for MySQL).
-
setStreamingResults
public void setStreamingResults(boolean useStreaming) - Specified by:
setStreamingResults
in interfaceDatabaseInterface
- Parameters:
useStreaming
- true if we want the database to stream results (normally this is an option just for MySQL).
-
isQuoteAllFields
public boolean isQuoteAllFields()- Specified by:
isQuoteAllFields
in interfaceDatabaseInterface
- Returns:
- true if all fields should always be quoted in db
-
setQuoteAllFields
public void setQuoteAllFields(boolean quoteAllFields) - Specified by:
setQuoteAllFields
in interfaceDatabaseInterface
- Parameters:
quoteAllFields
- true if we want the database to stream results (normally this is an option just for MySQL).
-
isForcingIdentifiersToLowerCase
public boolean isForcingIdentifiersToLowerCase()- Specified by:
isForcingIdentifiersToLowerCase
in interfaceDatabaseInterface
- Returns:
- true if all identifiers should be forced to lower case
-
setForcingIdentifiersToLowerCase
public void setForcingIdentifiersToLowerCase(boolean forceLowerCase) - Specified by:
setForcingIdentifiersToLowerCase
in interfaceDatabaseInterface
- Parameters:
forceLowerCase
- true if all identifiers should be forced to lower case
-
isForcingIdentifiersToUpperCase
public boolean isForcingIdentifiersToUpperCase()- Specified by:
isForcingIdentifiersToUpperCase
in interfaceDatabaseInterface
- Returns:
- true if all identifiers should be forced to upper case
-
setForcingIdentifiersToUpperCase
public void setForcingIdentifiersToUpperCase(boolean forceUpperCase) - Specified by:
setForcingIdentifiersToUpperCase
in interfaceDatabaseInterface
- Parameters:
forceUpperCase
- true if all identifiers should be forced to upper case
-
isUsingDoubleDecimalAsSchemaTableSeparator
public boolean isUsingDoubleDecimalAsSchemaTableSeparator()- Specified by:
isUsingDoubleDecimalAsSchemaTableSeparator
in interfaceDatabaseInterface
- Returns:
- true if we use a double decimal separator to specify schema/table combinations on MS-SQL server
-
setUsingDoubleDecimalAsSchemaTableSeparator
public void setUsingDoubleDecimalAsSchemaTableSeparator(boolean useDoubleDecimalSeparator) - Specified by:
setUsingDoubleDecimalAsSchemaTableSeparator
in interfaceDatabaseInterface
- Parameters:
useDoubleDecimalSeparator
- true if we should use a double decimal separator to specify schema/table combinations on MS-SQL server
-
isRequiringTransactionsOnQueries
public boolean isRequiringTransactionsOnQueries()- Specified by:
isRequiringTransactionsOnQueries
in interfaceDatabaseInterface
- Returns:
- true if this database needs a transaction to perform a query (auto-commit turned off).
-
getDatabaseFactoryName
You can use this method to supply an alternate factory for the test method in the dialogs. This is useful for plugins like SAP/R3 and PALO.- Specified by:
getDatabaseFactoryName
in interfaceDatabaseInterface
- Returns:
- the name of the database test factory to use.
-
getPreferredSchemaName
- Specified by:
getPreferredSchemaName
in interfaceDatabaseInterface
- Returns:
- The preferred schema name of this database connection.
-
setPreferredSchemaName
- Specified by:
setPreferredSchemaName
in interfaceDatabaseInterface
- Parameters:
preferredSchemaName
- The preferred schema name of this database connection.
-
checkIndexExists
public boolean checkIndexExists(Database database, String schemaName, String tableName, String[] idxFields) throws KettleDatabaseException Verifies on the specified database connection if an index exists on the fields with the specified name.- Specified by:
checkIndexExists
in interfaceDatabaseInterface
- Parameters:
database
- a connected databaseschemaName
-tableName
-idxFields
-- Returns:
- true if the index exists, false if it doesn't.
- Throws:
KettleDatabaseException
-
supportsSequenceNoMaxValueOption
public boolean supportsSequenceNoMaxValueOption()- Specified by:
supportsSequenceNoMaxValueOption
in interfaceDatabaseInterface
- Returns:
- true if the database supports the NOMAXVALUE sequence option. The default is false, AS/400 and DB2 support this.
-
requiresCreateTablePrimaryKeyAppend
public boolean requiresCreateTablePrimaryKeyAppend()- Specified by:
requiresCreateTablePrimaryKeyAppend
in interfaceDatabaseInterface
- Returns:
- true if we need to append the PRIMARY KEY block in the create table block after the fields, required for Cache.
-
requiresCastToVariousForIsNull
public boolean requiresCastToVariousForIsNull()- Specified by:
requiresCastToVariousForIsNull
in interfaceDatabaseInterface
- Returns:
- true if the database requires you to cast a parameter to varchar before comparing to null. Only required for DB2 and Vertica
-
isDisplaySizeTwiceThePrecision
public boolean isDisplaySizeTwiceThePrecision()- Specified by:
isDisplaySizeTwiceThePrecision
in interfaceDatabaseInterface
- Returns:
- Handles the special case of DB2 where the display size returned is twice the precision. In that case, the length is the precision.
-
supportsPreparedStatementMetadataRetrieval
public boolean supportsPreparedStatementMetadataRetrieval()Most databases allow you to retrieve result metadata by preparing a SELECT statement.- Specified by:
supportsPreparedStatementMetadataRetrieval
in interfaceDatabaseInterface
- Returns:
- true if the database supports retrieval of query metadata from a prepared statement. False if the query needs to be executed first.
-
supportsResultSetMetadataRetrievalOnly
public boolean supportsResultSetMetadataRetrievalOnly()- Specified by:
supportsResultSetMetadataRetrievalOnly
in interfaceDatabaseInterface
- Returns:
- true if this database only supports metadata retrieval on a result set, never on a statement (even if the statement has been executed)
-
isSystemTable
- Specified by:
isSystemTable
in interfaceDatabaseInterface
- Parameters:
tableName
-- Returns:
- true if the specified table is a system table
-
supportsNewLinesInSQL
public boolean supportsNewLinesInSQL()- Specified by:
supportsNewLinesInSQL
in interfaceDatabaseInterface
- Returns:
- true if the database supports newlines in a SQL statements.
-
getSQLListOfSchemas
- Specified by:
getSQLListOfSchemas
in interfaceDatabaseInterface
- Returns:
- the SQL to retrieve the list of schemas or null if the JDBC metadata needs to be used.
-
getMaxColumnsInIndex
public int getMaxColumnsInIndex()- Specified by:
getMaxColumnsInIndex
in interfaceDatabaseInterface
- Returns:
- The maximum number of columns in a database, <=0 means: no known limit
-
supportsErrorHandlingOnBatchUpdates
public boolean supportsErrorHandlingOnBatchUpdates()- Specified by:
supportsErrorHandlingOnBatchUpdates
in interfaceDatabaseInterface
- Returns:
- true if the database supports error handling (recovery of failure) while doing batch updates.
-
getSQLInsertAutoIncUnknownDimensionRow
public String getSQLInsertAutoIncUnknownDimensionRow(String schemaTable, String keyField, String versionField) Get the SQL to insert a new empty unknown record in a dimension.- Specified by:
getSQLInsertAutoIncUnknownDimensionRow
in interfaceDatabaseInterface
- Parameters:
schemaTable
- the schema-table name to insert intokeyField
- The key fieldversionField
- the version field- Returns:
- the SQL to insert the unknown record into the SCD.
-
isExplorable
public boolean isExplorable()- Specified by:
isExplorable
in interfaceDatabaseInterface
- Returns:
- true if this is a relational database you can explore. Return false for SAP, PALO, etc.
-
getXulOverlayFile
- Specified by:
getXulOverlayFile
in interfaceDatabaseInterface
- Returns:
- The name of the XUL overlay file to display extra options. This is only used in case of a non-standard plugin. Usually this method returns null.
-
quoteSQLString
Description copied from interface:DatabaseInterface
Adds quotes around the string according to the database dialect and also escapes special characters like CR, LF and the quote character itself.- Specified by:
quoteSQLString
in interfaceDatabaseInterface
- Parameters:
string
-- Returns:
- A string that is properly quoted for use in a SQL statement (insert, update, delete, etc)
-
getSelectCountStatement
Build the SQL to count the number of rows in the passed table.- Specified by:
getSelectCountStatement
in interfaceDatabaseInterface
- Parameters:
tableName
-- Returns:
-
generateColumnAlias
Description copied from interface:DatabaseInterface
Generate a column alias given the column index and suggested name.- Specified by:
generateColumnAlias
in interfaceDatabaseInterface
- Parameters:
columnIndex
- Index of column in querysuggestedName
- Suggested column name- Returns:
- Column alias that is valid for this database
-
parseStatements
Parse all possible statements from the provided SQL script.- Specified by:
parseStatements
in interfaceDatabaseInterface
- Parameters:
sqlScript
- Raw SQL Script to be parsed into executable statements.- Returns:
- List of parsed SQL statements to be executed separately.
-
getSqlScriptStatements
Parse the statements in the provided SQL script, provide more information about where each was found in the script.- Specified by:
getSqlScriptStatements
in interfaceDatabaseInterface
- Parameters:
sqlScript
- Raw SQL Script to be parsed into executable statements.- Returns:
- List of SQL script statements to be executed separately.
-
onlySpaces
- Parameters:
str
-- Returns:
- True if
str
contains only spaces.
-
isMySQLVariant
public boolean isMySQLVariant()- Specified by:
isMySQLVariant
in interfaceDatabaseInterface
- Returns:
- true if the database is a MySQL variant, like MySQL 5.1, InfiniDB, InfoBright, and so on.
-
canTest
public boolean canTest()- Returns:
- true if the database type can be tested against a database instance
-
requiresName
public boolean requiresName()- Returns:
- true if the database name is a required parameter
-
releaseSavepoint
public boolean releaseSavepoint()Returns a true of savepoints can be released, false if not.- Specified by:
releaseSavepoint
in interfaceDatabaseInterface
- Returns:
-
getNextBatchIdUsingSequence
public Long getNextBatchIdUsingSequence(String sequenceName, String schemaName, DatabaseMeta dbm, Database ldb) throws KettleDatabaseException - Throws:
KettleDatabaseException
-
getNextBatchIdUsingAutoIncSQL
public Long getNextBatchIdUsingAutoIncSQL(String autoIncSQL, DatabaseMeta dbm, Database ldb) throws KettleDatabaseException - Throws:
KettleDatabaseException
-
getNextBatchIdUsingLockTables
public Long getNextBatchIdUsingLockTables(DatabaseMeta dbm, Database ldb, String schemaName, String tableName, String fieldName) throws KettleDatabaseException - Throws:
KettleDatabaseException
-
getNextBatchId
public Long getNextBatchId(DatabaseMeta dbm, Database ldb, String schemaName, String tableName, String fieldName) throws KettleDatabaseException Description copied from interface:DatabaseInterface
Get the next Batch ID from the logging tables.- Specified by:
getNextBatchId
in interfaceDatabaseInterface
- Parameters:
dbm
- DatabaseMeta objectldb
- Database connectionschemaName
- Logging Schema NametableName
- Logging Table NamefieldName
- Batch Id Field name- Returns:
- next batch ID
- Throws:
KettleDatabaseException
-
getDataTablespaceDDL
Returns the tablespace DDL fragment for a "Data" tablespace. In most databases that use tablespaces this is where the tables are to be created.- Specified by:
getDataTablespaceDDL
in interfaceDatabaseInterface
- Parameters:
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.- Returns:
- String the tablespace name for tables in the format "tablespace TABLESPACE_NAME". The TABLESPACE_NAME and the passed DatabaseMata determines if TABLESPACE_NAME is to be enclosed in quotes.
-
getIndexTablespaceDDL
Returns the tablespace DDL fragment for a "Index" tablespace.- Specified by:
getIndexTablespaceDDL
in interfaceDatabaseInterface
- Parameters:
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.- Returns:
- String the tablespace name for indices in the format "tablespace TABLESPACE_NAME". The TABLESPACE_NAME and the passed DatabaseMata determines if TABLESPACE_NAME is to be enclosed in quotes.
-
getTablespaceDDL
public String getTablespaceDDL(VariableSpace variables, DatabaseMeta databaseMeta, String tablespaceName) Returns an empty string as most databases do not support tablespaces. Subclasses can override this method to generate the DDL.- Parameters:
variables
- variables needed for variable substitution.databaseMeta
- databaseMeta needed for it's quoteField method. Since we are doing variable substitution we need to meta so that we can act on the variable substitution first and then the creation of the entire string that will be retuned.tablespaceName
- tablespaceName name of the tablespace.- Returns:
- String an empty String as most databases do not use tablespaces.
-
getValueFromResultSet
public Object getValueFromResultSet(ResultSet rs, ValueMetaInterface val, int i) throws KettleDatabaseException This method allows a database dialect to convert database specific data types to Kettle data types.- Specified by:
getValueFromResultSet
in interfaceDatabaseInterface
- Parameters:
rs
- The result set to useval
- The description of the value to retrievei
- the index on which we need to retrieve the value, 0-based.- Returns:
- The correctly converted Kettle data type corresponding to the valueMeta description.
- Throws:
KettleDatabaseException
-
useSafePoints
public boolean useSafePoints()- Specified by:
useSafePoints
in interfaceDatabaseInterface
- Returns:
- true if the database supports the use of safe-points and if it is appropriate to ever use it (default to false)
-
supportsErrorHandling
public boolean supportsErrorHandling()- Specified by:
supportsErrorHandling
in interfaceDatabaseInterface
- Returns:
- true if the database supports error handling (the default). Returns false for certain databases (SQLite) that invalidate a prepared statement or even the complete connection when an error occurs.
-
getSQLValue
public String getSQLValue(ValueMetaInterface valueMeta, Object valueData, String dateFormat) throws KettleValueException Description copied from interface:DatabaseInterface
Convert a value in the SQL equivalent. For example, convert String "Pentaho" into 'Pentaho' or into Oracle date format TO_DATE('2012/08/16 15:36:59', 'YYYY/MM/DD HH24:MI:SS')- Specified by:
getSQLValue
in interfaceDatabaseInterface
- Parameters:
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.- Returns:
- The value SQL clause
- Throws:
KettleValueException
- in case there is a data conversion error.
-
getFieldnameProtector
-
getSafeFieldname
Sanitize a string for usage as a field name- Append an underscore to any field name that matches a reserved word
- Replaces spaces with underscores
- Prefixes a string with underscore that begins with a number
- Specified by:
getSafeFieldname
in interfaceDatabaseInterface
- Parameters:
fieldName
- value to sanitize- Returns:
-
getSequenceNoMaxValueOption
- Specified by:
getSequenceNoMaxValueOption
in interfaceDatabaseInterface
- Returns:
- string with the no max value sequence option.
-
supportsAutoGeneratedKeys
public boolean supportsAutoGeneratedKeys()- Specified by:
supportsAutoGeneratedKeys
in interfaceDatabaseInterface
- Returns:
- true if the database supports autoGeneratedKeys
-
customizeValueFromSQLType
public ValueMetaInterface customizeValueFromSQLType(ValueMetaInterface v, ResultSetMetaData rm, int index) throws SQLException Customizes the ValueMetaInterface defined in the base- Specified by:
customizeValueFromSQLType
in interfaceDatabaseInterface
- Parameters:
v
- the determined valueMetaInterfacerm
- the sql resultindex
- the index to the column- Returns:
- ValueMetaInterface customized with the data base specific types
- Throws:
SQLException
-
getCreateTableStatement
Customizes the ValueMetaInterface defined in the base- Specified by:
getCreateTableStatement
in interfaceDatabaseInterface
- Returns:
- String the create table statement
-
getDropTableIfExistsStatement
Forms drop table statement. This standard construct syntax is not legal for certain RDBMSs, and should be overridden according to their specifics.- Specified by:
getDropTableIfExistsStatement
in interfaceDatabaseInterfaceExtended
- Parameters:
tableName
- Name of the table to drop- Returns:
- Standard drop table statement
-
fullExceptionLog
Description copied from interface:DatabaseInterfaceExtended
Returns false if exception doesn't require full exception log. Could be used in cases of DB vendor specific error which doesn't require stack trace log.- Specified by:
fullExceptionLog
in interfaceDatabaseInterfaceExtended
- Parameters:
e
- exception to check- Returns:
- decision result
-
addDefaultOptions
public void addDefaultOptions()Description copied from interface:DatabaseInterface
Set default options for this database- Specified by:
addDefaultOptions
in interfaceDatabaseInterface
-
addAttribute
Description copied from interface:DatabaseInterface
Add extra attribute on this connection- Specified by:
addAttribute
in interfaceDatabaseInterface
- Parameters:
attributeId
- the attribute identifiervalue
- the value of the attribute
-
getAttribute
Description copied from interface:DatabaseInterface
Gets an attribute from the connection- Specified by:
getAttribute
in interfaceDatabaseInterface
- Parameters:
attributeId
- the attribute identifierdefaultValue
- the default value in case the attribute is not found- Returns:
- the attribute value
-
setNamedCluster
Description copied from interface:DatabaseInterface
Set the hadoop cluster associated with the connection- Specified by:
setNamedCluster
in interfaceDatabaseInterface
- Parameters:
namedCluster
- The hadoop cluster name
-
getNamedCluster
- Specified by:
getNamedCluster
in interfaceDatabaseInterface
- Returns:
- The hadoop cluster associated with the connection
-