org.pentaho.di.core.database
Class BaseDatabaseMeta

java.lang.Object
  extended by org.pentaho.di.core.database.BaseDatabaseMeta
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
AS400DatabaseMeta, CacheDatabaseMeta, DB2DatabaseMeta, DbaseDatabaseMeta, DerbyDatabaseMeta, Exasol4DatabaseMeta, ExtenDBDatabaseMeta, FirebirdDatabaseMeta, GenericDatabaseMeta, GuptaDatabaseMeta, H2DatabaseMeta, HypersonicDatabaseMeta, InformixDatabaseMeta, IngresDatabaseMeta, InterbaseDatabaseMeta, KingbaseESDatabaseMeta, LucidDBDatabaseMeta, MonetDBDatabaseMeta, MSAccessDatabaseMeta, MSSQLServerDatabaseMeta, MySQLDatabaseMeta, NeoviewDatabaseMeta, NetezzaDatabaseMeta, OracleDatabaseMeta, OracleRDBDatabaseMeta, PostgreSQLDatabaseMeta, SAPDBDatabaseMeta, SAPR3DatabaseMeta, SQLiteDatabaseMeta, SybaseDatabaseMeta, SybaseIQDatabaseMeta, TeradataDatabaseMeta, UniVerseDatabaseMeta, VerticaDatabaseMeta

public abstract class BaseDatabaseMeta
extends Object
implements Cloneable

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
static String ATTRIBUTE_CLUSTER_DBNAME_PREFIX
          The clustering database name prefix
static String ATTRIBUTE_CLUSTER_HOSTNAME_PREFIX
          The clustering hostname prefix
static String ATTRIBUTE_CLUSTER_PASSWORD_PREFIX
          The clustering database password prefix
static String ATTRIBUTE_CLUSTER_PORT_PREFIX
          The clustering port prefix
static String ATTRIBUTE_CLUSTER_USERNAME_PREFIX
          The clustering database username prefix
static String ATTRIBUTE_FORCE_IDENTIFIERS_TO_LOWERCASE
          A flag to determine if we should force all identifiers to lower case
static String ATTRIBUTE_FORCE_IDENTIFIERS_TO_UPPERCASE
          A flag to determine if we should force all identifiers to UPPER CASE
static String ATTRIBUTE_INITIAL_POOL_SIZE
          If we use connection pooling, this would contain the initial pool size
static 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 size
static 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
static String ATTRIBUTE_POOLING_PARAMETER_PREFIX
          The pooling parameters
static 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 attributes
static String ATTRIBUTE_QUOTE_ALL_FIELDS
          A flag to determine if we should quote all fields
static 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_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 MySQL
static String AUTOINCREMENT_SQL_FOR_BATCH_ID
           
static DatabaseConnectionPoolParameter[] poolingParameters
           
static String SELECT_COUNT_STATEMENT
          The SQL, minus the table name, to select the number of rows from a table
static String SEQUENCE_FOR_BATCH_ID
           
 
Constructor Summary
BaseDatabaseMeta()
           
 
Method Summary
 void addExtraOption(String databaseTypeCode, String option, String value)
          Add an extra option to the attributes list
 boolean checkIndexExists(Database database, String schemaName, String tableName, String[] idx_fields)
          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!
 String generateColumnAlias(int columnIndex, String suggestedName)
           
 int getAccessType()
           
