Package org.pentaho.di.core.database
Class GenericDatabaseMeta
java.lang.Object
org.pentaho.di.core.database.BaseDatabaseMeta
org.pentaho.di.core.database.GenericDatabaseMeta
- All Implemented Interfaces:
Cloneable,DatabaseInterface,DatabaseInterfaceExtended
- Direct Known Subclasses:
RemedyActionRequestSystemDatabaseMeta
Contains Generic Database Connection information through static final members
- Since:
- 11-mrt-2005
- Author:
- Matt
-
Field Summary
FieldsFields inherited from class org.pentaho.di.core.database.BaseDatabaseMeta
ATTRIBUTE_CLUSTER_DBNAME_PREFIX, ATTRIBUTE_CLUSTER_HOSTNAME_PREFIX, ATTRIBUTE_CLUSTER_PASSWORD_PREFIX, ATTRIBUTE_CLUSTER_PORT_PREFIX, ATTRIBUTE_CLUSTER_USERNAME_PREFIX, ATTRIBUTE_FORCE_IDENTIFIERS_TO_LOWERCASE, ATTRIBUTE_FORCE_IDENTIFIERS_TO_UPPERCASE, ATTRIBUTE_INITIAL_POOL_SIZE, ATTRIBUTE_IS_CLUSTERED, ATTRIBUTE_MAXIMUM_POOL_SIZE, ATTRIBUTE_MSSQL_DOUBLE_DECIMAL_SEPARATOR, ATTRIBUTE_POOLING_PARAMETER_PREFIX, ATTRIBUTE_PORT_NUMBER, ATTRIBUTE_PREFERRED_SCHEMA_NAME, ATTRIBUTE_PREFIX_EXTRA_OPTION, ATTRIBUTE_PRESERVE_RESERVED_WORD_CASE, ATTRIBUTE_QUOTE_ALL_FIELDS, ATTRIBUTE_SQL_CONNECT, ATTRIBUTE_SUPPORTS_BOOLEAN_DATA_TYPE, ATTRIBUTE_SUPPORTS_TIMESTAMP_DATA_TYPE, ATTRIBUTE_USE_POOLING, ATTRIBUTE_USE_RESULT_STREAMING, AUTOINCREMENT_SQL_FOR_BATCH_ID, NAMED_CLUSTER_ID, poolingParameters, releaseSavepoint, SELECT_COUNT_STATEMENT, SEQUENCE_FOR_BATCH_ID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttribute(String attributeId, String value) Add extra attribute on this connectionvoidaddExtraOption(String databaseTypeCode, String option, String value) Add an extra option to the attributes listcustomizeValueFromSQLType(ValueMetaInterface v, ResultSetMetaData rm, int index) Customizes the ValueMetaInterface defined in the basegenerateColumnAlias(int columnIndex, String suggestedName) Generate a column alias given the column index and suggested name.int[]Get the list of possible access types for a database.getAddColumnStatement(String tablename, ValueMetaInterface v, String tk, boolean useAutoinc, String pk, boolean semicolon) Generates the SQL statement to add a column to the specified table For this generic type, i set it to the most common possibility.Customizes the ValueMetaInterface defined in the baseprotected DatabaseInterfaceObtain the name of the JDBC driver class that we need to use!getDropColumnStatement(String tablename, ValueMetaInterface v, String tk, boolean useAutoinc, String pk, boolean semicolon) Generates the SQL statement to drop a column from the specified tablegetFieldDefinition(ValueMetaInterface v, String tk, String pk, boolean useAutoinc, boolean addFieldName, boolean addCr) Describe a Value as a field in the database.getLimitClause(int nrRows) intintGet the maximum length of a text field for this database connection.intGet the maximum length of a text field (VARCHAR) for this database connection.getModifyColumnStatement(String tablename, ValueMetaInterface v, String tk, boolean useAutoinc, String pk, boolean semicolon) Generates the SQL statement to modify a column in the specified tableintgetNotFoundTK(boolean useAutoinc) Get the not found technical key.String[]getSafeFieldname(String fieldName) Sanitize a string for usage as a field name Append an underscore to any field name that matches a reserved word Replaces spaces with underscores Prefixes a string with underscore that begins with a numbergetSchemaTableCombination(String schemaName, String tablePart) Get the schema-table combination to query the right table.getSelectCountStatement(String tableName) Build the SQL to count the number of rows in the passed table.getSQLColumnExists(String columnname, String tablename) getSQLInsertAutoIncUnknownDimensionRow(String schemaTable, String keyField, String versionField) Get the SQL to insert a new empty unknown record in a dimension.getSQLLockTables(String[] tableNames) getSQLQueryFields(String tableName) Returns the minimal SQL to launch in order to determine the layout of the resultset for a given database tablegetSQLTableExists(String tableName) getSQLUnlockTables(String[] tableName) getSQLValue(ValueMetaInterface valueMeta, Object valueData, String dateFormat) Convert a value in the SQL equivalent.String[]String[]getTruncateTableStatement(String tableName) String[]String[]booleanbooleanbooleanbooleanChecks whether or not the command setFetchSize() is supported by the JDBC driver...booleanbooleanbooleanbooleanbooleanbooleanisSystemTable(String tableName) booleanbooleanbooleanbooleanquoteSQLString(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.booleanbooleanprotected voidresolveDialect(String dialectName) voidsetDatabaseDialect(String databaseDialect) voidsetForcingIdentifiersToLowerCase(boolean forceUpperCase) voidsetForcingIdentifiersToUpperCase(boolean forceUpperCase) voidsetPreserveReservedCase(boolean b) voidsetQuoteAllFields(boolean quoteAllFields) voidsetStreamingResults(boolean useStreaming) voidsetSupportsBooleanDataType(boolean b) voidsetSupportsTimestampDataType(boolean b) voidsetUsingDoubleDecimalAsSchemaTableSeparator(boolean useDoubleDecimalSeparator) booleanbooleanbooleanbooleanbooleanMost databases round number(7,2) 17.29999999 to 17.30, but some don't.booleanbooleanbooleanbooleanMost databases allow you to retrieve result metadata by preparing a SELECT statement.booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanMethods inherited from class org.pentaho.di.core.database.BaseDatabaseMeta
addDefaultOptions, canTest, checkIndexExists, clone, fullExceptionLog, getAccessType, getAttribute, getAttributes, getBackwardsCompatibleSchemaTableCombination, getBackwardsCompatibleTable, getConnectionPoolingProperties, getConnectSQL, getDatabaseFactoryName, getDatabaseName, getDatabasePortNumberString, getDataTablespace, getDataTablespaceDDL, getDefaultDatabasePort, getDisplayName, getDropTableIfExistsStatement, getFieldnameProtector, getHostname, getIndexTablespace, getIndexTablespaceDDL, getInitialPoolSize, getInitialPoolSizeString, getMaximumPoolSize, getMaximumPoolSizeString, getName, getNamedCluster, getNextBatchId, getNextBatchIdUsingAutoIncSQL, getNextBatchIdUsingLockTables, getNextBatchIdUsingSequence, getObjectId, getPartitioningInformation, getPassword, getPluginId, getPluginName, getPreferredSchemaName, getServername, getSQLCurrentSequenceValue, getSQLListOfProcedures, getSQLListOfSequences, getSQLNextSequenceValue, getSqlScriptStatements, getSQLSequenceExists, getTablespaceDDL, getUsername, getValueFromResultSet, getXulOverlayFile, isChanged, isPartitioned, isRequiringTransactionsOnQueries, isUsingConnectionPool, needsPlaceHolder, onlySpaces, parseStatements, releaseSavepoint, requiresName, setAccessType, setAttributes, setChanged, setConnectionPoolingProperties, setConnectSQL, setDatabaseName, setDatabasePortNumberString, setDataTablespace, setDisplayName, setHostname, setIndexTablespace, setInitialPoolSize, setInitialPoolSizeString, setMaximumPoolSize, setMaximumPoolSizeString, setName, setNamedCluster, setObjectId, setPartitioned, setPartitioningInformation, setPassword, setPluginId, setPluginName, setPreferredSchemaName, setServername, setUsername, setUsingConnectionPool, supportsAutoInc, supportsCatalogs, supportsEmptyTransactions, supportsErrorHandling, supportsErrorHandlingOnBatchUpdates, supportsRepository, supportsSchemas, supportsSequences, supportsSetCharacterStream, supportsSetLong, supportsTransactions, useSafePointsMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.pentaho.di.core.database.DatabaseInterface
addDefaultOptions, checkIndexExists, clone, createSqlScriptParser, getAccessType, getAttribute, getAttributes, getConnectionPoolingProperties, getConnectSQL, getDatabaseFactoryName, getDatabaseName, getDatabasePortNumberString, getDataTablespace, getDataTablespaceDDL, getDefaultDatabasePort, getDisplayName, getHostname, getIndexTablespace, getIndexTablespaceDDL, getInitialPoolSize, getInitialPoolSizeString, getLegacyColumnName, getMaximumPoolSize, getMaximumPoolSizeString, getName, getNamedCluster, getNamedClusterList, getNextBatchId, getObjectId, getPartitioningInformation, getPassword, getPluginId, getPluginName, getPreferredSchemaName, getSchemas, getServername, getSQLCurrentSequenceValue, getSQLListOfProcedures, getSQLListOfSchemas, getSQLListOfSequences, getSQLNextSequenceValue, getSqlScriptStatements, getSQLSequenceExists, getTables, getUnsupportedTableOutputMessage, getUsername, getValueFromResultSet, getXulOverlayFile, isChanged, isPartitioned, isRequiringTransactionsOnQueries, isUsingConnectionPool, needsPlaceHolder, parseStatements, putOptionalOptions, releaseSavepoint, setAccessType, setAttributes, setChanged, setConnectionPoolingProperties, setConnectSQL, setDatabaseName, setDatabasePortNumberString, setDataTablespace, setDisplayName, setHostname, setIndexTablespace, setInitialPoolSize, setInitialPoolSizeString, setMaximumPoolSize, setMaximumPoolSizeString, setName, setNamedCluster, setObjectId, setPartitioned, setPartitioningInformation, setPassword, setPluginId, setPluginName, setPreferredSchemaName, setServername, setUsername, setUsingConnectionPool, supportsAutoInc, supportsCatalogs, supportsEmptyTransactions, supportsErrorHandling, supportsErrorHandlingOnBatchUpdates, supportsIndexes, supportsRepository, supportsSchemas, supportsSequences, supportsSetCharacterStream, supportsSetLong, supportsStandardTableOutput, supportsTransactions, useSafePoints
-
Field Details
-
ATRRIBUTE_CUSTOM_URL
- See Also:
-
ATRRIBUTE_CUSTOM_DRIVER_CLASS
- See Also:
-
DATABASE_DIALECT_ID
- See Also:
-
-
Constructor Details
-
GenericDatabaseMeta
public GenericDatabaseMeta()
-
-
Method Details
-
addAttribute
Description copied from interface:DatabaseInterfaceAdd extra attribute on this connection- Specified by:
addAttributein interfaceDatabaseInterface- Overrides:
addAttributein classBaseDatabaseMeta- Parameters:
attributeId- the attribute identifiervalue- the value of the attribute
-
getAccessTypeList
public int[] getAccessTypeList()Description copied from interface:DatabaseInterfaceGet the list of possible access types for a database.- Specified by:
getAccessTypeListin interfaceDatabaseInterface- Specified by:
getAccessTypeListin classBaseDatabaseMeta- Returns:
- the list of possible access types for a database.
-
getNotFoundTK
public int getNotFoundTK(boolean useAutoinc) Description copied from interface:DatabaseInterfaceGet the not found technical key.- Specified by:
getNotFoundTKin interfaceDatabaseInterface- Overrides:
getNotFoundTKin classBaseDatabaseMeta- 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.
- See Also:
-
getDriverClass
Description copied from interface:DatabaseInterfaceObtain the name of the JDBC driver class that we need to use!- Specified by:
getDriverClassin interfaceDatabaseInterface- Returns:
- the name of the JDBC driver class for the specific database
-
getURL
- Specified by:
getURLin interfaceDatabaseInterface- Parameters:
hostname- the hostnameport- the port as a stringdatabaseName- the database name- Returns:
- the URL to use for connecting to the database.
-
isFetchSizeSupported
public boolean isFetchSizeSupported()Checks whether or not the command setFetchSize() is supported by the JDBC driver...- Specified by:
isFetchSizeSupportedin interfaceDatabaseInterface- Overrides:
isFetchSizeSupportedin classBaseDatabaseMeta- Returns:
- true is setFetchSize() is supported!
-
supportsBitmapIndex
public boolean supportsBitmapIndex()- Specified by:
supportsBitmapIndexin interfaceDatabaseInterface- Overrides:
supportsBitmapIndexin classBaseDatabaseMeta- Returns:
- true if the database supports bitmap indexes
-
getTruncateTableStatement
- Specified by:
getTruncateTableStatementin interfaceDatabaseInterface- Overrides:
getTruncateTableStatementin classBaseDatabaseMeta- Parameters:
tableName- The table to be truncated.- Returns:
- The SQL statement to truncate a table: remove all rows from it without a transaction
-
getAddColumnStatement
public String getAddColumnStatement(String tablename, ValueMetaInterface v, String tk, boolean useAutoinc, String pk, boolean semicolon) Generates the SQL statement to add a column to the specified table For this generic type, i set it to the most common possibility.- Specified by:
getAddColumnStatementin 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 add a column to the specified table
-
getModifyColumnStatement
public String getModifyColumnStatement(String tablename, ValueMetaInterface v, String tk, boolean useAutoinc, String pk, boolean semicolon) Generates the SQL statement to modify a column in the specified table- Specified by:
getModifyColumnStatementin 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 modify a column in the specified table
-
getFieldDefinition
public String getFieldDefinition(ValueMetaInterface v, String tk, String pk, boolean useAutoinc, boolean addFieldName, boolean addCr) Description copied from interface:DatabaseInterfaceDescribe a Value as a field in the database.- Specified by:
getFieldDefinitionin interfaceDatabaseInterface- Parameters:
v- The value to describetk- The field that's going to be the technical keypk- The field that's going to be the primary keyuseAutoinc- Use autoincrement or notaddFieldName- Add the fieldname to the definition or notaddCr- Add a cariage return at the end of the definition or not.- Returns:
- a value described as a field in this database.
-
getUsedLibraries
- Specified by:
getUsedLibrariesin interfaceDatabaseInterface- Returns:
- the required libraries (in lib) for this database connection.
-
supportsPreparedStatementMetadataRetrieval
public boolean supportsPreparedStatementMetadataRetrieval()Most databases allow you to retrieve result metadata by preparing a SELECT statement.- Specified by:
supportsPreparedStatementMetadataRetrievalin interfaceDatabaseInterface- Overrides:
supportsPreparedStatementMetadataRetrievalin classBaseDatabaseMeta- Returns:
- true if the database supports retrieval of query metadata from a prepared statement. False if the query needs to be executed first.
-
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- Overrides:
getSQLInsertAutoIncUnknownDimensionRowin classBaseDatabaseMeta- 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.
-
setDatabaseDialect
-
getDatabaseDialect
-
getDatabaseDialectInternal
-
resolveDialect
-
getReservedWords
- Specified by:
getReservedWordsin interfaceDatabaseInterface- Overrides:
getReservedWordsin classBaseDatabaseMeta- Returns:
- an array of reserved words for the database type...
-
getEndQuote
- Specified by:
getEndQuotein interfaceDatabaseInterface- Overrides:
getEndQuotein classBaseDatabaseMeta- Returns:
- The end quote sequence, mostly just double quote, but sometimes ], ...
-
getFunctionSum
- Specified by:
getFunctionSumin interfaceDatabaseInterface- Overrides:
getFunctionSumin classBaseDatabaseMeta- Returns:
- the function for SUM agrregate
-
getFunctionAverage
- Specified by:
getFunctionAveragein interfaceDatabaseInterface- Overrides:
getFunctionAveragein classBaseDatabaseMeta- Returns:
- the function for Average agrregate
-
getFunctionMinimum
- Specified by:
getFunctionMinimumin interfaceDatabaseInterface- Overrides:
getFunctionMinimumin classBaseDatabaseMeta- Returns:
- the function for Minimum agrregate
-
getFunctionMaximum
- Specified by:
getFunctionMaximumin interfaceDatabaseInterface- Overrides:
getFunctionMaximumin classBaseDatabaseMeta- Returns:
- the function for Maximum agrregate
-
getFunctionCount
- Specified by:
getFunctionCountin interfaceDatabaseInterface- Overrides:
getFunctionCountin classBaseDatabaseMeta- Returns:
- the function for Count agrregate
-
getSQLQueryFields
Description copied from class:BaseDatabaseMetaReturns the minimal SQL to launch in order to determine the layout of the resultset for a given database table- Specified by:
getSQLQueryFieldsin interfaceDatabaseInterface- Overrides:
getSQLQueryFieldsin classBaseDatabaseMeta- Parameters:
tableName- The name of the table to determine the layout for- Returns:
- The SQL to launch.
-
getSQLColumnExists
- Specified by:
getSQLColumnExistsin interfaceDatabaseInterface- Overrides:
getSQLColumnExistsin classBaseDatabaseMeta- 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.
-
getSQLTableExists
- Specified by:
getSQLTableExistsin interfaceDatabaseInterface- Overrides:
getSQLTableExistsin classBaseDatabaseMeta- 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.
-
getLimitClause
- Specified by:
getLimitClausein interfaceDatabaseInterface- Overrides:
getLimitClausein classBaseDatabaseMeta- 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
-
getSelectCountStatement
Description copied from class:BaseDatabaseMetaBuild the SQL to count the number of rows in the passed table.- Specified by:
getSelectCountStatementin interfaceDatabaseInterface- Overrides:
getSelectCountStatementin classBaseDatabaseMeta- Returns:
-
getSQLUnlockTables
- Specified by:
getSQLUnlockTablesin interfaceDatabaseInterface- Overrides:
getSQLUnlockTablesin classBaseDatabaseMeta- Parameters:
tableName- 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
-
getSequenceNoMaxValueOption
- Specified by:
getSequenceNoMaxValueOptionin interfaceDatabaseInterface- Overrides:
getSequenceNoMaxValueOptionin classBaseDatabaseMeta- Returns:
- string with the no max value sequence option.
-
useSchemaNameForTableList
public boolean useSchemaNameForTableList()- Specified by:
useSchemaNameForTableListin interfaceDatabaseInterface- Overrides:
useSchemaNameForTableListin classBaseDatabaseMeta- 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- Overrides:
supportsViewsin classBaseDatabaseMeta- Returns:
- true if the database supports views
-
supportsTimeStampToDateConversion
public boolean supportsTimeStampToDateConversion()- Specified by:
supportsTimeStampToDateConversionin interfaceDatabaseInterface- Overrides:
supportsTimeStampToDateConversionin classBaseDatabaseMeta- Returns:
- true if the database supports timestamp to date conversion. For example Interbase doesn't support this!
-
getCreateTableStatement
Description copied from class:BaseDatabaseMetaCustomizes the ValueMetaInterface defined in the base- Specified by:
getCreateTableStatementin interfaceDatabaseInterface- Overrides:
getCreateTableStatementin classBaseDatabaseMeta- Returns:
- String the create table statement
-
supportsAutoGeneratedKeys
public boolean supportsAutoGeneratedKeys()- Specified by:
supportsAutoGeneratedKeysin interfaceDatabaseInterface- Overrides:
supportsAutoGeneratedKeysin classBaseDatabaseMeta- Returns:
- true if the database supports autoGeneratedKeys
-
getSafeFieldname
Description copied from class:BaseDatabaseMetaSanitize 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- Overrides:
getSafeFieldnamein classBaseDatabaseMeta- Parameters:
fieldName- value to sanitize- Returns:
- a String safe for usage as a column name without the need for quoting
-
setSupportsTimestampDataType
public void setSupportsTimestampDataType(boolean b) - Specified by:
setSupportsTimestampDataTypein interfaceDatabaseInterface- Overrides:
setSupportsTimestampDataTypein classBaseDatabaseMeta- Parameters:
b- Set to true if the database supports the Timestamp data type (nanosecond precision and all)
-
supportsTimestampDataType
public boolean supportsTimestampDataType()- Specified by:
supportsTimestampDataTypein interfaceDatabaseInterface- Overrides:
supportsTimestampDataTypein classBaseDatabaseMeta- Returns:
- true if the database supports the Timestamp data type (nanosecond precision and all)
-
supportsResultSetMetadataRetrievalOnly
public boolean supportsResultSetMetadataRetrievalOnly()- Specified by:
supportsResultSetMetadataRetrievalOnlyin interfaceDatabaseInterface- Overrides:
supportsResultSetMetadataRetrievalOnlyin classBaseDatabaseMeta- Returns:
- true if this database only supports metadata retrieval on a result set, never on a statement (even if the statement has been executed)
-
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- Overrides:
getSQLValuein classBaseDatabaseMeta- 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.
-
customizeValueFromSQLType
public ValueMetaInterface customizeValueFromSQLType(ValueMetaInterface v, ResultSetMetaData rm, int index) throws SQLException Description copied from class:BaseDatabaseMetaCustomizes the ValueMetaInterface defined in the base- Specified by:
customizeValueFromSQLTypein interfaceDatabaseInterface- Overrides:
customizeValueFromSQLTypein classBaseDatabaseMeta- Parameters:
v- the determined valueMetaInterfacerm- the sql resultindex- the index to the column- Returns:
- ValueMetaInterface customized with the data base specific types
- Throws:
SQLException
-
isMySQLVariant
public boolean isMySQLVariant()- Specified by:
isMySQLVariantin interfaceDatabaseInterface- Overrides:
isMySQLVariantin classBaseDatabaseMeta- Returns:
- true if the database is a MySQL variant, like MySQL 5.1, InfiniDB, InfoBright, and so on.
-
generateColumnAlias
Description copied from interface:DatabaseInterfaceGenerate a column alias given the column index and suggested name.- Specified by:
generateColumnAliasin interfaceDatabaseInterface- Overrides:
generateColumnAliasin classBaseDatabaseMeta- Parameters:
columnIndex- Index of column in querysuggestedName- Suggested column name- Returns:
- Column alias that is valid for this database
-
quoteSQLString
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- Overrides:
quoteSQLStringin classBaseDatabaseMeta- Returns:
- A string that is properly quoted for use in a SQL statement (insert, update, delete, etc)
-
isExplorable
public boolean isExplorable()- Specified by:
isExplorablein interfaceDatabaseInterface- Overrides:
isExplorablein classBaseDatabaseMeta- Returns:
- true if this is a relational database you can explore. Return false for SAP, PALO, etc.
-
getMaxColumnsInIndex
public int getMaxColumnsInIndex()- Specified by:
getMaxColumnsInIndexin interfaceDatabaseInterface- Overrides:
getMaxColumnsInIndexin classBaseDatabaseMeta- Returns:
- The maximum number of columns in a database, <=0 means: no known limit
-
getSQLListOfSchemas
- Specified by:
getSQLListOfSchemasin interfaceDatabaseInterface- Overrides:
getSQLListOfSchemasin classBaseDatabaseMeta- Returns:
- the SQL to retrieve the list of schemas or null if the JDBC metadata needs to be used.
-
supportsNewLinesInSQL
public boolean supportsNewLinesInSQL()- Specified by:
supportsNewLinesInSQLin interfaceDatabaseInterface- Overrides:
supportsNewLinesInSQLin classBaseDatabaseMeta- Returns:
- true if the database supports newlines in a SQL statements.
-
isSystemTable
- Specified by:
isSystemTablein interfaceDatabaseInterface- Overrides:
isSystemTablein classBaseDatabaseMeta- Returns:
- true if the specified table is a system table
-
isDisplaySizeTwiceThePrecision
public boolean isDisplaySizeTwiceThePrecision()- Specified by:
isDisplaySizeTwiceThePrecisionin interfaceDatabaseInterface- Overrides:
isDisplaySizeTwiceThePrecisionin classBaseDatabaseMeta- Returns:
- Handles the special case of DB2 where the display size returned is twice the precision. In that case, the length is the precision.
-
requiresCastToVariousForIsNull
public boolean requiresCastToVariousForIsNull()- Specified by:
requiresCastToVariousForIsNullin interfaceDatabaseInterface- Overrides:
requiresCastToVariousForIsNullin classBaseDatabaseMeta- Returns:
- true if the database requires you to cast a parameter to varchar before comparing to null. Only required for DB2 and Vertica
-
requiresCreateTablePrimaryKeyAppend
public boolean requiresCreateTablePrimaryKeyAppend()- Specified by:
requiresCreateTablePrimaryKeyAppendin interfaceDatabaseInterface- Overrides:
requiresCreateTablePrimaryKeyAppendin classBaseDatabaseMeta- Returns:
- true if we need to append the PRIMARY KEY block in the create table block after the fields, required for Cache.
-
supportsSequenceNoMaxValueOption
public boolean supportsSequenceNoMaxValueOption()- Specified by:
supportsSequenceNoMaxValueOptionin interfaceDatabaseInterface- Overrides:
supportsSequenceNoMaxValueOptionin classBaseDatabaseMeta- Returns:
- true if the database supports the NOMAXVALUE sequence option. The default is false, AS/400 and DB2 support this.
-
setUsingDoubleDecimalAsSchemaTableSeparator
public void setUsingDoubleDecimalAsSchemaTableSeparator(boolean useDoubleDecimalSeparator) - Specified by:
setUsingDoubleDecimalAsSchemaTableSeparatorin interfaceDatabaseInterface- Overrides:
setUsingDoubleDecimalAsSchemaTableSeparatorin classBaseDatabaseMeta- Parameters:
useDoubleDecimalSeparator- true if we should use a double decimal separator to specify schema/table combinations on MS-SQL server
-
isUsingDoubleDecimalAsSchemaTableSeparator
public boolean isUsingDoubleDecimalAsSchemaTableSeparator()- Specified by:
isUsingDoubleDecimalAsSchemaTableSeparatorin interfaceDatabaseInterface- Overrides:
isUsingDoubleDecimalAsSchemaTableSeparatorin classBaseDatabaseMeta- Returns:
- true if we use a double decimal separator to specify schema/table combinations on MS-SQL server
-
setForcingIdentifiersToUpperCase
public void setForcingIdentifiersToUpperCase(boolean forceUpperCase) - Specified by:
setForcingIdentifiersToUpperCasein interfaceDatabaseInterface- Overrides:
setForcingIdentifiersToUpperCasein classBaseDatabaseMeta- Parameters:
forceUpperCase- true if all identifiers should be forced to upper case
-
isForcingIdentifiersToUpperCase
public boolean isForcingIdentifiersToUpperCase()- Specified by:
isForcingIdentifiersToUpperCasein interfaceDatabaseInterface- Overrides:
isForcingIdentifiersToUpperCasein classBaseDatabaseMeta- Returns:
- true if all identifiers should be forced to upper case
-
setForcingIdentifiersToLowerCase
public void setForcingIdentifiersToLowerCase(boolean forceUpperCase) - Specified by:
setForcingIdentifiersToLowerCasein interfaceDatabaseInterface- Overrides:
setForcingIdentifiersToLowerCasein classBaseDatabaseMeta- Parameters:
forceUpperCase- true if all identifiers should be forced to lower case
-
isForcingIdentifiersToLowerCase
public boolean isForcingIdentifiersToLowerCase()- Specified by:
isForcingIdentifiersToLowerCasein interfaceDatabaseInterface- Overrides:
isForcingIdentifiersToLowerCasein classBaseDatabaseMeta- Returns:
- true if all identifiers should be forced to lower case
-
setQuoteAllFields
public void setQuoteAllFields(boolean quoteAllFields) - Specified by:
setQuoteAllFieldsin interfaceDatabaseInterface- Overrides:
setQuoteAllFieldsin classBaseDatabaseMeta- Parameters:
quoteAllFields- 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- Overrides:
isQuoteAllFieldsin classBaseDatabaseMeta- Returns:
- true if all fields should always be quoted in db
-
setStreamingResults
public void setStreamingResults(boolean useStreaming) - Specified by:
setStreamingResultsin interfaceDatabaseInterface- Overrides:
setStreamingResultsin classBaseDatabaseMeta- Parameters:
useStreaming- true if we want the database to stream results (normally this is an option just for MySQL).
-
isStreamingResults
public boolean isStreamingResults()- Specified by:
isStreamingResultsin interfaceDatabaseInterface- Overrides:
isStreamingResultsin classBaseDatabaseMeta- Returns:
- true if the database is streaming results (normally this is an option just for MySQL).
-
needsToLockAllTables
public boolean needsToLockAllTables()- Specified by:
needsToLockAllTablesin interfaceDatabaseInterface- Overrides:
needsToLockAllTablesin classBaseDatabaseMeta- Returns:
- true if the database needs all repository tables to be locked, not just one ref table (R_REPOSITORY_LOG)
-
supportsSetMaxRows
public boolean supportsSetMaxRows()- Specified by:
supportsSetMaxRowsin interfaceDatabaseInterface- Overrides:
supportsSetMaxRowsin classBaseDatabaseMeta- Returns:
- true if the database supports setting the maximum number of return rows in a resultset.
-
supportsGetBlob
public boolean supportsGetBlob()- Specified by:
supportsGetBlobin interfaceDatabaseInterface- Overrides:
supportsGetBlobin classBaseDatabaseMeta- Returns:
- true if the database JDBC driver supports getBlob on the resultset. If not we must use getBytes() to get the data.
-
isDefaultingToUppercase
public boolean isDefaultingToUppercase()- Specified by:
isDefaultingToUppercasein interfaceDatabaseInterface- Overrides:
isDefaultingToUppercasein classBaseDatabaseMeta- Returns:
- true if the database defaults to naming tables and fields in uppercase. True for most databases except for stuborn stuff like Postgres ;-)
-
setPreserveReservedCase
public void setPreserveReservedCase(boolean b) - Specified by:
setPreserveReservedCasein interfaceDatabaseInterface- Overrides:
setPreserveReservedCasein classBaseDatabaseMeta- Parameters:
b- Set to true if reserved words' case should be preserved
-
preserveReservedCase
public boolean preserveReservedCase()- Specified by:
preserveReservedCasein interfaceDatabaseInterface- Overrides:
preserveReservedCasein classBaseDatabaseMeta- Returns:
- true if reserved words' case should be preserved
-
setSupportsBooleanDataType
public void setSupportsBooleanDataType(boolean b) - Specified by:
setSupportsBooleanDataTypein interfaceDatabaseInterface- Overrides:
setSupportsBooleanDataTypein classBaseDatabaseMeta- Parameters:
b- Set to true if the database supports a boolean, bit, logical, ... datatype
-
supportsBooleanDataType
public boolean supportsBooleanDataType()- Specified by:
supportsBooleanDataTypein interfaceDatabaseInterface- Overrides:
supportsBooleanDataTypein classBaseDatabaseMeta- Returns:
- true if the database supports a boolean, bit, logical, ... datatype The default is false: map to a string.
-
supportsBatchUpdates
public boolean supportsBatchUpdates()- Specified by:
supportsBatchUpdatesin interfaceDatabaseInterface- Overrides:
supportsBatchUpdatesin classBaseDatabaseMeta- Returns:
- true if the database JDBC driver supports batch updates For example Interbase doesn't support this!
-
getSQLLockTables
- Specified by:
getSQLLockTablesin interfaceDatabaseInterface- Overrides:
getSQLLockTablesin classBaseDatabaseMeta- 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
-
supportsFloatRoundingOnUpdate
public boolean supportsFloatRoundingOnUpdate()Description copied from class:BaseDatabaseMetaMost databases round number(7,2) 17.29999999 to 17.30, but some don't.- Specified by:
supportsFloatRoundingOnUpdatein interfaceDatabaseInterface- Overrides:
supportsFloatRoundingOnUpdatein classBaseDatabaseMeta- Returns:
- true if the database supports roundinf of floating point data on update/insert
-
supportsSynonyms
public boolean supportsSynonyms()- Specified by:
supportsSynonymsin interfaceDatabaseInterface- Overrides:
supportsSynonymsin classBaseDatabaseMeta- Returns:
- true if the database supports synonyms
-
getSynonymTypes
- Specified by:
getSynonymTypesin interfaceDatabaseInterface- Overrides:
getSynonymTypesin classBaseDatabaseMeta- Returns:
- a list of table types to retrieve synonyms for the database
-
getViewTypes
- Specified by:
getViewTypesin interfaceDatabaseInterface- Overrides:
getViewTypesin classBaseDatabaseMeta- Returns:
- a list of table types to retrieve views for the database
-
getTableTypes
- Specified by:
getTableTypesin interfaceDatabaseInterface- Overrides:
getTableTypesin classBaseDatabaseMeta- Returns:
- a list of table types to retrieve tables for the database
-
getStartQuote
- Specified by:
getStartQuotein interfaceDatabaseInterface- Overrides:
getStartQuotein classBaseDatabaseMeta- Returns:
- The start quote sequence, mostly just double quote, but sometimes [, ...
-
quoteReservedWords
public boolean quoteReservedWords()- Specified by:
quoteReservedWordsin interfaceDatabaseInterface- Overrides:
quoteReservedWordsin classBaseDatabaseMeta- Returns:
- true if reserved words need to be double quoted ("password", "select", ...)
-
getDropColumnStatement
public String getDropColumnStatement(String tablename, ValueMetaInterface v, String tk, boolean useAutoinc, String pk, boolean semicolon) Description copied from class:BaseDatabaseMetaGenerates the SQL statement to drop a column from the specified table- Specified by:
getDropColumnStatementin interfaceDatabaseInterface- Overrides:
getDropColumnStatementin classBaseDatabaseMeta- 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
-
getMaxVARCHARLength
public int getMaxVARCHARLength()Description copied from class:BaseDatabaseMetaGet the maximum length of a text field (VARCHAR) for this database connection. If this size is exceeded use a CLOB.- Specified by:
getMaxVARCHARLengthin interfaceDatabaseInterface- Overrides:
getMaxVARCHARLengthin classBaseDatabaseMeta- Returns:
- The maximum VARCHAR field length for this database type. (mostly identical to getMaxTextFieldLength() - CLOB_LENGTH)
-
getMaxTextFieldLength
public int getMaxTextFieldLength()Description copied from class:BaseDatabaseMetaGet 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- Overrides:
getMaxTextFieldLengthin classBaseDatabaseMeta- Returns:
- The maximum text field length for this database type. (mostly CLOB_LENGTH)
-
getSchemaTableCombination
Description copied from class:BaseDatabaseMetaGet 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- Overrides:
getSchemaTableCombinationin classBaseDatabaseMeta- Parameters:
schemaName- The schema nametablePart- The tablename- Returns:
- the schema-table combination to query the right table.
-
getDefaultOptions
- Specified by:
getDefaultOptionsin interfaceDatabaseInterface- Overrides:
getDefaultOptionsin classBaseDatabaseMeta- Returns:
- default extra Options
-
getExtraOptions
- Specified by:
getExtraOptionsin interfaceDatabaseInterface- Overrides:
getExtraOptionsin classBaseDatabaseMeta- Returns:
- all the extra options that are set to be used for the database URL
-
addExtraOption
Description copied from class:BaseDatabaseMetaAdd an extra option to the attributes list- Specified by:
addExtraOptionin interfaceDatabaseInterface- Overrides:
addExtraOptionin classBaseDatabaseMeta- Parameters:
databaseTypeCode- The database type code for which the option appliesoption- The option to setvalue- The value of the option
-
getExtraOptionSeparator
- Specified by:
getExtraOptionSeparatorin interfaceDatabaseInterface- Overrides:
getExtraOptionSeparatorin classBaseDatabaseMeta- Returns:
- The extra option separator in database URL for this platform (usually this is semicolon ; )
-
getExtraOptionValueSeparator
- Specified by:
getExtraOptionValueSeparatorin interfaceDatabaseInterface- Overrides:
getExtraOptionValueSeparatorin classBaseDatabaseMeta- Returns:
- The extra option value separator in database URL for this platform (usually this is the equal sign = )
-
getExtraOptionIndicator
- Specified by:
getExtraOptionIndicatorin interfaceDatabaseInterface- Overrides:
getExtraOptionIndicatorin classBaseDatabaseMeta- Returns:
- This indicator separates the normal URL from the options
-
supportsOptionsInURL
public boolean supportsOptionsInURL()- Specified by:
supportsOptionsInURLin interfaceDatabaseInterface- Overrides:
supportsOptionsInURLin classBaseDatabaseMeta- Returns:
- true if the database supports connection options in the URL, false if they are put in a Properties object.
-
getExtraOptionsHelpText
- Specified by:
getExtraOptionsHelpTextin interfaceDatabaseInterface- Overrides:
getExtraOptionsHelpTextin classBaseDatabaseMeta- Returns:
- extra help text on the supported options on the selected database platform.
-