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 StringATTRIBUTE_CLUSTER_DBNAME_PREFIXThe clustering database name prefixstatic StringATTRIBUTE_CLUSTER_HOSTNAME_PREFIXThe clustering hostname prefixstatic StringATTRIBUTE_CLUSTER_PASSWORD_PREFIXThe clustering database password prefixstatic StringATTRIBUTE_CLUSTER_PORT_PREFIXThe clustering port prefixstatic StringATTRIBUTE_CLUSTER_USERNAME_PREFIXThe clustering database username prefixstatic StringATTRIBUTE_FORCE_IDENTIFIERS_TO_LOWERCASEA flag to determine if we should force all identifiers to lower casestatic StringATTRIBUTE_FORCE_IDENTIFIERS_TO_UPPERCASEA flag to determine if we should force all identifiers to UPPER CASEstatic StringATTRIBUTE_INITIAL_POOL_SIZEIf we use connection pooling, this would contain the initial pool sizestatic StringATTRIBUTE_IS_CLUSTEREDA flag to determine if the connection is clustered or not.static StringATTRIBUTE_MAXIMUM_POOL_SIZEIf we use connection pooling, this would contain the maximum pool sizestatic StringATTRIBUTE_MSSQL_DOUBLE_DECIMAL_SEPARATORA flag to determine if we should use a double decimal separator to specify schema/table combinations on MS-SQL serverstatic StringATTRIBUTE_POOLING_PARAMETER_PREFIXThe pooling parametersstatic StringATTRIBUTE_PORT_NUMBERThe port number of the database as string: allows for parameterization.static StringATTRIBUTE_PREFERRED_SCHEMA_NAMEThe preferred schema to use if no other has been specified.static StringATTRIBUTE_PREFIX_EXTRA_OPTIONThe prefix for all the extra options attributesstatic StringATTRIBUTE_PRESERVE_RESERVED_WORD_CASECheckbox to allow you to configure if the reserved words will have their case changed during the handleCase callstatic StringATTRIBUTE_QUOTE_ALL_FIELDSA flag to determine if we should quote all fieldsstatic StringATTRIBUTE_SQL_CONNECTThe SQL to execute at connect time (right after connecting)static StringATTRIBUTE_SUPPORTS_BOOLEAN_DATA_TYPECheckbox to allow you to configure if the database supports the boolean data type or not.static StringATTRIBUTE_SUPPORTS_TIMESTAMP_DATA_TYPECheckbox to allow you to configure if the database supports the Timestamp data type or not.static StringATTRIBUTE_USE_POOLINGA flag to determine if we should use connection pooling or not.static StringATTRIBUTE_USE_RESULT_STREAMINGA flag to determine if we should use result streaming on MySQLstatic StringAUTOINCREMENT_SQL_FOR_BATCH_IDstatic StringNAMED_CLUSTER_IDstatic DatabaseConnectionPoolParameter[]poolingParametersprotected booleanreleaseSavepointBoolean to indicate if savepoints can be released Most databases do, so we set it to true.static StringSELECT_COUNT_STATEMENTThe SQL, minus the table name, to select the number of rows from a tablestatic StringSEQUENCE_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 voidaddAttribute(String attributeId, String value)Add extra attribute on this connectionvoidaddDefaultOptions()Set default options for this databasevoidaddExtraOption(String databaseTypeCode, String option, String value)Add an extra option to the attributes listbooleancanTest()booleancheckIndexExists(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.Objectclone()Clone the basic settings for this connection!ValueMetaInterfacecustomizeValueFromSQLType(ValueMetaInterface v, ResultSetMetaData rm, int index)Customizes the ValueMetaInterface defined in the basebooleanfullExceptionLog(Exception e)Returns false if exception doesn't require full exception log.StringgenerateColumnAlias(int columnIndex, String suggestedName)Generate a column alias given the column index and suggested name.intgetAccessType()abstract int[]getAccessTypeList()Get the list of possible access types for a database.StringgetAttribute(String attributeId, String defaultValue)Gets an attribute from the connectionPropertiesgetAttributes()StringgetBackwardsCompatibleSchemaTableCombination(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.StringgetBackwardsCompatibleTable(String tablePart)Deprecated.we should phase this out in 5.0, but it's there to keep backwards compatibility in the 4.x releases.PropertiesgetConnectionPoolingProperties()StringgetConnectSQL()StringgetCreateTableStatement()Customizes the ValueMetaInterface defined in the baseStringgetDatabaseFactoryName()You can use this method to supply an alternate factory for the test method in the dialogs.StringgetDatabaseName()StringgetDatabasePortNumberString()StringgetDataTablespace()StringgetDataTablespaceDDL(VariableSpace variables, DatabaseMeta databaseMeta)Returns the tablespace DDL fragment for a "Data" tablespace.intgetDefaultDatabasePort()Map<String,String>getDefaultOptions()StringgetDisplayName()StringgetDropColumnStatement(String tablename, ValueMetaInterface v, String tk, boolean useAutoinc, String pk, boolean semicolon)Generates the SQL statement to drop a column from the specified tableStringgetDropTableIfExistsStatement(String tableName)Forms drop table statement.StringgetEndQuote()StringgetExtraOptionIndicator()Map<String,String>getExtraOptions()StringgetExtraOptionSeparator()StringgetExtraOptionsHelpText()StringgetExtraOptionValueSeparator()protected StringgetFieldnameProtector()StringgetFunctionAverage()StringgetFunctionCount()StringgetFunctionMaximum()StringgetFunctionMinimum()StringgetFunctionSum()StringgetHostname()StringgetIndexTablespace()StringgetIndexTablespaceDDL(VariableSpace variables, DatabaseMeta databaseMeta)Returns the tablespace DDL fragment for a "Index" tablespace.intgetInitialPoolSize()StringgetInitialPoolSizeString()StringgetLimitClause(int nrRows)intgetMaxColumnsInIndex()intgetMaximumPoolSize()StringgetMaximumPoolSizeString()intgetMaxTextFieldLength()Get the maximum length of a text field for this database connection.intgetMaxVARCHARLength()Get the maximum length of a text field (VARCHAR) for this database connection.StringgetName()StringgetNamedCluster()LonggetNextBatchId(DatabaseMeta dbm, Database ldb, String schemaName, String tableName, String fieldName)Get the next Batch ID from the logging tables.LonggetNextBatchIdUsingAutoIncSQL(String autoIncSQL, DatabaseMeta dbm, Database ldb)LonggetNextBatchIdUsingLockTables(DatabaseMeta dbm, Database ldb, String schemaName, String tableName, String fieldName)LonggetNextBatchIdUsingSequence(String sequenceName, String schemaName, DatabaseMeta dbm, Database ldb)intgetNotFoundTK(boolean useAutoinc)Get the not found technical key.ObjectIdgetObjectId()PartitionDatabaseMeta[]getPartitioningInformation()StringgetPassword()StringgetPluginId()StringgetPluginName()StringgetPreferredSchemaName()String[]getReservedWords()StringgetSafeFieldname(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 numberStringgetSchemaTableCombination(String schemaName, String tablePart)Get the schema-table combination to query the right table.StringgetSelectCountStatement(String tableName)Build the SQL to count the number of rows in the passed table.StringgetSequenceNoMaxValueOption()StringgetServername()StringgetSQLColumnExists(String columnname, String tablename)StringgetSQLCurrentSequenceValue(String sequenceName)Get the current value of a database sequenceStringgetSQLInsertAutoIncUnknownDimensionRow(String schemaTable, String keyField, String versionField)Get the SQL to insert a new empty unknown record in a dimension.StringgetSQLListOfProcedures()StringgetSQLListOfSchemas()StringgetSQLListOfSequences()StringgetSQLLockTables(String[] tableNames)StringgetSQLNextSequenceValue(String sequenceName)Get the SQL to get the next value of a sequence.StringgetSQLQueryFields(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.StringgetSQLSequenceExists(String sequenceName)Check if a sequence exists.StringgetSQLTableExists(String tablename)StringgetSQLUnlockTables(String[] tableNames)StringgetSQLValue(ValueMetaInterface valueMeta, Object valueData, String dateFormat)Convert a value in the SQL equivalent.StringgetStartQuote()String[]getSynonymTypes()StringgetTablespaceDDL(VariableSpace variables, DatabaseMeta databaseMeta, String tablespaceName)Returns an empty string as most databases do not support tablespaces.String[]getTableTypes()StringgetTruncateTableStatement(String tableName)StringgetUsername()ObjectgetValueFromResultSet(ResultSet rs, ValueMetaInterface val, int i)This method allows a database dialect to convert database specific data types to Kettle data types.String[]getViewTypes()StringgetXulOverlayFile()booleanisChanged()booleanisDefaultingToUppercase()booleanisDisplaySizeTwiceThePrecision()booleanisExplorable()booleanisFetchSizeSupported()Checks whether or not the command setFetchSize() is supported by the JDBC driver...booleanisForcingIdentifiersToLowerCase()booleanisForcingIdentifiersToUpperCase()booleanisMySQLVariant()booleanisPartitioned()booleanisQuoteAllFields()booleanisRequiringTransactionsOnQueries()booleanisStreamingResults()booleanisSystemTable(String tableName)booleanisUsingConnectionPool()booleanisUsingDoubleDecimalAsSchemaTableSeparator()booleanneedsPlaceHolder()Indicates the need to insert a placeholder (0) for auto increment fields.booleanneedsToLockAllTables()protected booleanonlySpaces(String str)List<String>parseStatements(String sqlScript)Parse all possible statements from the provided SQL script.booleanpreserveReservedCase()booleanquoteReservedWords()StringquoteSQLString(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.booleanreleaseSavepoint()Returns a true of savepoints can be released, false if not.booleanrequiresCastToVariousForIsNull()booleanrequiresCreateTablePrimaryKeyAppend()booleanrequiresName()voidsetAccessType(int accessType)voidsetAttributes(Properties attributes)Set extra attributes on this database connectionvoidsetChanged(boolean changed)voidsetConnectionPoolingProperties(Properties properties)set the connection pooling propertiesvoidsetConnectSQL(String sql)voidsetDatabaseName(String databaseName)voidsetDatabasePortNumberString(String databasePortNumberString)voidsetDataTablespace(String dataTablespace)voidsetDisplayName(String displayName)voidsetForcingIdentifiersToLowerCase(boolean forceLowerCase)voidsetForcingIdentifiersToUpperCase(boolean forceUpperCase)voidsetHostname(String hostname)voidsetIndexTablespace(String indexTablespace)voidsetInitialPoolSize(int initialPoolSize)voidsetInitialPoolSizeString(String initialPoolSize)voidsetMaximumPoolSize(int maximumPoolSize)voidsetMaximumPoolSizeString(String maximumPoolSize)voidsetName(String name)voidsetNamedCluster(String namedCluster)Set the hadoop cluster associated with the connectionvoidsetObjectId(ObjectId id)voidsetPartitioned(boolean clustered)voidsetPartitioningInformation(PartitionDatabaseMeta[] clusterInfo)voidsetPassword(String password)voidsetPluginId(String pluginId)voidsetPluginName(String pluginName)voidsetPreferredSchemaName(String preferredSchemaName)voidsetPreserveReservedCase(boolean b)voidsetQuoteAllFields(boolean quoteAllFields)voidsetServername(String servername)voidsetStreamingResults(boolean useStreaming)voidsetSupportsBooleanDataType(boolean b)voidsetSupportsTimestampDataType(boolean b)voidsetUsername(String username)voidsetUsingConnectionPool(boolean usePool)voidsetUsingDoubleDecimalAsSchemaTableSeparator(boolean useDoubleDecimalSeparator)booleansupportsAutoGeneratedKeys()booleansupportsAutoInc()booleansupportsBatchUpdates()booleansupportsBitmapIndex()booleansupportsBooleanDataType()booleansupportsCatalogs()booleansupportsEmptyTransactions()booleansupportsErrorHandling()booleansupportsErrorHandlingOnBatchUpdates()booleansupportsFloatRoundingOnUpdate()Most databases round number(7,2) 17.29999999 to 17.30, but some don't.booleansupportsGetBlob()booleansupportsNewLinesInSQL()booleansupportsOptionsInURL()booleansupportsPreparedStatementMetadataRetrieval()Most databases allow you to retrieve result metadata by preparing a SELECT statement.booleansupportsRepository()booleansupportsResultSetMetadataRetrievalOnly()booleansupportsSchemas()booleansupportsSequenceNoMaxValueOption()booleansupportsSequences()booleansupportsSetCharacterStream()See if this database supports the setCharacterStream() method on a PreparedStatement.booleansupportsSetLong()booleansupportsSetMaxRows()booleansupportsSynonyms()booleansupportsTimestampDataType()booleansupportsTimeStampToDateConversion()booleansupportsTransactions()booleansupportsViews()booleanuseSafePoints()booleanuseSchemaNameForTableList()-
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:
getPluginIdin interfaceDatabaseInterface- Returns:
- plugin ID of this class
-
setPluginId
public void setPluginId(String pluginId)
- Specified by:
setPluginIdin interfaceDatabaseInterface- Parameters:
pluginId- The plugin ID to set.
-
getPluginName
public String getPluginName()
- Specified by:
getPluginNamein interfaceDatabaseInterface- Returns:
- plugin name of this class
-
setPluginName
public void setPluginName(String pluginName)
- Specified by:
setPluginNamein interfaceDatabaseInterface- Parameters:
pluginName- The plugin name to set.
-
getAccessTypeList
public abstract int[] getAccessTypeList()
Description copied from interface:DatabaseInterfaceGet the list of possible access types for a database.- Specified by:
getAccessTypeListin interfaceDatabaseInterface- Returns:
- the list of possible access types for a database.
-
getAccessType
public int getAccessType()
- Specified by:
getAccessTypein interfaceDatabaseInterface- Returns:
- Returns the accessType.
-
setAccessType
public void setAccessType(int accessType)
- Specified by:
setAccessTypein interfaceDatabaseInterface- Parameters:
accessType- The accessType to set.
-
isChanged
public boolean isChanged()
- Specified by:
isChangedin interfaceDatabaseInterface- Returns:
- Returns the changed.
-
setChanged
public void setChanged(boolean changed)
- Specified by:
setChangedin interfaceDatabaseInterface- Parameters:
changed- The changed to set.
-
getName
public String getName()
- Specified by:
getNamein interfaceDatabaseInterface- Returns:
- Returns the connection name.
-
setName
public void setName(String name)
- Specified by:
setNamein interfaceDatabaseInterface- Parameters:
name- The connection Name to set.
-
getDisplayName
public String getDisplayName()
- Specified by:
getDisplayNamein interfaceDatabaseInterface- Returns:
- Returns the un-escaped connection Name.
-
setDisplayName
public void setDisplayName(String displayName)
- Specified by:
setDisplayNamein interfaceDatabaseInterface- Parameters:
displayName- The un-escaped connection Name to set.
-
getDatabaseName
public String getDatabaseName()
- Specified by:
getDatabaseNamein interfaceDatabaseInterface- Returns:
- Returns the databaseName.
-
setDatabaseName
public void setDatabaseName(String databaseName)
- Specified by:
setDatabaseNamein interfaceDatabaseInterface- Parameters:
databaseName- The databaseName to set.
-
setDatabasePortNumberString
public void setDatabasePortNumberString(String databasePortNumberString)
- Specified by:
setDatabasePortNumberStringin interfaceDatabaseInterface- Parameters:
databasePortNumberString- The databasePortNumber string to set.
-
getDatabasePortNumberString
public String getDatabasePortNumberString()
- Specified by:
getDatabasePortNumberStringin interfaceDatabaseInterface- Returns:
- Returns the databasePortNumber string.
-
getHostname
public String getHostname()
- Specified by:
getHostnamein interfaceDatabaseInterface- Returns:
- Returns the hostname.
-
setHostname
public void setHostname(String hostname)
- Specified by:
setHostnamein interfaceDatabaseInterface- Parameters:
hostname- The hostname to set.
-
getObjectId
public ObjectId getObjectId()
- Specified by:
getObjectIdin interfaceDatabaseInterface- Returns:
- Returns the id.
-
setObjectId
public void setObjectId(ObjectId id)
- Specified by:
setObjectIdin interfaceDatabaseInterface- Parameters:
id- The id to set.
-
getPassword
public String getPassword()
- Specified by:
getPasswordin interfaceDatabaseInterface- Returns:
- Returns the password.
-
setPassword
public void setPassword(String password)
- Specified by:
setPasswordin interfaceDatabaseInterface- Parameters:
password- The password to set.
-
getServername
public String getServername()
- Specified by:
getServernamein interfaceDatabaseInterface- Returns:
- Returns the servername.
-
setServername
public void setServername(String servername)
- Specified by:
setServernamein interfaceDatabaseInterface- Parameters:
servername- The servername to set.
-
getDataTablespace
public String getDataTablespace()
- Specified by:
getDataTablespacein interfaceDatabaseInterface- Returns:
- Returns the tablespaceData.
-
setDataTablespace
public void setDataTablespace(String dataTablespace)
- Specified by:
setDataTablespacein interfaceDatabaseInterface- Parameters:
dataTablespace- The data tablespace to set.
-
getIndexTablespace
public String getIndexTablespace()
- Specified by:
getIndexTablespacein interfaceDatabaseInterface- Returns:
- Returns the index tablespace.
-
setIndexTablespace
public void setIndexTablespace(String indexTablespace)
- Specified by:
setIndexTablespacein interfaceDatabaseInterface- Parameters:
indexTablespace- The index tablespace to set.
-
getUsername
public String getUsername()
- Specified by:
getUsernamein interfaceDatabaseInterface- Returns:
- Returns the username.
-
setUsername
public void setUsername(String username)
- Specified by:
setUsernamein interfaceDatabaseInterface- Parameters:
username- The username to set.
-
getAttributes
public Properties getAttributes()
- Specified by:
getAttributesin interfaceDatabaseInterface- Returns:
- The extra attributes for this database connection
-
setAttributes
public void setAttributes(Properties attributes)
Set extra attributes on this database connection- Specified by:
setAttributesin 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:
clonein interfaceDatabaseInterface- Overrides:
clonein classObject- Returns:
- the cloned Database Interface object.
-
getDefaultDatabasePort
public int getDefaultDatabasePort()
- Specified by:
getDefaultDatabasePortin interfaceDatabaseInterface- Returns:
- the default database port number
-
getDefaultOptions
public Map<String,String> getDefaultOptions()
- Specified by:
getDefaultOptionsin interfaceDatabaseInterface- Returns:
- default extra Options
-
supportsSetCharacterStream
public boolean supportsSetCharacterStream()
See if this database supports the setCharacterStream() method on a PreparedStatement.- Specified by:
supportsSetCharacterStreamin interfaceDatabaseInterface- Returns:
- true if we can set a Stream on a field in a PreparedStatement. False if not.
-
supportsAutoInc
public boolean supportsAutoInc()
- Specified by:
supportsAutoIncin interfaceDatabaseInterface- Returns:
- Whether or not the database can use auto increment type of fields (pk)
-
getLimitClause
public String getLimitClause(int nrRows)
- Specified by:
getLimitClausein 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:DatabaseInterfaceGet the not found technical key.- Specified by:
getNotFoundTKin 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:
getSQLNextSequenceValuein 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:
getSQLCurrentSequenceValuein 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:
getSQLSequenceExistsin 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:
isFetchSizeSupportedin 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:
needsPlaceHolderin interfaceDatabaseInterface- Returns:
- true if we need a placeholder for auto increment fields in insert statements.
-
supportsSchemas
public boolean supportsSchemas()
- Specified by:
supportsSchemasin interfaceDatabaseInterface- Returns:
- true if the database supports schemas
-
supportsCatalogs
public boolean supportsCatalogs()
- Specified by:
supportsCatalogsin interfaceDatabaseInterface- Returns:
- true if the database supports catalogs
-
supportsEmptyTransactions
public boolean supportsEmptyTransactions()
- Specified by:
supportsEmptyTransactionsin 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:
getFunctionSumin interfaceDatabaseInterface- Returns:
- the function for SUM agrregate
-
getFunctionAverage
public String getFunctionAverage()
- Specified by:
getFunctionAveragein interfaceDatabaseInterface- Returns:
- the function for Average agrregate
-
getFunctionMinimum
public String getFunctionMinimum()
- Specified by:
getFunctionMinimumin interfaceDatabaseInterface- Returns:
- the function for Minimum agrregate
-
getFunctionMaximum
public String getFunctionMaximum()
- Specified by:
getFunctionMaximumin interfaceDatabaseInterface- Returns:
- the function for Maximum agrregate
-
getFunctionCount
public String getFunctionCount()
- Specified by:
getFunctionCountin 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:
getSchemaTableCombinationin 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:
getMaxTextFieldLengthin 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:
getMaxVARCHARLengthin interfaceDatabaseInterface- Returns:
- The maximum VARCHAR field length for this database type. (mostly identical to getMaxTextFieldLength() - CLOB_LENGTH)
-
supportsTransactions
public boolean supportsTransactions()
- Specified by:
supportsTransactionsin interfaceDatabaseInterface- Returns:
- true if the database supports transactions.
-
supportsSequences
public boolean supportsSequences()
- Specified by:
supportsSequencesin interfaceDatabaseInterface- Returns:
- true if the database supports sequences
-
supportsBitmapIndex
public boolean supportsBitmapIndex()
- Specified by:
supportsBitmapIndexin interfaceDatabaseInterface- Returns:
- true if the database supports bitmap indexes
-
supportsSetLong
public boolean supportsSetLong()
- Specified by:
supportsSetLongin 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:
getDropColumnStatementin 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:
getReservedWordsin interfaceDatabaseInterface- Returns:
- an array of reserved words for the database type...
-
quoteReservedWords
public boolean quoteReservedWords()
- Specified by:
quoteReservedWordsin interfaceDatabaseInterface- Returns:
- true if reserved words need to be double quoted ("password", "select", ...)
-
getStartQuote
public String getStartQuote()
- Specified by:
getStartQuotein interfaceDatabaseInterface- Returns:
- The start quote sequence, mostly just double quote, but sometimes [, ...
-
getEndQuote
public String getEndQuote()
- Specified by:
getEndQuotein interfaceDatabaseInterface- Returns:
- The end quote sequence, mostly just double quote, but sometimes ], ...
-
supportsRepository
public boolean supportsRepository()
- Specified by:
supportsRepositoryin interfaceDatabaseInterface- Returns:
- true if Kettle can create a repository on this type of database.
-
getTableTypes
public String[] getTableTypes()
- Specified by:
getTableTypesin interfaceDatabaseInterface- Returns:
- a list of table types to retrieve tables for the database
-
getViewTypes
public String[] getViewTypes()
- Specified by:
getViewTypesin interfaceDatabaseInterface- Returns:
- a list of table types to retrieve views for the database
-
getSynonymTypes
public String[] getSynonymTypes()
- Specified by:
getSynonymTypesin interfaceDatabaseInterface- Returns:
- a list of table types to retrieve synonyms for the database
-
useSchemaNameForTableList
public boolean useSchemaNameForTableList()
- Specified by:
useSchemaNameForTableListin 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:
supportsViewsin interfaceDatabaseInterface- Returns:
- true if the database supports views
-
supportsSynonyms
public boolean supportsSynonyms()
- Specified by:
supportsSynonymsin interfaceDatabaseInterface- Returns:
- true if the database supports synonyms
-
getSQLListOfProcedures
public String getSQLListOfProcedures()
- Specified by:
getSQLListOfProceduresin interfaceDatabaseInterface- Returns:
- The SQL on this database to get a list of stored procedures.
-
getSQLListOfSequences
public String getSQLListOfSequences()
- Specified by:
getSQLListOfSequencesin interfaceDatabaseInterface- Returns:
- The SQL on this database to get a list of sequences.
-
getTruncateTableStatement
public String getTruncateTableStatement(String tableName)
- Specified by:
getTruncateTableStatementin 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:
getSQLQueryFieldsin 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:
supportsFloatRoundingOnUpdatein interfaceDatabaseInterface- Returns:
- true if the database supports roundinf of floating point data on update/insert
-
getSQLLockTables
public String getSQLLockTables(String[] tableNames)
- Specified by:
getSQLLockTablesin 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:
getSQLUnlockTablesin 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:
supportsTimeStampToDateConversionin interfaceDatabaseInterface- Returns:
- true if the database supports timestamp to date conversion. For example Interbase doesn't support this!
-
supportsBatchUpdates
public boolean supportsBatchUpdates()
- Specified by:
supportsBatchUpdatesin interfaceDatabaseInterface- Returns:
- true if the database JDBC driver supports batch updates For example Interbase doesn't support this!
-
supportsBooleanDataType
public boolean supportsBooleanDataType()
- Specified by:
supportsBooleanDataTypein 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:
setSupportsBooleanDataTypein interfaceDatabaseInterface- Parameters:
b- Set to true if the database supports a boolean, bit, logical, ... datatype
-
supportsTimestampDataType
public boolean supportsTimestampDataType()
- Specified by:
supportsTimestampDataTypein interfaceDatabaseInterface- Returns:
- true if the database supports the Timestamp data type (nanosecond precision and all)
-
setSupportsTimestampDataType
public void setSupportsTimestampDataType(boolean b)
- Specified by:
setSupportsTimestampDataTypein interfaceDatabaseInterface- Parameters:
b- Set to true if the database supports the Timestamp data type (nanosecond precision and all)
-
preserveReservedCase
public boolean preserveReservedCase()
- Specified by:
preserveReservedCasein interfaceDatabaseInterface- Returns:
- true if reserved words' case should be preserved
-
setPreserveReservedCase
public void setPreserveReservedCase(boolean b)
- Specified by:
setPreserveReservedCasein interfaceDatabaseInterface- Parameters:
b- Set to true if reserved words' case should be preserved
-
isDefaultingToUppercase
public boolean isDefaultingToUppercase()
- Specified by:
isDefaultingToUppercasein 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:
getExtraOptionsin 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:
addExtraOptionin 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:
getExtraOptionSeparatorin interfaceDatabaseInterface- Returns:
- The extra option separator in database URL for this platform (usually this is semicolon ; )
-
getExtraOptionValueSeparator
public String getExtraOptionValueSeparator()
- Specified by:
getExtraOptionValueSeparatorin 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:
getExtraOptionIndicatorin interfaceDatabaseInterface- Returns:
- This indicator separates the normal URL from the options
-
supportsOptionsInURL
public boolean supportsOptionsInURL()
- Specified by:
supportsOptionsInURLin 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:
getExtraOptionsHelpTextin interfaceDatabaseInterface- Returns:
- extra help text on the supported options on the selected database platform.
-
supportsGetBlob
public boolean supportsGetBlob()
- Specified by:
supportsGetBlobin 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:
getConnectSQLin interfaceDatabaseInterface- Returns:
- The SQL to execute right after connecting
-
setConnectSQL
public void setConnectSQL(String sql)
- Specified by:
setConnectSQLin interfaceDatabaseInterface- Parameters:
sql- The SQL to execute right after connecting
-
supportsSetMaxRows
public boolean supportsSetMaxRows()
- Specified by:
supportsSetMaxRowsin interfaceDatabaseInterface- Returns:
- true if the database supports setting the maximum number of return rows in a resultset.
-
isUsingConnectionPool
public boolean isUsingConnectionPool()
- Specified by:
isUsingConnectionPoolin interfaceDatabaseInterface- Returns:
- true if we want to use a database connection pool
-
setUsingConnectionPool
public void setUsingConnectionPool(boolean usePool)
- Specified by:
setUsingConnectionPoolin interfaceDatabaseInterface- Parameters:
usePool- true if we want to use a database connection pool
-
getMaximumPoolSize
public int getMaximumPoolSize()
- Specified by:
getMaximumPoolSizein interfaceDatabaseInterface- Returns:
- the maximum pool size
-
getMaximumPoolSizeString
public String getMaximumPoolSizeString()
- Specified by:
getMaximumPoolSizeStringin interfaceDatabaseInterface- Returns:
- the maximum pool size variable name
-
setMaximumPoolSize
public void setMaximumPoolSize(int maximumPoolSize)
- Specified by:
setMaximumPoolSizein interfaceDatabaseInterface- Parameters:
maximumPoolSize- the maximum pool size
-
setMaximumPoolSizeString
public void setMaximumPoolSizeString(String maximumPoolSize)
- Specified by:
setMaximumPoolSizeStringin interfaceDatabaseInterface- Parameters:
maximumPoolSize- the maximum pool size variable name
-
getInitialPoolSize
public int getInitialPoolSize()
- Specified by:
getInitialPoolSizein interfaceDatabaseInterface- Returns:
- the initial pool size
-
getInitialPoolSizeString
public String getInitialPoolSizeString()
- Specified by:
getInitialPoolSizeStringin interfaceDatabaseInterface- Returns:
- the initial pool size variable name
-
setInitialPoolSize
public void setInitialPoolSize(int initialPoolSize)
- Specified by:
setInitialPoolSizein interfaceDatabaseInterface- Parameters:
initialPoolSize- the initial pool size
-
setInitialPoolSizeString
public void setInitialPoolSizeString(String initialPoolSize)
- Specified by:
setInitialPoolSizeStringin interfaceDatabaseInterface- Parameters:
initialPoolSize- the initial pool size variable name
-
isPartitioned
public boolean isPartitioned()
- Specified by:
isPartitionedin interfaceDatabaseInterface- Returns:
- true if we want to use a database connection pool
-
setPartitioned
public void setPartitioned(boolean clustered)
- Specified by:
setPartitionedin interfaceDatabaseInterface- Parameters:
clustered- true if we want to use a database connection pool
-
getPartitioningInformation
public PartitionDatabaseMeta[] getPartitioningInformation()
- Specified by:
getPartitioningInformationin interfaceDatabaseInterface- Returns:
- the available partition/host/databases/port combinations in the cluster
-
setPartitioningInformation
public void setPartitioningInformation(PartitionDatabaseMeta[] clusterInfo)
- Specified by:
setPartitioningInformationin interfaceDatabaseInterface- Parameters:
clusterInfo- the available partition/host/databases/port combinations in the cluster
-
getConnectionPoolingProperties
public Properties getConnectionPoolingProperties()
- Specified by:
getConnectionPoolingPropertiesin 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:DatabaseInterfaceset the connection pooling properties- Specified by:
setConnectionPoolingPropertiesin interfaceDatabaseInterface
-
getSQLTableExists
public String getSQLTableExists(String tablename)
- Specified by:
getSQLTableExistsin 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:
getSQLColumnExistsin 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:
needsToLockAllTablesin 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:
isStreamingResultsin 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:
setStreamingResultsin 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:
isQuoteAllFieldsin interfaceDatabaseInterface- Returns:
- true if all fields should always be quoted in db
-
setQuoteAllFields
public void setQuoteAllFields(boolean quoteAllFields)
- Specified by:
setQuoteAllFieldsin 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:
isForcingIdentifiersToLowerCasein interfaceDatabaseInterface- Returns:
- true if all identifiers should be forced to lower case
-
setForcingIdentifiersToLowerCase
public void setForcingIdentifiersToLowerCase(boolean forceLowerCase)
- Specified by:
setForcingIdentifiersToLowerCasein interfaceDatabaseInterface- Parameters:
forceLowerCase- true if all identifiers should be forced to lower case
-
isForcingIdentifiersToUpperCase
public boolean isForcingIdentifiersToUpperCase()
- Specified by:
isForcingIdentifiersToUpperCasein interfaceDatabaseInterface- Returns:
- true if all identifiers should be forced to upper case
-
setForcingIdentifiersToUpperCase
public void setForcingIdentifiersToUpperCase(boolean forceUpperCase)
- Specified by:
setForcingIdentifiersToUpperCasein interfaceDatabaseInterface- Parameters:
forceUpperCase- true if all identifiers should be forced to upper case
-
isUsingDoubleDecimalAsSchemaTableSeparator
public boolean isUsingDoubleDecimalAsSchemaTableSeparator()
- Specified by:
isUsingDoubleDecimalAsSchemaTableSeparatorin 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:
setUsingDoubleDecimalAsSchemaTableSeparatorin 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:
isRequiringTransactionsOnQueriesin 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:
getDatabaseFactoryNamein interfaceDatabaseInterface- Returns:
- the name of the database test factory to use.
-
getPreferredSchemaName
public String getPreferredSchemaName()
- Specified by:
getPreferredSchemaNamein interfaceDatabaseInterface- Returns:
- The preferred schema name of this database connection.
-
setPreferredSchemaName
public void setPreferredSchemaName(String preferredSchemaName)
- Specified by:
setPreferredSchemaNamein 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:
checkIndexExistsin 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:
supportsSequenceNoMaxValueOptionin 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:
requiresCreateTablePrimaryKeyAppendin 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:
requiresCastToVariousForIsNullin 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:
isDisplaySizeTwiceThePrecisionin 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:
supportsPreparedStatementMetadataRetrievalin 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:
supportsResultSetMetadataRetrievalOnlyin 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:
isSystemTablein interfaceDatabaseInterface- Parameters:
tableName-- Returns:
- true if the specified table is a system table
-
supportsNewLinesInSQL
public boolean supportsNewLinesInSQL()
- Specified by:
supportsNewLinesInSQLin interfaceDatabaseInterface- Returns:
- true if the database supports newlines in a SQL statements.
-
getSQLListOfSchemas
public String getSQLListOfSchemas()
- Specified by:
getSQLListOfSchemasin 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:
getMaxColumnsInIndexin interfaceDatabaseInterface- Returns:
- The maximum number of columns in a database, <=0 means: no known limit
-
supportsErrorHandlingOnBatchUpdates
public boolean supportsErrorHandlingOnBatchUpdates()
- Specified by:
supportsErrorHandlingOnBatchUpdatesin 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:
getSQLInsertAutoIncUnknownDimensionRowin 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:
isExplorablein interfaceDatabaseInterface- Returns:
- true if this is a relational database you can explore. Return false for SAP, PALO, etc.
-
getXulOverlayFile
public String getXulOverlayFile()
- Specified by:
getXulOverlayFilein 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:DatabaseInterfaceAdds quotes around the string according to the database dialect and also escapes special characters like CR, LF and the quote character itself.- Specified by:
quoteSQLStringin 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:
getSelectCountStatementin interfaceDatabaseInterface- Parameters:
tableName-- Returns:
-
generateColumnAlias
public String generateColumnAlias(int columnIndex, String suggestedName)
Description copied from interface:DatabaseInterfaceGenerate a column alias given the column index and suggested name.- Specified by:
generateColumnAliasin 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:
parseStatementsin 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:
getSqlScriptStatementsin 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
strcontains only spaces.
-
isMySQLVariant
public boolean isMySQLVariant()
- Specified by:
isMySQLVariantin 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:
releaseSavepointin 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:DatabaseInterfaceGet the next Batch ID from the logging tables.- Specified by:
getNextBatchIdin 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:
getDataTablespaceDDLin 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:
getIndexTablespaceDDLin 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:
getValueFromResultSetin 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:
useSafePointsin 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:
supportsErrorHandlingin 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:DatabaseInterfaceConvert 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:
getSQLValuein 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:
getSafeFieldnamein interfaceDatabaseInterface- Parameters:
fieldName- value to sanitize- Returns:
-
getSequenceNoMaxValueOption
public String getSequenceNoMaxValueOption()
- Specified by:
getSequenceNoMaxValueOptionin interfaceDatabaseInterface- Returns:
- string with the no max value sequence option.
-
supportsAutoGeneratedKeys
public boolean supportsAutoGeneratedKeys()
- Specified by:
supportsAutoGeneratedKeysin 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:
customizeValueFromSQLTypein 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:
getCreateTableStatementin 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:
getDropTableIfExistsStatementin interfaceDatabaseInterfaceExtended- Parameters:
tableName- Name of the table to drop- Returns:
- Standard drop table statement
-
fullExceptionLog
public boolean fullExceptionLog(Exception e)
Description copied from interface:DatabaseInterfaceExtendedReturns 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:
fullExceptionLogin interfaceDatabaseInterfaceExtended- Parameters:
e- exception to check- Returns:
- decision result
-
addDefaultOptions
public void addDefaultOptions()
Description copied from interface:DatabaseInterfaceSet default options for this database- Specified by:
addDefaultOptionsin interfaceDatabaseInterface
-
addAttribute
public void addAttribute(String attributeId, String value)
Description copied from interface:DatabaseInterfaceAdd extra attribute on this connection- Specified by:
addAttributein interfaceDatabaseInterface- Parameters:
attributeId- the attribute identifiervalue- the value of the attribute
-
getAttribute
public String getAttribute(String attributeId, String defaultValue)
Description copied from interface:DatabaseInterfaceGets an attribute from the connection- Specified by:
getAttributein 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:DatabaseInterfaceSet the hadoop cluster associated with the connection- Specified by:
setNamedClusterin interfaceDatabaseInterface- Parameters:
namedCluster- The hadoop cluster name
-
getNamedCluster
public String getNamedCluster()
- Specified by:
getNamedClusterin interfaceDatabaseInterface- Returns:
- The hadoop cluster associated with the connection
-
-