abstract  int[] getAccessTypeList()
           
 Properties 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 getDatabaseFactoryName()
          You can use this method to supply an alternate factory for the test method in the dialogs.
 String getDatabaseName()
           
 String getDatabasePortNumberString()
           
 String getDataTablespace()
           
 String getDataTablespaceDDL(VariableSpace variables, DatabaseMeta databaseMeta)
          Returns the tablespace DDL fragment for a "Data" tablespace.
 int getDefaultDatabasePort()
           
 String getDropColumnStatement(String tablename, ValueMetaInterface v, String tk, boolean use_autoinc, String pk, boolean semicolon)
          Generates the SQL statement to drop a column from the specified table
 String getEndQuote()
           
 String getExtraOptionIndicator()
           
 Map<String,String> getExtraOptions()
           
 String getExtraOptionSeparator()
           
 String getExtraOptionsHelpText()
           
 String getExtraOptionValueSeparator()
           
 String getFunctionAverage()
           
 String getFunctionCount()
           
 String getFunctionMaximum()
           
 String getFunctionMinimum()
           
 String getFunctionSum()
           
 String getHostname()
           
 String getIndexTablespace()
           
 String getIndexTablespaceDDL(VariableSpace variables, DatabaseMeta databaseMeta)
          Returns the tablespace DDL fragment for a "Index" tablespace.
 int getInitialPoolSize()
           
 String getLimitClause(int nrRows)
           
 int getMaxColumnsInIndex()
           
 int getMaximumPoolSize()
           
 int getMaxTextFieldLength()
          Get the maximum length of a text field for this database connection.
 int getMaxVARCHARLength()
          Get the maximum length of a text field (VARCHAR) for this database connection.
 String getName()
           
 Long getNextBatchId(DatabaseMeta dbm, Database ldb, String schemaName, String tableName, String fieldName)
           
 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 use_autoinc)
           
 ObjectId getObjectId()
           
 PartitionDatabaseMeta[] getPartitioningInformation()
           
 String getPassword()
           
 String getPluginId()
           
 String getPluginName()
           
 String getPreferredSchemaName()
           
 String[] getReservedWords()
           
 String getSchemaTableCombination(String schema_name, String table_part)
          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 getServername()
           
 String getSQLColumnExists(String columnname, String tablename)
           
 String getSQLCurrentSequenceValue(String sequenceName)
          Get the current value of a database sequence
 String getSQLInsertAutoIncUnknownDimensionRow(String schemaTable, String keyField, String versionField)
          Get the SQL to insert a new empty unknown record in a dimension.
 String getSQLListOfProcedures()
           
 String getSQLListOfSchemas()
           
 String getSQLListOfSequences()
           
 String getSQLLockTables(String[] tableNames)
           
 String getSQLNextSequenceValue(String sequenceName)
          Get the SQL to get the next value of a sequence.
 String getSQLQueryFields(String tableName)
          Returns the minimal SQL to launch in order to determine the layout of the resultset for a given database table
 String getSQLSequenceExists(String sequenceName)
          Check if a sequence exists.
 String getSQLTableExists(String tablename)
           
 String getSQLUnlockTables(String[] tableNames)
           
 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()
           
 List<String> parseStatements(String sqlScript)
          Parse all possible statements from the provided SQL script.
 boolean quoteReservedWords()
           
 String quoteSQLString(String string)
           
 boolean releaseSavepoint()
          Returns a true of savepoints can be released, false if not.
 boolean requiresCastToVariousForIsNull()
           
 boolean requiresCreateTablePrimaryKeyAppend()
           
 void setAccessType(int accessType)
           
 void setAttributes(Properties attributes)
          Set extra attributes on this database connection
 void setChanged(boolean changed)
           
 void setConnectionPoolingProperties(Properties properties)
           
 void setConnectSQL(String sql)
           
 void setDatabaseName(String databaseName)
           
 void setDatabasePortNumberString(String databasePortNumberString)
           
 void setDataTablespace(String dataTablespace)
           
 void setForcingIdentifiersToLowerCase(boolean forceLowerCase)
           
 void setForcingIdentifiersToUpperCase(boolean forceUpperCase)
           
 void setHostname(String hostname)
           
 void setIndexTablespace(String indexTablespace)
           
 void setInitialPoolSize(int initialPoolSize)
           
 void setMaximumPoolSize(int maximumPoolSize)
           
 void setName(String name)
           
 void 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 setQuoteAllFields(boolean quoteAllFields)
           
 void setServername(String servername)
           
 void setStreamingResults(boolean useStreaming)
           
 void setSupportsBooleanDataType(boolean b)
           
 void setUsername(String username)
           
 void setUsingConnectionPool(boolean usePool)
           
 void setUsingDoubleDecimalAsSchemaTableSeparator(boolean useDoubleDecimalSeparator)
           
 boolean supportsAutoInc()
           
 boolean supportsBatchUpdates()
           
 boolean supportsBitmapIndex()
           
 boolean supportsBooleanDataType()
           
 boolean supportsCatalogs()
           
 boolean supportsEmptyTransactions()
           
 boolean supportsErrorHandling()
           
 boolean supportsErrorHandlingOnBatchUpdates()
           
 boolean supportsFloatRoundingOnUpdate()
          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 supportsTimeStampToDateConversion()
           
 boolean supportsTransactions()
           
 boolean supportsViews()
           
 boolean useSafePoints()
           
 boolean useSchemaNameForTableList()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

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

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
Constructor Detail

