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
,CacheDatabaseMeta
,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
Fields Modifier and Type Field Description static String
ATTRIBUTE_CLUSTER_DBNAME_PREFIX
The clustering database name prefixstatic String
ATTRIBUTE_CLUSTER_HOSTNAME_PREFIX
The clustering hostname prefixstatic String
ATTRIBUTE_CLUSTER_PASSWORD_PREFIX
The clustering database password prefixstatic String
ATTRIBUTE_CLUSTER_PORT_PREFIX
The clustering port prefixstatic String
ATTRIBUTE_CLUSTER_USERNAME_PREFIX
The clustering database username prefixstatic String
ATTRIBUTE_FORCE_IDENTIFIERS_TO_LOWERCASE
A flag to determine if we should force all identifiers to lower casestatic String
ATTRIBUTE_FORCE_IDENTIFIERS_TO_UPPERCASE
A flag to determine if we should force all identifiers to UPPER CASEstatic String
ATTRIBUTE_INITIAL_POOL_SIZE
If we use connection pooling, this would contain the initial pool sizestatic String
ATTRIBUTE_IS_CLUSTERED
A flag to determine if the connection is clustered or not.static String
ATTRIBUTE_MAXIMUM_POOL_SIZE
If we use connection pooling, this would contain the maximum pool sizestatic String
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 serverstatic String
ATTRIBUTE_POOLING_PARAMETER_PREFIX
The pooling parametersstatic String
ATTRIBUTE_PORT_NUMBER
The port number of the database as string: allows for parameterization.static String
ATTRIBUTE_PREFERRED_SCHEMA_NAME
The preferred schema to use if no other has been specified.static String
ATTRIBUTE_PREFIX_EXTRA_OPTION
The prefix for all the extra options attributesstatic String
ATTRIBUTE_PRESERVE_RESERVED_WORD_CASE
Checkbox to allow you to configure if the reserved words will have their case changed during the handleCase callstatic String
ATTRIBUTE_QUOTE_ALL_FIELDS
A flag to determine if we should quote all fieldsstatic String
ATTRIBUTE_SQL_CONNECT
The SQL to execute at connect time (right after connecting)static String
ATTRIBUTE_SUPPORTS_BOOLEAN_DATA_TYPE
Checkbox to allow you to configure if the database supports the boolean data type or not.static String
ATTRIBUTE_SUPPORTS_TIMESTAMP_DATA_TYPE
Checkbox to allow you to configure if the database supports the Timestamp data type or not.static String
ATTRIBUTE_USE_POOLING
A flag to determine if we should use connection pooling or not.static String
ATTRIBUTE_USE_RESULT_STREAMING
A flag to determine if we should use result streaming on MySQLstatic String
AUTOINCREMENT_SQL_FOR_BATCH_ID
static String
NAMED_CLUSTER_ID
static DatabaseConnectionPoolParameter[]
poolingParameters
protected boolean
releaseSavepoint
Boolean to indicate if savepoints can be released Most databases do, so we set it to true.static String
SELECT_COUNT_STATEMENT
The SQL, minus the table name, to select the number of rows from a tablestatic String
SEQUENCE_FOR_BATCH_ID
-
Constructor Summary
Constructors Constructor Description BaseDatabaseMeta()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addAttribute(String attributeId, String value)
Add extra attribute on this connectionvoid
addDefaultOptions()
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.Object
clone()
Clone the basic settings for this connection!ValueMetaInterface
customizeValueFromSQLType(ValueMetaInterface v, ResultSetMetaData rm, int index)
Customizes the ValueMetaInterface defined in the baseboolean
fullExceptionLog(Exception e)
Returns false if exception doesn't require full exception log.String
generateColumnAlias(int columnIndex, String suggestedName)
Generate a column alias given the column index and suggested name.int
getAccessType()
abstract int[]
getAccessTypeList()
Get the list of possible access types for a database.String
getAttribute(String attributeId, String defaultValue)
Gets an attribute from the connectionProperties
getAttributes()
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.String
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.Properties
getConnectionPoolingProperties()
String
getConnectSQL()
String
getCreateTableStatement()
Customizes the ValueMetaInterface defined in the baseString
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()
Map<String,String>
getDefaultOptions()
String
getDisplayName()
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 tableString
getDropTableIfExistsStatement(String tableName)
Forms drop table statement.String
getEndQuote()
String
getExtraOptionIndicator()
Map<String,String>
getExtraOptions()
String
getExtraOptionSeparator()
String
getExtraOptionsHelpText()
String
getExtraOptionValueSeparator()
protected String
getFieldnameProtector()
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
getInitialPoolSizeString()
String
getLimitClause(int nrRows)
int
getMaxColumnsInIndex()
int
getMaximumPoolSize()
String
getMaximumPoolSizeString()
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
getName()
String
getNamedCluster()
Long
getNextBatchId(DatabaseMeta dbm, Database ldb, String schemaName, String tableName, String fieldName)
Get the next Batch ID from the logging tables.Long
getNextBatchIdUsingAutoIncSQL(String autoIncSQL, DatabaseMeta dbm, Database ldb)
Long
getNextBatchIdUsingLockTables(DatabaseMeta dbm, Database ldb, String schemaName, String tableName, String fieldName)
Long
getNextBatchIdUsingSequence(String sequenceName, String schemaName, DatabaseMeta dbm, Database ldb)
int
getNotFoundTK(boolean useAutoinc)
Get the not found technical key.ObjectId
getObjectId()
PartitionDatabaseMeta[]
getPartitioningInformation()
String
getPassword()
String
getPluginId()
String
getPluginName()
String
getPreferredSchemaName()
String[]
getReservedWords()
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 numberString
getSchemaTableCombination(String schemaName, String tablePart)
Get the schema-table combination to query the right table.String
getSelectCountStatement(String tableName)
Build the SQL to count the number of rows in the passed table.String
getSequenceNoMaxValueOption()
String
getServername()
String
getSQLColumnExists(String columnname, String tablename)
String
getSQLCurrentSequenceValue(String sequenceName)
Get the current value of a database sequenceString
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 tableList<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
getTablespaceDDL(VariableSpace variables, DatabaseMeta databaseMeta, String tablespaceName)
Returns an empty string as most databases do not support tablespaces.String[]
getTableTypes()
String
getTruncateTableStatement(String tableName)
String
getUsername()
Object
getValueFromResultSet(ResultSet rs, ValueMetaInterface val, int i)
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()
protected boolean
onlySpaces(String str)
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 released, false if not.boolean
requiresCastToVariousForIsNull()
boolean
requiresCreateTablePrimaryKeyAppend()
boolean
requiresName()
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
setName(String name)
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
supportsAutoGeneratedKeys()
boolean
supportsAutoInc()
boolean
supportsBatchUpdates()
boolean
supportsBitmapIndex()
boolean
supportsBooleanDataType()
boolean
supportsCatalogs()
boolean
supportsEmptyTransactions()
boolean
supportsErrorHandling()
boolean
supportsErrorHandlingOnBatchUpdates()
boolean
supportsFloatRoundingOnUpdate()
Most databases round number(7,2) 17.29999999 to 17.30, but some don't.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()
-
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 Detail
-
ATTRIBUTE_PORT_NUMBER
public static final String ATTRIBUTE_PORT_NUMBER
The port number of the database as string: allows for parameterization.- See Also:
- Constant Field Values
-
ATTRIBUTE_SQL_CONNECT
public static final String ATTRIBUTE_SQL_CONNECT
The SQL to execute at connect time (right after connecting)- See Also:
- Constant Field Values
-
ATTRIBUTE_USE_POOLING
public static final String ATTRIBUTE_USE_POOLING
A flag to determine if we should use connection pooling or not.- See Also:
- Constant Field Values
-
ATTRIBUTE_MAXIMUM_POOL_SIZE
public static final String ATTRIBUTE_MAXIMUM_POOL_SIZE
If we use connection pooling, this would contain the maximum pool size- See Also:
- Constant Field Values
-
ATTRIBUTE_INITIAL_POOL_SIZE
public static final String ATTRIBUTE_INITIAL_POOL_SIZE
If we use connection pooling, this would contain the initial pool size- See Also:
- Constant Field Values
-
ATTRIBUTE_PREFIX_EXTRA_OPTION
public static final String ATTRIBUTE_PREFIX_EXTRA_OPTION
The prefix for all the extra options attributes- See Also:
- Constant Field Values
-
ATTRIBUTE_IS_CLUSTERED
public static final String ATTRIBUTE_IS_CLUSTERED
A flag to determine if the connection is clustered or not.- See Also:
- Constant Field Values
-
ATTRIBUTE_CLUSTER_HOSTNAME_PREFIX
public static final String ATTRIBUTE_CLUSTER_HOSTNAME_PREFIX
The clustering hostname prefix- See Also:
- Constant Field Values
-
ATTRIBUTE_CLUSTER_PORT_PREFIX
public static final String ATTRIBUTE_CLUSTER_PORT_PREFIX
The clustering port prefix- See Also:
- Constant Field Values
-
ATTRIBUTE_CLUSTER_DBNAME_PREFIX
public static final String ATTRIBUTE_CLUSTER_DBNAME_PREFIX
The clustering database name prefix- See Also:
- Constant Field Values
-
ATTRIBUTE_CLUSTER_USERNAME_PREFIX
public static final String ATTRIBUTE_CLUSTER_USERNAME_PREFIX
The clustering database username prefix- See Also:
- Constant Field Values
-
ATTRIBUTE_CLUSTER_PASSWORD_PREFIX
public static final String ATTRIBUTE_CLUSTER_PASSWORD_PREFIX
The clustering database password prefix- See Also:
- Constant Field Values
-
ATTRIBUTE_POOLING_PARAMETER_PREFIX
public static final String ATTRIBUTE_POOLING_PARAMETER_PREFIX
The pooling parameters- See Also:
- Constant Field Values
-
ATTRIBUTE_USE_RESULT_STREAMING
public static final String ATTRIBUTE_USE_RESULT_STREAMING
A flag to determine if we should use result streaming on MySQL- See Also:
- Constant Field Values
-
ATTRIBUTE_MSSQL_DOUBLE_DECIMAL_SEPARATOR
public static final String 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:
- Constant Field Values
-
ATTRIBUTE_QUOTE_ALL_FIELDS
public static final String ATTRIBUTE_QUOTE_ALL_FIELDS
A flag to determine if we should quote all fields- See Also:
- Constant Field Values
-
ATTRIBUTE_FORCE_IDENTIFIERS_TO_LOWERCASE
public static final String ATTRIBUTE_FORCE_IDENTIFIERS_TO_LOWERCASE
A flag to determine if we should force all identifiers to lower case- See Also:
- Constant Field Values
-
ATTRIBUTE_FORCE_IDENTIFIERS_TO_UPPERCASE
public static final String ATTRIBUTE_FORCE_IDENTIFIERS_TO_UPPERCASE
A flag to determine if we should force all identifiers to UPPER CASE- See Also:
- Constant Field Values
-
ATTRIBUTE_PREFERRED_SCHEMA_NAME
public static final String ATTRIBUTE_PREFERRED_SCHEMA_NAME
The preferred schema to use if no other has been specified.- See Also:
- Constant Field Values
-
ATTRIBUTE_SUPPORTS_BOOLEAN_DATA_TYPE
public static final String 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:
- Constant Field Values
-
ATTRIBUTE_SUPPORTS_TIMESTAMP_DATA_TYPE
public static final String 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:
- Constant Field Values
-
ATTRIBUTE_PRESERVE_RESERVED_WORD_CASE
public static final String 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:
- Constant Field Values
-
SEQUENCE_FOR_BATCH_ID
public static final String SEQUENCE_FOR_BATCH_ID
- See Also:
- Constant Field Values
-
AUTOINCREMENT_SQL_FOR_BATCH_ID
public static final String AUTOINCREMENT_SQL_FOR_BATCH_ID
- See Also:
- Constant Field Values
-
NAMED_CLUSTER_ID
public static final String NAMED_CLUSTER_ID
- See Also:
- Constant Field Values
-
releaseSavepoint
protected boolean releaseSavepoint
Boolean 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
public static final String SELECT_COUNT_STATEMENT
The SQL, minus the table name, to select the number of rows from a table- See Also:
- Constant Field Values
-
poolingParameters
public static final DatabaseConnectionPoolParameter[] poolingParameters
-
-
Method Detail
-
getPluginId
public String getPluginId()
- Specified by:
getPluginId
in interfaceDatabaseInterface
- Returns:
- plugin ID of this class
-
setPluginId
public void setPluginId(String pluginId)
- Specified by:
setPluginId
in interfaceDatabaseInterface
- Parameters:
pluginId
- The plugin ID to set.
-
getPluginName
public String getPluginName()
- Specified by:
getPluginName
in interfaceDatabaseInterface
- Returns:
- plugin name of this class
-
setPluginName
public void setPluginName(String pluginName)
- 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
public String getName()
- Specified by:
getName
in interfaceDatabaseInterface
- Returns:
- Returns the connection name.
-
setName
public void setName(String name)
- Specified by:
setName
in interfaceDatabaseInterface
- Parameters:
name
- The connection Name to set.
-
getDisplayName
public String getDisplayName()
- Specified by:
getDisplayName
in interfaceDatabaseInterface
- Returns:
- Returns the un-escaped connection Name.
-
setDisplayName
public void setDisplayName(String displayName)
- Specified by:
setDisplayName
in interfaceDatabaseInterface
- Parameters:
displayName
- The un-escaped connection Name to set.
-
getDatabaseName
public String getDatabaseName()
- Specified by:
getDatabaseName
in interfaceDatabaseInterface
- Returns:
- Returns the databaseName.
-
setDatabaseName
public void setDatabaseName(String databaseName)
- Specified by:
setDatabaseName
in interfaceDatabaseInterface
- Parameters:
databaseName
- The databaseName to set.
-
setDatabasePortNumberString
public void setDatabasePortNumberString(String databasePortNumberString)
- Specified by:
setDatabasePortNumberString
in interfaceDatabaseInterface
- Parameters:
databasePortNumberString
- The databasePortNumber string to set.
-
getDatabasePortNumberString
public String getDatabasePortNumberString()
- Specified by:
getDatabasePortNumberString
in interfaceDatabaseInterface
- Returns:
- Returns the databasePortNumber string.
-
getHostname
public String getHostname()
- Specified by:
getHostname
in interfaceDatabaseInterface
- Returns:
- Returns the hostname.
-
setHostname
public void setHostname(String hostname)
- Specified by:
setHostname
in interfaceDatabaseInterface
- Parameters:
hostname
- The hostname to set.
-
getObjectId
public ObjectId getObjectId()
- Specified by:
getObjectId
in interfaceDatabaseInterface
- Returns:
- Returns the id.
-
setObjectId
public void setObjectId(ObjectId id)
- Specified by:
setObjectId
in interfaceDatabaseInterface
- Parameters:
id
- The id to set.
-
getPassword
public String getPassword()
- Specified by:
getPassword
in interfaceDatabaseInterface
- Returns:
- Returns the password.
-
setPassword
public void setPassword(String password)
- Specified by:
setPassword
in interfaceDatabaseInterface
- Parameters:
password
- The password to set.
-
getServername
public String getServername()
- Specified by:
getServername
in interfaceDatabaseInterface
- Returns:
- Returns the servername.
-
setServername
public void setServername(String servername)
- Specified by:
setServername
in interfaceDatabaseInterface
- Parameters:
servername
- The servername to set.
-
getDataTablespace
public String getDataTablespace()
- Specified by:
getDataTablespace
in interfaceDatabaseInterface
- Returns:
- Returns the tablespaceData.
-
setDataTablespace
public void setDataTablespace(String dataTablespace)
- Specified by:
setDataTablespace
in interfaceDatabaseInterface
- Parameters:
dataTablespace
- The data tablespace to set.
-
getIndexTablespace
public String getIndexTablespace()
- Specified by:
getIndexTablespace
in interfaceDatabaseInterface
- Returns:
- Returns the index tablespace.
-
setIndexTablespace
public void setIndexTablespace(String indexTablespace)
- Specified by:
setIndexTablespace
in interfaceDatabaseInterface
- Parameters:
indexTablespace
- The index tablespace to set.
-
getUsername
public String getUsername()
- Specified by:
getUsername
in interfaceDatabaseInterface
- Returns:
- Returns the username.
-
setUsername
public void setUsername(String username)
- Specified by:
setUsername
in interfaceDatabaseInterface
- Parameters:
username
- The username to set.
-
getAttributes
public Properties getAttributes()
- Specified by:
getAttributes
in interfaceDatabaseInterface
- Returns:
- The extra attributes for this database connection
-
setAttributes
public void setAttributes(Properties attributes)
Set extra attributes on this database connection- Specified by:
setAttributes
in interfaceDatabaseInterface
- Parameters:
attributes
- The extra attributes to set on this database connection.
-
clone
public Object 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
public Map<String,String> 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
public String getLimitClause(int nrRows)
- 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
public String getSQLNextSequenceValue(String sequenceName)
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
public String getSQLCurrentSequenceValue(String sequenceName)
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
public String getSQLSequenceExists(String sequenceName)
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
public String getFunctionSum()
- Specified by:
getFunctionSum
in interfaceDatabaseInterface
- Returns:
- the function for SUM agrregate
-
getFunctionAverage
public String getFunctionAverage()
- Specified by:
getFunctionAverage
in interfaceDatabaseInterface
- Returns:
- the function for Average agrregate
-
getFunctionMinimum
public String getFunctionMinimum()
- Specified by:
getFunctionMinimum
in interfaceDatabaseInterface
- Returns:
- the function for Minimum agrregate
-
getFunctionMaximum
public String getFunctionMaximum()
- Specified by:
getFunctionMaximum
in interfaceDatabaseInterface
- Returns:
- the function for Maximum agrregate
-
getFunctionCount
public String getFunctionCount()
- Specified by:
getFunctionCount
in interfaceDatabaseInterface
- Returns:
- the function for Count agrregate
-
getSchemaTableCombination
public String getSchemaTableCombination(String schemaName, String tablePart)
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 public String 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.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
public String[] 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
public String getStartQuote()
- Specified by:
getStartQuote
in interfaceDatabaseInterface
- Returns:
- The start quote sequence, mostly just double quote, but sometimes [, ...
-
getEndQuote
public String 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
public String[] getTableTypes()
- Specified by:
getTableTypes
in interfaceDatabaseInterface
- Returns:
- a list of table types to retrieve tables for the database
-
getViewTypes
public String[] getViewTypes()
- Specified by:
getViewTypes
in interfaceDatabaseInterface
- Returns:
- a list of table types to retrieve views for the database
-
getSynonymTypes
public String[] 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
public String getSQLListOfProcedures()
- Specified by:
getSQLListOfProcedures
in interfaceDatabaseInterface
- Returns:
- The SQL on this database to get a list of stored procedures.
-
getSQLListOfSequences
public String getSQLListOfSequences()
- Specified by:
getSQLListOfSequences
in interfaceDatabaseInterface
- Returns:
- The SQL on this database to get a list of sequences.
-
getTruncateTableStatement
public String getTruncateTableStatement(String tableName)
- 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
public String getSQLQueryFields(String tableName)
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
public String getSQLLockTables(String[] tableNames)
- 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
public String getSQLUnlockTables(String[] tableNames)
- 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
public Map<String,String> getExtraOptions()
- Specified by:
getExtraOptions
in interfaceDatabaseInterface
- Returns:
- all the extra options that are set to be used for the database URL
-
addExtraOption
public void addExtraOption(String databaseTypeCode, String option, String value)
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
public String getExtraOptionSeparator()
- Specified by:
getExtraOptionSeparator
in interfaceDatabaseInterface
- Returns:
- The extra option separator in database URL for this platform (usually this is semicolon ; )
-
getExtraOptionValueSeparator
public String 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
public String 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
public String 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
public String getConnectSQL()
- Specified by:
getConnectSQL
in interfaceDatabaseInterface
- Returns:
- The SQL to execute right after connecting
-
setConnectSQL
public void setConnectSQL(String sql)
- 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
public String 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
public void setMaximumPoolSizeString(String maximumPoolSize)
- 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
public String 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
public void setInitialPoolSizeString(String initialPoolSize)
- 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
public PartitionDatabaseMeta[] getPartitioningInformation()
- Specified by:
getPartitioningInformation
in interfaceDatabaseInterface
- Returns:
- the available partition/host/databases/port combinations in the cluster
-
setPartitioningInformation
public void setPartitioningInformation(PartitionDatabaseMeta[] clusterInfo)
- Specified by:
setPartitioningInformation
in interfaceDatabaseInterface
- Parameters:
clusterInfo
- the available partition/host/databases/port combinations in the cluster
-
getConnectionPoolingProperties
public Properties 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
public void setConnectionPoolingProperties(Properties properties)
Description copied from interface:DatabaseInterface
set the connection pooling properties- Specified by:
setConnectionPoolingProperties
in interfaceDatabaseInterface
-
getSQLTableExists
public String getSQLTableExists(String tablename)
- 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
public String getSQLColumnExists(String columnname, String tablename)
- 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
public String 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
public String getPreferredSchemaName()
- Specified by:
getPreferredSchemaName
in interfaceDatabaseInterface
- Returns:
- The preferred schema name of this database connection.
-
setPreferredSchemaName
public void setPreferredSchemaName(String preferredSchemaName)
- 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
public boolean isSystemTable(String tableName)
- 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
public String 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
public String 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
public String quoteSQLString(String string)
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
public String getSelectCountStatement(String tableName)
Build the SQL to count the number of rows in the passed table.- Specified by:
getSelectCountStatement
in interfaceDatabaseInterface
- Parameters:
tableName
-- Returns:
-
generateColumnAlias
public String generateColumnAlias(int columnIndex, String suggestedName)
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
public List<String> parseStatements(String sqlScript)
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
public List<SqlScriptStatement> getSqlScriptStatements(String sqlScript)
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
protected boolean onlySpaces(String str)
- 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
public String getDataTablespaceDDL(VariableSpace variables, DatabaseMeta databaseMeta)
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
public String getIndexTablespaceDDL(VariableSpace variables, DatabaseMeta databaseMeta)
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
protected String getFieldnameProtector()
-
getSafeFieldname
public 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 number
- Specified by:
getSafeFieldname
in interfaceDatabaseInterface
- Parameters:
fieldName
- value to sanitize- Returns:
-
getSequenceNoMaxValueOption
public String 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
public String getCreateTableStatement()
Customizes the ValueMetaInterface defined in the base- Specified by:
getCreateTableStatement
in interfaceDatabaseInterface
- Returns:
- String the create table statement
-
getDropTableIfExistsStatement
public String getDropTableIfExistsStatement(String tableName)
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
public boolean fullExceptionLog(Exception e)
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
public void addAttribute(String attributeId, String value)
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
public String getAttribute(String attributeId, String defaultValue)
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
public void setNamedCluster(String namedCluster)
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
public String getNamedCluster()
- Specified by:
getNamedCluster
in interfaceDatabaseInterface
- Returns:
- The hadoop cluster associated with the connection
-
-