BaseDatabaseMeta

public BaseDatabaseMeta()
Method Detail

getPluginId

public String getPluginId()
Returns:
plugin ID of this class

setPluginId

public void setPluginId(String pluginId)
Parameters:
pluginId - The plugin ID to set.

getPluginName

public String getPluginName()
Returns:
plugin name of this class

setPluginName

public void setPluginName(String pluginName)
Parameters:
pluginName - The plugin name to set.

getAccessTypeList

public abstract int[] getAccessTypeList()

getAccessType

public int getAccessType()
Returns:
Returns the accessType.

setAccessType

public void setAccessType(int accessType)
Parameters:
accessType - The accessType to set.

isChanged

public boolean isChanged()
Returns:
Returns the changed.

setChanged

public void setChanged(boolean changed)
Parameters:
changed - The changed to set.

getName

public String getName()
Returns:
Returns the connection name.

setName

public void setName(String name)
Parameters:
name - The connection Name to set.

getDatabaseName

public String getDatabaseName()
Returns:
Returns the databaseName.

setDatabaseName

public void setDatabaseName(String databaseName)
Parameters:
databaseName - The databaseName to set.

setDatabasePortNumberString

public void setDatabasePortNumberString(String databasePortNumberString)
Parameters:
databasePortNumberString - The databasePortNumber string to set.

getDatabasePortNumberString

public String getDatabasePortNumberString()
Returns:
Returns the databasePortNumber string.

getHostname

public String getHostname()
Returns:
Returns the hostname.

setHostname

public void setHostname(String hostname)
Parameters:
hostname - The hostname to set.

getObjectId

public ObjectId getObjectId()
Returns:
Returns the id.

setObjectId

public void setObjectId(ObjectId id)
Parameters:
id - The id to set.

getPassword

public String getPassword()
Returns:
Returns the password.

setPassword

public void setPassword(String password)
Parameters:
password - The password to set.

getServername

public String getServername()
Returns:
Returns the servername.

setServername

public void setServername(String servername)
Parameters:
servername - The servername to set.

getDataTablespace

public String getDataTablespace()
Returns:
Returns the tablespaceData.

setDataTablespace

public void setDataTablespace(String dataTablespace)
Parameters:
dataTablespace - The data tablespace to set.

getIndexTablespace

public String getIndexTablespace()
Returns:
Returns the index tablespace.

setIndexTablespace

public void setIndexTablespace(String indexTablespace)
Parameters:
indexTablespace - The index tablespace to set.

getUsername

public String getUsername()
Returns:
Returns the username.

setUsername

public void setUsername(String username)
Parameters:
username - The username to set.

getAttributes

public Properties getAttributes()
Returns:
The extra attributes for this database connection

setAttributes

public void setAttributes(Properties attributes)
Set extra attributes on this database connection

Parameters:
attributes - The extra attributes to set on this database connection.

clone

public Object clone()
Clone the basic settings for this connection!

Overrides:
clone in class Object

getDefaultDatabasePort

public int getDefaultDatabasePort()
Returns:
the default database port number

supportsSetCharacterStream

public boolean supportsSetCharacterStream()
See if this database supports the setCharacterStream() method on a PreparedStatement.

Returns:
true if we can set a Stream on a field in a PreparedStatement. False if not.

supportsAutoInc

public boolean supportsAutoInc()
Returns:
Whether or not the database can use auto increment type of fields (pk)

getLimitClause

public String getLimitClause(int nrRows)

getNotFoundTK

public int getNotFoundTK(boolean use_autoinc)

getSQLNextSequenceValue

public String getSQLNextSequenceValue(String sequenceName)
Get the SQL to get the next value of a sequence. (Oracle/PGSQL only)

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

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.

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...

Returns:
true is setFetchSize() is supported!

needsPlaceHolder

public boolean needsPlaceHolder()
Indicates the need to insert a placeholder (0) for auto increment fields.

Returns:
true if we need a placeholder for auto increment fields in insert statements.

supportsSchemas

public boolean supportsSchemas()
Returns:
true if the database supports schemas

supportsCatalogs

public boolean supportsCatalogs()
Returns:
true if the database supports catalogs

supportsEmptyTransactions

public boolean supportsEmptyTransactions()
Returns:
true when the database engine supports empty transaction. (for example Informix does not on a non-ANSI database type!)

getFunctionSum

public String getFunctionSum()
Returns:
the function for SUM agrregate

getFunctionAverage

public String getFunctionAverage()
Returns:
the function for Average agrregate

getFunctionMinimum

public String getFunctionMinimum()
Returns:
the function for Minimum agrregate

getFunctionMaximum

public String getFunctionMaximum()
Returns:
the function for Maximum agrregate

getFunctionCount

public String getFunctionCount()
Returns:
the function for Count agrregate

getSchemaTableCombination

public String getSchemaTableCombination(String schema_name,
                                        String table_part)
Get the schema-table combination to query the right table. Usually that is SCHEMA.TABLENAME, however there are exceptions to this rule...

Parameters:
schema_name - The schema name
table_part - The tablename
Returns:
the schema-table combination to query the right table.

getBackwardsCompatibleSchemaTableCombination

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

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!)

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.

Returns:
The maximum VARCHAR field length for this database type. (mostly identical to getMaxTextFieldLength() - CLOB_LENGTH)

supportsTransactions

public boolean supportsTransactions()
Returns:
true if the database supports transactions.

supportsSequences

public boolean supportsSequences()
Returns:
true if the database supports sequences

supportsBitmapIndex

public boolean supportsBitmapIndex()
Returns:
true if the database supports bitmap indexes

supportsSetLong

public boolean supportsSetLong()
Returns:
true if the database JDBC driver supports the setLong command

getDropColumnStatement

public String getDropColumnStatement(String tablename,
                                     ValueMetaInterface v,
                                     String tk,
                                     boolean use_autoinc,
                                     String pk,
                                     boolean semicolon)
Generates the SQL statement to drop a column from the specified table

Parameters:
tablename - The table to add
v - The column defined as a value
tk - the name of the technical key field
use_autoinc - whether or not this field uses auto increment
pk - the name of the primary key field
semicolon - 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()
Returns:
an array of reserved words for the database type...

quoteReservedWords

public boolean quoteReservedWords()
Returns:
true if reserved words need to be double quoted ("password", "select", ...)

getStartQuote

public String getStartQuote()
Returns:
The start quote sequence, mostly just double quote, but sometimes [, ...

getEndQuote

public String getEndQuote()
Returns:
The end quote sequence, mostly just double quote, but sometimes ], ...

supportsRepository

public boolean supportsRepository()
Returns:
true if Kettle can create a repository on this type of database.

getTableTypes

public String[] getTableTypes()
Returns:
a list of table types to retrieve tables for the database

getViewTypes

public String[] getViewTypes()
Returns:
a list of table types to retrieve views for the database

getSynonymTypes

public String[] getSynonymTypes()
Returns:
a list of table types to retrieve synonyms for the database

useSchemaNameForTableList

public boolean useSchemaNameForTableList()
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()
Returns:
true if the database supports views

supportsSynonyms

public boolean supportsSynonyms()
Returns:
true if the database supports synonyms

getSQLListOfProcedures

public String getSQLListOfProcedures()
Returns:
The SQL on this database to get a list of stored procedures.

getSQLListOfSequences

public String getSQLListOfSequences()
Returns:
The SQL on this database to get a list of sequences.

getTruncateTableStatement

public String getTruncateTableStatement(String tableName)
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

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.

Returns:
true if the database supports roundinf of floating point data on update/insert

getSQLLockTables

public String getSQLLockTables(String[] tableNames)
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)
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()
Returns:
true if the database supports timestamp to date conversion. For example Interbase doesn't support this!

supportsBatchUpdates

public boolean supportsBatchUpdates()
Returns:
true if the database JDBC driver supports batch updates For example Interbase doesn't support this!

supportsBooleanDataType

public boolean supportsBooleanDataType()
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)
Parameters:
b - Set to true if the database supports a boolean, bit, logical, ... datatype

isDefaultingToUppercase

public boolean isDefaultingToUppercase()
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()
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

Parameters:
databaseTypeCode - The database type code for which the option applies
option - The option to set
value - The value of the option

getExtraOptionSeparator

public String getExtraOptionSeparator()
Returns:
The extra option separator in database URL for this platform (usually this is semicolon ; )

getExtraOptionValueSeparator

public String getExtraOptionValueSeparator()
Returns:
The extra option value separator in database URL for this platform (usually this is the equal sign = )

getExtraOptionIndicator

public String getExtraOptionIndicator()
Returns:
This indicator separates the normal URL from the options

supportsOptionsInURL

public boolean supportsOptionsInURL()
Returns:
true if the database supports connection options in the URL, false if they are put in a Properties object.

getExtraOptionsHelpText

public String getExtraOptionsHelpText()
Returns:
extra help text on the supported options on the selected database platform.

supportsGetBlob

public boolean supportsGetBlob()
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()
Returns:
The SQL to execute right after connecting

setConnectSQL

public void setConnectSQL(String sql)
Parameters:
sql - The SQL to execute right after connecting

supportsSetMaxRows

public boolean supportsSetMaxRows()
Returns:
true if the database supports setting the maximum number of return rows in a resultset.

isUsingConnectionPool

public boolean isUsingConnectionPool()
Returns:
true if we want to use a database connection pool

setUsingConnectionPool

public void setUsingConnectionPool(boolean usePool)
Parameters:
usePool - true if we want to use a database connection pool

getMaximumPoolSize

public int getMaximumPoolSize()
Returns:
the maximum pool size

setMaximumPoolSize

public void setMaximumPoolSize(int maximumPoolSize)
Parameters:
maximumPoolSize - the maximum pool size

getInitialPoolSize

public int getInitialPoolSize()
Returns:
the initial pool size

setInitialPoolSize

public void setInitialPoolSize(int initialPoolSize)
Parameters:
initialPoolSize - the initial pool size

isPartitioned

public boolean isPartitioned()
Returns:
true if we want to use a database connection pool

setPartitioned

public void setPartitioned(boolean clustered)
Parameters:
usePool - true if we want to use a database connection pool

getPartitioningInformation

public PartitionDatabaseMeta[] getPartitioningInformation()
Returns:
the available partition/host/databases/port combinations in the cluster

setPartitioningInformation

public void setPartitioningInformation(PartitionDatabaseMeta[] clusterInfo)
Parameters:
clusterInfo - the available partition/host/databases/port combinations in the cluster

getConnectionPoolingProperties

public Properties getConnectionPoolingProperties()
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)

getSQLTableExists

public String getSQLTableExists(String tablename)

getSQLColumnExists

public String getSQLColumnExists(String columnname,
                                 String tablename)

needsToLockAllTables

public boolean needsToLockAllTables()

isStreamingResults

public boolean isStreamingResults()
Returns:
true if the database is streaming results (normally this is an option just for MySQL).

setStreamingResults

public void setStreamingResults(boolean useStreaming)
Parameters:
useStreaming - true if we want the database to stream results (normally this is an option just for MySQL).

isQuoteAllFields

public boolean isQuoteAllFields()
Returns:
true if all fields should always be quoted in db

setQuoteAllFields

public void setQuoteAllFields(boolean quoteAllFields)
Parameters:
useStreaming - true if we want the database to stream results (normally this is an option just for MySQL).

isForcingIdentifiersToLowerCase

public boolean isForcingIdentifiersToLowerCase()
Returns:
true if all identifiers should be forced to lower case

setForcingIdentifiersToLowerCase

public void setForcingIdentifiersToLowerCase(boolean forceLowerCase)
Parameters:
forceLowerCase - true if all identifiers should be forced to lower case

isForcingIdentifiersToUpperCase

public boolean isForcingIdentifiersToUpperCase()
Returns:
true if all identifiers should be forced to upper case

setForcingIdentifiersToUpperCase

public void setForcingIdentifiersToUpperCase(boolean forceUpperCase)
Parameters:
forceLowerCase - true if all identifiers should be forced to upper case

isUsingDoubleDecimalAsSchemaTableSeparator

public boolean isUsingDoubleDecimalAsSchemaTableSeparator()
Returns:
true if we use a double decimal separator to specify schema/table combinations on MS-SQL server

setUsingDoubleDecimalAsSchemaTableSeparator

public void setUsingDoubleDecimalAsSchemaTableSeparator(boolean useDoubleDecimalSeparator)
Parameters:
useDoubleDecimalSeparator - true if we should use a double decimal separator to specify schema/table combinations on MS-SQL server

isRequiringTransactionsOnQueries

public boolean isRequiringTransactionsOnQueries()
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.

Returns:
the name of the database test factory to use.

getPreferredSchemaName

public String getPreferredSchemaName()
Returns:
The preferred schema name of this database connection.

setPreferredSchemaName

public void setPreferredSchemaName(String preferredSchemaName)
Parameters:
preferredSchemaName - The preferred schema name of this database connection.

checkIndexExists

public boolean checkIndexExists(Database database,
                                String schemaName,
                                String tableName,
                                String[] idx_fields)
                         throws KettleDatabaseException
Verifies on the specified database connection if an index exists on the fields with the specified name.

Parameters:
database - a connected database
schemaName -
tableName -
idxFields -
Returns:
true if the index exists, false if it doesn't.
Throws:
KettleException
KettleDatabaseException

supportsSequenceNoMaxValueOption

public boolean supportsSequenceNoMaxValueOption()
Returns:
true if the database supports the NOMAXVALUE sequence option. The default is false, AS/400 and DB2 support this.

requiresCreateTablePrimaryKeyAppend

public boolean requiresCreateTablePrimaryKeyAppend()
Returns:
true if we need to append the PRIMARY KEY block in the create table block after the fields, required for Caché.

requiresCastToVariousForIsNull

public boolean requiresCastToVariousForIsNull()
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()
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.

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()
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)
Parameters:
tableName -
Returns:
true if the specified table is a system table

supportsNewLinesInSQL

public boolean supportsNewLinesInSQL()
Returns:
true if the database supports newlines in a SQL statements.

getSQLListOfSchemas

public String getSQLListOfSchemas()
Returns:
the SQL to retrieve the list of schemas or null if the JDBC metadata needs to be used.

getMaxColumnsInIndex

public int getMaxColumnsInIndex()
Returns:
The maximum number of columns in a database, <=0 means: no known limit

supportsErrorHandlingOnBatchUpdates

public boolean supportsErrorHandlingOnBatchUpdates()
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.

Parameters:
schemaTable - the schema-table name to insert into
keyField - The key field
versionField - the version field
Returns:
the SQL to insert the unknown record into the SCD.

isExplorable

public boolean isExplorable()
Returns:
true if this is a relational database you can explore. Return false for SAP, PALO, etc.

getXulOverlayFile

public String getXulOverlayFile()
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)
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.

Parameters:
tableName -
Returns:

generateColumnAlias

public String generateColumnAlias(int columnIndex,
                                  String suggestedName)

parseStatements

public List<String> parseStatements(String sqlScript)
Parse all possible statements from the provided SQL script.

Parameters:
sqlScript - Raw SQL Script to be parsed into executable statements.
Returns:
List of parsed SQL statements to be executed separately.

isMySQLVariant

public boolean isMySQLVariant()
Returns:
true if the database is a MySQL variant, like MySQL 5.1, InfiniDB, InfoBright, and so on.

releaseSavepoint

public boolean releaseSavepoint()
Returns a true of savepoints can be released, false if not.

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
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.

Parameters:
VariableSpace - variables used for possible substitution
DatabaseMeta - 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.

Parameters:
VariableSpace - variables used for possible substitution
DatabaseMeta - 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:
VariableSpace - 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.
String - 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.

Parameters:
resultSet - The result set to use
valueMeta - The description of the value to retrieve
index - 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()
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()
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.