org.pentaho.di.core.database
Class DatabaseMeta

java.lang.Object
  extended by org.pentaho.di.shared.SharedObjectBase
      extended by org.pentaho.di.core.database.DatabaseMeta
All Implemented Interfaces:
Cloneable, VariableSpace, XMLInterface, RepositoryElementInterface, RepositoryObjectInterface, SharedObjectInterface

public class DatabaseMeta
extends SharedObjectBase
implements Cloneable, XMLInterface, SharedObjectInterface, VariableSpace, RepositoryElementInterface

This class defines the database specific parameters for a certain database type. It also provides static information regarding a number of well known databases.

Since:
18-05-2003
Author:
Matt

Field Summary
static int CLOB_LENGTH
          Use this length in a String value to indicate that you want to use a CLOB in stead of a normal text field.
static Comparator<DatabaseMeta> comparator
           
static String[] dbAccessTypeCode
          Short description of the access type, used in XML and the repository.
static String[] dbAccessTypeDesc
          Longer description for user interactions.
static String EMPTY_OPTIONS_STRING
          The value to store in the attributes so that an empty value doesn't get lost...
static RepositoryObjectType REPOSITORY_ELEMENT_TYPE
           
static int TYPE_ACCESS_JNDI
          Connect to the database using JNDI.
static int TYPE_ACCESS_NATIVE
          Connect natively through JDBC thin driver to the database.
static int TYPE_ACCESS_OCI
          Connect to the database using OCI.
static int TYPE_ACCESS_ODBC
          Connect to the database using ODBC.
static int TYPE_ACCESS_PLUGIN
          Connect to the database using plugin specific method.
static int TYPE_DATABASE_ACCESS
          Deprecated.  
static int TYPE_DATABASE_AS400
          Deprecated.  
static int TYPE_DATABASE_CACHE
          Deprecated.  
static int TYPE_DATABASE_DB2
          Deprecated.  
static int TYPE_DATABASE_DBASE
          Deprecated.  
static int TYPE_DATABASE_DERBY
          Deprecated.  
static int TYPE_DATABASE_EXTENDB
          Deprecated.  
static int TYPE_DATABASE_FIREBIRD
          Deprecated.  
static int TYPE_DATABASE_GENERIC
          Deprecated.  
static int TYPE_DATABASE_GREENPLUM
          Deprecated.  
static int TYPE_DATABASE_GUPTA
          Deprecated.  
static int TYPE_DATABASE_H2
          Deprecated.  
static int TYPE_DATABASE_HYPERSONIC
          Deprecated.  
static int TYPE_DATABASE_INFOBRIGHT
          Deprecated.  
static int TYPE_DATABASE_INFORMIX
          Deprecated.  
static int TYPE_DATABASE_INGRES
          Deprecated.  
static int TYPE_DATABASE_INTERBASE
          Deprecated.  
static int TYPE_DATABASE_KINGBASEES
          Deprecated.  
static int TYPE_DATABASE_LUCIDDB
          Deprecated.  
static int TYPE_DATABASE_MONETDB
          Deprecated.  
static int TYPE_DATABASE_MSSQL
          Deprecated.  
static int TYPE_DATABASE_MYSQL
          Deprecated.  
static int TYPE_DATABASE_NEOVIEW
          Deprecated.  
static int TYPE_DATABASE_NETEZZA
          Deprecated.  
static int TYPE_DATABASE_NONE
          Deprecated.  
static int TYPE_DATABASE_ORACLE
          Deprecated.  
static int TYPE_DATABASE_ORACLE_RDB
          Deprecated.  
static int TYPE_DATABASE_PALO
          Deprecated.  
static int TYPE_DATABASE_POSTGRES
          Deprecated.  
static int TYPE_DATABASE_REMEDY_AR_SYSTEM
          Deprecated.  
static int TYPE_DATABASE_SAPDB
          Deprecated.  
static int TYPE_DATABASE_SAPR3
          Deprecated.  
static int TYPE_DATABASE_SQLITE
          Deprecated.  
static int TYPE_DATABASE_SYBASE
          Deprecated.  
static int TYPE_DATABASE_SYBASEIQ
          Deprecated.  
static int TYPE_DATABASE_TERADATA
          Deprecated.  
static int TYPE_DATABASE_UNIVERSE
          Deprecated.  
static int TYPE_DATABASE_VERTICA
          Deprecated.  
static String XML_TAG
           
 
Constructor Summary
DatabaseMeta()
          Create an empty database connection
DatabaseMeta(Node con)
          Reads the information from an XML Node into this new database connection.
DatabaseMeta(String xml)
          Constructs a new database using an XML string snippet.
DatabaseMeta(String name, String type, String access, String host, String db, String port, String user, String pass)
          Construct a new database connections.
 
Method Summary
 void addExtraOption(String databaseTypeCode, String option, String value)
          Add an extra option to the attributes list
 void addOptions()
          Add a list of common options for some databases.
 String[] checkParameters()
          Check the database connection parameters and give back an array of remarks
 void clearChanged()
           
 Object clone()
           
 void copyVariablesFrom(VariableSpace space)
          Copy the variables from another space, without initializing with the defaults.
 String environmentSubstitute(String aString)
          Substitute the string using the current variable space.
 String[] environmentSubstitute(String[] aString)
          Replaces environment variables in an array of strings.
 boolean equals(Object obj)
           
static DatabaseMeta findDatabase(List<? extends SharedObjectInterface> databases, String dbname)
          Find a database with a certain name in an arraylist of databases.
static DatabaseMeta findDatabase(List<DatabaseMeta> databases, ObjectId id)
          Find a database with a certain ID in an arraylist of databases.
 String generateColumnAlias(int columnIndex, String suggestedName)
           
 int getAccessType()
          Return the type of database access.
static int getAccessType(String dbaccess)
           
 String getAccessTypeDesc()
          Gets you a short description of the type of database access.
static String getAccessTypeDesc(int dbaccess)
           
static String getAccessTypeDescLong(int dbaccess)
           
static int[] getAccessTypeList(String dbTypeDesc)
           
 String getAddColumnStatement(String tablename, ValueMetaInterface v, String tk, boolean use_autoinc, String pk, boolean semicolon)
           
 Properties getAttributes()
           
 boolean getBooleanValueOfVariable(String variableName, boolean defaultValue)
          This method returns a boolean for the new variable check boxes.
 Properties getConnectionPoolingProperties()
           
 Properties getConnectionProperties()
           
 String getConnectSQL()
           
 DatabaseFactoryInterface getDatabaseFactory()
           
 DatabaseInterface getDatabaseInterface()
           
static DatabaseInterface getDatabaseInterface(String databaseType)
          Search for the right type of DatabaseInterface object and clone it.
static DatabaseInterface[] getDatabaseInterfaces()
           
static Map<String,DatabaseInterface> getDatabaseInterfacesMap()
           
 String getDatabaseName()
          Return the name of the database.
 String getDatabasePortNumberString()
          Return the port on which the database listens as a String.
 String getDatabaseTypeDesc()
          Deprecated. This is actually the plugin ID
 String getDataTablespace()
           
 int getDefaultDatabasePort()
           
 String getDescription()
           
 String getDriverClass()
           
 String getDropColumnStatement(String tablename, ValueMetaInterface v, String tk, boolean use_autoinc, String pk, boolean semicolon)
           
 String getEndQuote()
           
 String getExtraOptionIndicator()
           
 Map<String,String> getExtraOptions()
           
 String getExtraOptionSeparator()
           
 String getExtraOptionsHelpText()
           
 String getExtraOptionValueSeparator()
           
 List<RowMetaAndData> getFeatureSummary()
           
 String getFieldDefinition(ValueMetaInterface v, String tk, String pk, boolean use_autoinc)
           
 String getFieldDefinition(ValueMetaInterface v, String tk, String pk, boolean use_autoinc, boolean add_fieldname, boolean add_cr)
           
 String getFunctionAverage()
           
 String getFunctionCount()
           
 String getFunctionMaximum()
           
 String getFunctionMinimum()
           
 String getFunctionSum()
           
 String getHostname()
          Return the hostname of the machine on which the database runs.
 String getIndexTablespace()
           
 int getInitialPoolSize()
           
 String getLimitClause(int nrRows)
           
 int getMaxColumnsInIndex()
           
 int getMaximumPoolSize()
           
 int getMaxTextFieldLength()
          Get the maximum length of a text field for this database connection.
 String getModifyColumnStatement(String tablename, ValueMetaInterface v, String tk, boolean use_autoinc, String pk, boolean semicolon)
           
 String getName()
          Returns the name of the database connection
 Long getNextBatchId(Database ldb, String schemaName, String tableName, String fieldName)
           
 int getNotFoundTK(boolean use_autoinc)
           
 int getNrReservedWords(RowMetaInterface fields)
          Checks the fields specified for reserved words
 ObjectId getObjectId()
          Returns the database ID of this database connection if a repository was used before.
 ObjectRevision getObjectRevision()
           
 VariableSpace getParentVariableSpace()
          Get the parent of the variable space.
 PartitionDatabaseMeta[] getPartitioningInformation()
           
 PartitionDatabaseMeta getPartitionMeta(String partitionId)
          Finds the partition metadata for the given partition iD
 String getPassword()
          Get the password to log into the database on this connection.
 String getPluginId()
          The plugin ID of the database interface
static int getPortForDBType(String strtype, String straccess)
           
 String getPreferredSchemaName()
           
 String getQuotedSchemaTableCombination(String schemaName, String tableName)
          Calculate the schema-table combination, usually this is the schema and table separated with a dot.
 RepositoryDirectoryInterface getRepositoryDirectory()
          Not used in this case, simply return root /
 RepositoryObjectType getRepositoryElementType()
           
 String[] getReservedWords()
           
 String getSchemaTableCombination(String schemaName, String tableName)
          Deprecated. please use getQuotedSchemaTableCombination()
 String getSeqNextvalSQL(String sequenceName)
           
 String getServername()
           
 String getSQLColumnExists(String columnname, String tablename)
           
 String getSQLCurrentSequenceValue(String sequenceName)
           
 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 getSQLQueryFields(String tableName)
           
 String getSQLSequenceExists(String sequenceName)
           
 String getSQLServerInstance()
           
 String getSQLTableExists(String tablename)
           
 String getSQLUnlockTables(String[] tableNames)
           
 String getStartQuote()
           
 String[] getSynonymTypes()
           
 String[] getTableTypes()
           
 String getTruncateTableStatement(String schema, String tableName)
           
 String getURL()
           
 String getURL(String partitionId)
           
 String getUsername()
          Get the username to log into the database on this connection.
 Object getValueFromResultSet(ResultSet rs, ValueMetaInterface val, int i)
           
 String getVariable(String variableName)
          Get the value of a variable.
 String getVariable(String variableName, String defaultValue)
          Get the value of a variable with a default in case the variable is not found.
 String[] getViewTypes()
           
 String getXML()
          Describes the Object implementing this interface as XML
 boolean hasChanged()
           
 boolean hasDotInField(String fieldname)
           
 int hashCode()
           
 boolean hasSpacesInField(String fieldname)
          Detects if a field has spaces in the name.
 boolean hasSpecialCharInField(String fieldname)
          Detects if a field has spaces in the name.
 void initializeVariablesFrom(VariableSpace parent)
          Initialize variable space using the defaults, copy over the variables from the parent (using copyVariablesFrom()), after this the "injected" variables should be inserted (injectVariables()).
 void injectVariables(Map<String,String> prop)
          Inject variables.
 boolean isClob(ValueMetaInterface v)
           
 boolean isDisplaySizeTwiceThePrecision()
           
 boolean isExplorable()
           
 boolean isFetchSizeSupported()
           
 boolean isForcingIdentifiersToLowerCase()
           
 boolean isForcingIdentifiersToUpperCase()
           
 boolean isInNeedOfQuoting(String fieldname)
          Determines whether or not this field is in need of quoting:
- When the fieldname contains spaces
- When the fieldname is a reserved word
 boolean isMySQLVariant()
           
 boolean isPartitioned()
           
 boolean isQuoteAllFields()
           
 boolean isRequiringTransactionsOnQueries()
           
 boolean isReservedWord(String word)
          Returns true if the string specified is a reserved word on this database type.
 boolean isStreamingResults()
           
 boolean isSystemTable(String tableName)
           
 boolean isUsingConnectionPool()
           
 boolean isUsingDoubleDecimalAsSchemaTableSeparator()
           
 String[] listVariables()
          List the variables (not the values) that are currently in the variable space.
 boolean needsPlaceHolder()
          Indicates the need to insert a placeholder (0) for auto increment fields.
 boolean needsToLockAllTables()
           
 String quoteField(String field)
          Returns a quoted field if this is needed: contains spaces, is a reserved word, ...
 boolean quoteReservedWords()
           
 void quoteReservedWords(RowMetaInterface fields)
          Changes the names of the fields to their quoted equivalent if this is needed
 String quoteSQLString(String string)
           
 void replaceMeta(DatabaseMeta databaseMeta)
           
 boolean replaceReservedWords(RowMetaInterface fields)
          Checks the fields specified for reserved words and quotes them.
 boolean requiresCastToVariousForIsNull()
           
 boolean requiresCreateTablePrimaryKeyAppend()
           
 void setAccessType(int access_type)
          Set the type of database access.
 void setAttributes(Properties attributes)
          Set extra attributes on this database connection
 void setChanged()
           
 void setChanged(boolean ch)
           
 void setConnectionPoolingProperties(Properties properties)
           
 void setConnectSQL(String sql)
           
 void setDatabaseInterface(DatabaseInterface databaseInterface)
          Set the system dependend database interface for this database metadata definition
 void setDatabaseType(String type)
           
 void setDataTablespace(String data_tablespace)
           
 void setDBName(String databaseName)
          Set the name of the database.
 void setDBPort(String db_port)
          Sets the port on which the database listens.
 void setDefault()
          Set default values for an Oracle database.
 void setDescription(String description)
           
 void setForcingIdentifiersToLowerCase(boolean forceLowerCase)
           
 void setForcingIdentifiersToUpperCase(boolean forceUpperCase)
           
 void setHostname(String hostname)
          Sets the hostname of the machine on which the database runs.
 void setIndexTablespace(String index_tablespace)
           
 void setInitialPoolSize(int initalPoolSize)
           
 void setMaximumPoolSize(int maximumPoolSize)
           
 void setName(String name)
          Sets the name of the database connection.
 void setObjectId(ObjectId id)
           
 void setObjectRevision(ObjectRevision objectRevision)
           
 void setParentVariableSpace(VariableSpace parent)
          Set the parent variable space
 void setPartitioned(boolean partitioned)
           
 void setPartitioningInformation(PartitionDatabaseMeta[] partitionInfo)
           
 void setPassword(String password)
          Sets the password to log into the database on this connection.
 void setPreferredSchemaName(String preferredSchemaName)
           
 void setQuoteAllFields(boolean quoteAllFields)
           
 void setRepositoryDirectory(RepositoryDirectoryInterface repositoryDirectory)
           
 void setServername(String servername)
           
 void setSQLServerInstance(String instanceName)
           
 void setStreamingResults(boolean useStreaming)
           
 void setSupportsBooleanDataType(boolean b)
           
 void setUsername(String username)
          Sets the username to log into the database on this connection.
 void setUsingConnectionPool(boolean usePool)
           
 void setUsingDoubleDecimalAsSchemaTableSeparator(boolean useDoubleDecimalSeparator)
           
 void setValues(DatabaseMeta info)
           
 void setValues(String name, String type, String access, String host, String db, String port, String user, String pass)
           
 void setVariable(String variableName, String variableValue)
          Sets a variable in the Kettle Variables list.
 void shareVariablesWith(VariableSpace space)
          Share a variable space from another variable space.
 String stripCR(String sbsql)
           
 String stripCR(StringBuffer sbsql)
           
 boolean supportsAutoinc()
           
 boolean supportsBatchUpdates()
           
 boolean supportsBitmapIndex()
           
 boolean supportsBooleanDataType()
           
 boolean supportsCatalogs()
           
 boolean supportsEmptyTransactions()
           
 boolean supportsErrorHandlingOnBatchUpdates()
           
 boolean supportsFloatRoundingOnUpdate()
           
 boolean supportsGetBlob()
           
 boolean supportsOptionsInURL()
           
 boolean supportsPreparedStatementMetadataRetrieval()
           
 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()
          Deprecated. because the same database can support transactions or not. It all depends on the database setup. Therefor, we look at the database metadata DatabaseMetaData.supportsTransactions() in stead of this.
 boolean supportsViews()
           
 String testConnection()
           
 String toString()
           
 boolean useSchemaNameForTableList()
           
 String verifyAndModifyDatabaseName(List<DatabaseMeta> databases, String oldname)
          Verify the name of the database and if required, change it if it already exists in the list of databases.
 
Methods inherited from class org.pentaho.di.shared.SharedObjectBase
getChangedDate, isShared, setChangedDate, setShared
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.pentaho.di.shared.SharedObjectInterface
getChangedDate, isShared, setShared
 

Field Detail

XML_TAG

public static final String XML_TAG
See Also:
Constant Field Values

REPOSITORY_ELEMENT_TYPE

public static final RepositoryObjectType REPOSITORY_ELEMENT_TYPE

comparator

public static final Comparator<DatabaseMeta> comparator

TYPE_DATABASE_NONE

public static final int TYPE_DATABASE_NONE
Deprecated. 
Indicates that the connections doesn't point to a type of database yet.

See Also:
Constant Field Values

TYPE_DATABASE_MYSQL

public static final int TYPE_DATABASE_MYSQL
Deprecated. 
Connection to a MySQL database

See Also:
Constant Field Values

TYPE_DATABASE_ORACLE

public static final int TYPE_DATABASE_ORACLE
Deprecated. 
Connection to an Oracle database

See Also:
Constant Field Values

TYPE_DATABASE_AS400

public static final int TYPE_DATABASE_AS400
Deprecated. 
Connection to an AS/400 (IBM iSeries) DB400 database

See Also:
Constant Field Values

TYPE_DATABASE_ACCESS

public static final int TYPE_DATABASE_ACCESS
Deprecated. 
Connection to an Microsoft Access database

See Also:
Constant Field Values

TYPE_DATABASE_MSSQL

public static final int TYPE_DATABASE_MSSQL
Deprecated. 
Connection to a Microsoft SQL Server database

See Also:
Constant Field Values

TYPE_DATABASE_DB2

public static final int TYPE_DATABASE_DB2
Deprecated. 
Connection to an IBM DB2 database

See Also:
Constant Field Values

TYPE_DATABASE_POSTGRES

public static final int TYPE_DATABASE_POSTGRES
Deprecated. 
Connection to a PostgreSQL database

See Also:
Constant Field Values

TYPE_DATABASE_CACHE

public static final int TYPE_DATABASE_CACHE
Deprecated. 
Connection to an Intersystems Cache database

See Also:
Constant Field Values

TYPE_DATABASE_INFORMIX

public static final int TYPE_DATABASE_INFORMIX
Deprecated. 
Connection to an IBM Informix database

See Also:
Constant Field Values

TYPE_DATABASE_SYBASE

public static final int TYPE_DATABASE_SYBASE
Deprecated. 
Connection to a Sybase ASE database

See Also:
Constant Field Values

TYPE_DATABASE_GUPTA

public static final int TYPE_DATABASE_GUPTA
Deprecated. 
Connection to a Gupta SQLBase database

See Also:
Constant Field Values

TYPE_DATABASE_DBASE

public static final int TYPE_DATABASE_DBASE
Deprecated. 
Connection to a DBase III/IV/V database through JDBC

See Also:
Constant Field Values

TYPE_DATABASE_FIREBIRD

public static final int TYPE_DATABASE_FIREBIRD
Deprecated. 
Connection to a FireBird database

See Also:
Constant Field Values

TYPE_DATABASE_SAPDB

public static final int TYPE_DATABASE_SAPDB
Deprecated. 
Connection to a SAP DB database

See Also:
Constant Field Values

TYPE_DATABASE_HYPERSONIC

public static final int TYPE_DATABASE_HYPERSONIC
Deprecated. 
Connection to a Hypersonic java database

See Also:
Constant Field Values

TYPE_DATABASE_GENERIC

public static final int TYPE_DATABASE_GENERIC
Deprecated. 
Connection to a generic database

See Also:
Constant Field Values

TYPE_DATABASE_SAPR3

public static final int TYPE_DATABASE_SAPR3
Deprecated. 
Connection to an SAP R/3 system

See Also:
Constant Field Values

TYPE_DATABASE_INGRES

public static final int TYPE_DATABASE_INGRES
Deprecated. 
Connection to an Ingress database

See Also:
Constant Field Values

TYPE_DATABASE_INTERBASE

public static final int TYPE_DATABASE_INTERBASE
Deprecated. 
Connection to a Borland Interbase database

See Also:
Constant Field Values

TYPE_DATABASE_EXTENDB

public static final int TYPE_DATABASE_EXTENDB
Deprecated. 
Connection to an ExtenDB database

See Also:
Constant Field Values

TYPE_DATABASE_TERADATA

public static final int TYPE_DATABASE_TERADATA
Deprecated. 
Connection to a Teradata database

See Also:
Constant Field Values

TYPE_DATABASE_ORACLE_RDB

public static final int TYPE_DATABASE_ORACLE_RDB
Deprecated. 
Connection to an Oracle RDB database

See Also:
Constant Field Values

TYPE_DATABASE_H2

public static final int TYPE_DATABASE_H2
Deprecated. 
Connection to an H2 database

See Also:
Constant Field Values

TYPE_DATABASE_NETEZZA

public static final int TYPE_DATABASE_NETEZZA
Deprecated. 
Connection to a Netezza database

See Also:
Constant Field Values

TYPE_DATABASE_UNIVERSE

public static final int TYPE_DATABASE_UNIVERSE
Deprecated. 
Connection to an IBM UniVerse database

See Also:
Constant Field Values

TYPE_DATABASE_SQLITE

public static final int TYPE_DATABASE_SQLITE
Deprecated. 
Connection to a SQLite database

See Also:
Constant Field Values

TYPE_DATABASE_DERBY

public static final int TYPE_DATABASE_DERBY
Deprecated. 
Connection to an Apache Derby database

See Also:
Constant Field Values

TYPE_DATABASE_REMEDY_AR_SYSTEM

public static final int TYPE_DATABASE_REMEDY_AR_SYSTEM
Deprecated. 
Connection to a BMC Remedy Action Request System

See Also:
Constant Field Values

TYPE_DATABASE_PALO

public static final int TYPE_DATABASE_PALO
Deprecated. 
Connection to a Palo MOLAP Server

See Also:
Constant Field Values

TYPE_DATABASE_SYBASEIQ

public static final int TYPE_DATABASE_SYBASEIQ
Deprecated. 
Connection to a SybaseIQ ASE database

See Also:
Constant Field Values

TYPE_DATABASE_GREENPLUM

public static final int TYPE_DATABASE_GREENPLUM
Deprecated. 
Connection to a Greenplum database

See Also:
Constant Field Values

TYPE_DATABASE_MONETDB

public static final int TYPE_DATABASE_MONETDB
Deprecated. 
Connection to a MonetDB database

See Also:
Constant Field Values

TYPE_DATABASE_KINGBASEES

public static final int TYPE_DATABASE_KINGBASEES
Deprecated. 
Connection to a KingbaseES database

See Also:
Constant Field Values

TYPE_DATABASE_VERTICA

public static final int TYPE_DATABASE_VERTICA
Deprecated. 
Connection to a Vertica database

See Also:
Constant Field Values

TYPE_DATABASE_NEOVIEW

public static final int TYPE_DATABASE_NEOVIEW
Deprecated. 
Connection to a Neoview database

See Also:
Constant Field Values

TYPE_DATABASE_LUCIDDB

public static final int TYPE_DATABASE_LUCIDDB
Deprecated. 
Connection to a LucidDB database

See Also:
Constant Field Values

TYPE_DATABASE_INFOBRIGHT

public static final int TYPE_DATABASE_INFOBRIGHT
Deprecated. 
Connection to an Infobright database

See Also:
Constant Field Values

TYPE_ACCESS_NATIVE

public static final int TYPE_ACCESS_NATIVE
Connect natively through JDBC thin driver to the database.

See Also:
Constant Field Values

TYPE_ACCESS_ODBC

public static final int TYPE_ACCESS_ODBC
Connect to the database using ODBC.

See Also:
Constant Field Values

TYPE_ACCESS_OCI

public static final int TYPE_ACCESS_OCI
Connect to the database using OCI. (Oracle only)

See Also:
Constant Field Values

TYPE_ACCESS_PLUGIN

public static final int TYPE_ACCESS_PLUGIN
Connect to the database using plugin specific method. (SAP ERP)

See Also:
Constant Field Values

TYPE_ACCESS_JNDI

public static final int TYPE_ACCESS_JNDI
Connect to the database using JNDI.

See Also:
Constant Field Values

dbAccessTypeCode

public static final String[] dbAccessTypeCode
Short description of the access type, used in XML and the repository.


dbAccessTypeDesc

public static final String[] dbAccessTypeDesc
Longer description for user interactions.


CLOB_LENGTH

public static final int CLOB_LENGTH
Use this length in a String value to indicate that you want to use a CLOB in stead of a normal text field.

See Also:
Constant Field Values

EMPTY_OPTIONS_STRING

public static final String EMPTY_OPTIONS_STRING
The value to store in the attributes so that an empty value doesn't get lost...

See Also:
Constant Field Values
Constructor Detail

DatabaseMeta

public DatabaseMeta(String name,
                    String type,
                    String access,
                    String host,
                    String db,
                    String port,
                    String user,
                    String pass)
Construct a new database connections. Note that not all these parameters are not always mandatory.

Parameters:
name - The database name
type - The type of database
access - The type of database access
host - The hostname or IP address
db - The database name
port - The port on which the database listens.
user - The username
pass - The password

DatabaseMeta

public DatabaseMeta()
Create an empty database connection


DatabaseMeta

public DatabaseMeta(String xml)
             throws KettleXMLException
Constructs a new database using an XML string snippet. It expects the snippet to be enclosed in connection tags.

Parameters:
xml - The XML string to parse
Throws:
KettleXMLException - in case there is an XML parsing error

DatabaseMeta

public DatabaseMeta(Node con)
             throws KettleXMLException
Reads the information from an XML Node into this new database connection.

Parameters:
con - The Node to read the data from
Throws:
KettleXMLException
Method Detail

setDefault

public void setDefault()
Set default values for an Oracle database.


addOptions

public void addOptions()
Add a list of common options for some databases.


getDatabaseInterface

public DatabaseInterface getDatabaseInterface()
Returns:
the system dependend database interface for this database metadata definition

setDatabaseInterface

public void setDatabaseInterface(DatabaseInterface databaseInterface)
Set the system dependend database interface for this database metadata definition

Parameters:
databaseInterface - the system dependend database interface

getDatabaseInterface

public static final DatabaseInterface getDatabaseInterface(String databaseType)
                                                    throws KettleDatabaseException
Search for the right type of DatabaseInterface object and clone it.

Parameters:
databaseType - the type of DatabaseInterface to look for (description)
Returns:
The requested DatabaseInterface
Throws:
KettleDatabaseException - when the type could not be found or referenced.

getObjectId

public ObjectId getObjectId()
Returns the database ID of this database connection if a repository was used before.

Specified by:
getObjectId in interface RepositoryElementInterface
Specified by:
getObjectId in interface RepositoryObjectInterface
Returns:
the ID of the db connection.

setObjectId

public void setObjectId(ObjectId id)
Specified by:
setObjectId in interface RepositoryElementInterface

clone

public Object clone()
Overrides:
clone in class Object

replaceMeta

public void replaceMeta(DatabaseMeta databaseMeta)

setValues

public void setValues(String name,
                      String type,
                      String access,
                      String host,
                      String db,
                      String port,
                      String user,
                      String pass)

setDatabaseType

public void setDatabaseType(String type)

setValues

public void setValues(DatabaseMeta info)

setName

public void setName(String name)
Sets the name of the database connection. This name should be unique in a transformation and in general in a single repository.

Specified by:
setName in interface RepositoryElementInterface
Parameters:
name - The name of the database connection

getName

public String getName()
Returns the name of the database connection

Specified by:
getName in interface RepositoryElementInterface
Specified by:
getName in interface RepositoryObjectInterface
Specified by:
getName in interface SharedObjectInterface
Returns:
The name of the database connection

getPluginId

public String getPluginId()
The plugin ID of the database interface


getAccessType

public int getAccessType()
Return the type of database access. One of

TYPE_ACCESS_NATIVE

TYPE_ACCESS_ODBC

TYPE_ACCESS_OCI

Returns:
The type of database access.

setAccessType

public void setAccessType(int access_type)
Set the type of database access.

Parameters:
access_type - The access type.

getDatabaseTypeDesc

public String getDatabaseTypeDesc()
Deprecated. This is actually the plugin ID

Returns a short description of the type of database.

Returns:
A short description of the type of database.

getAccessTypeDesc

public String getAccessTypeDesc()
Gets you a short description of the type of database access.

Returns:
A short description of the type of database access.

getHostname

public String getHostname()
Return the hostname of the machine on which the database runs.

Returns:
The hostname of the database.

setHostname

public void setHostname(String hostname)
Sets the hostname of the machine on which the database runs.

Parameters:
hostname - The hostname of the machine on which the database runs.

getDatabasePortNumberString

public String getDatabasePortNumberString()
Return the port on which the database listens as a String. Allows for parameterisation.

Returns:
The database port.

setDBPort

public void setDBPort(String db_port)
Sets the port on which the database listens.

Parameters:
db_port - The port number on which the database listens

getDatabaseName

public String getDatabaseName()
Return the name of the database.

Returns:
The database name.

setDBName

public void setDBName(String databaseName)
Set the name of the database.

Parameters:
databaseName - The new name of the database

getUsername

public String getUsername()
Get the username to log into the database on this connection.

Returns:
The username to log into the database on this connection.

setUsername

public void setUsername(String username)
Sets the username to log into the database on this connection.

Parameters:
username - The username

getPassword

public String getPassword()
Get the password to log into the database on this connection.

Returns:
the password to log into the database on this connection.

setPassword

public void setPassword(String password)
Sets the password to log into the database on this connection.

Parameters:
password - the password to log into the database on this connection.

setServername

public void setServername(String servername)
Parameters:
servername - the Informix servername

getServername

public String getServername()
Returns:
the Informix servername

getDataTablespace

public String getDataTablespace()

setDataTablespace

public void setDataTablespace(String data_tablespace)

getIndexTablespace

public String getIndexTablespace()

setIndexTablespace

public void setIndexTablespace(String index_tablespace)

setChanged

public void setChanged()

setChanged

public void setChanged(boolean ch)

hasChanged

public boolean hasChanged()

clearChanged

public void clearChanged()

toString

public String toString()
Overrides:
toString in class Object

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.

getXML

public String getXML()
Description copied from interface: XMLInterface
Describes the Object implementing this interface as XML

Specified by:
getXML in interface XMLInterface
Specified by:
getXML in interface SharedObjectInterface
Returns:
the XML string for this object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getURL

public String getURL()
              throws KettleDatabaseException
Throws:
KettleDatabaseException

getURL

public String getURL(String partitionId)
              throws KettleDatabaseException
Throws:
KettleDatabaseException

getConnectionProperties

public Properties getConnectionProperties()

getExtraOptionIndicator

public String getExtraOptionIndicator()

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

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

supportsTransactions

public boolean supportsTransactions()
Deprecated. because the same database can support transactions or not. It all depends on the database setup. Therefor, we look at the database metadata DatabaseMetaData.supportsTransactions() in stead of this.

Returns:
true if the database supports transactions

supportsAutoinc

public boolean supportsAutoinc()

supportsSequences

public boolean supportsSequences()

getSQLSequenceExists

public String getSQLSequenceExists(String sequenceName)

supportsBitmapIndex

public boolean supportsBitmapIndex()

supportsSetLong

public boolean supportsSetLong()

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

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.

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)

getAccessType

public static final int getAccessType(String dbaccess)

getAccessTypeDesc

public static final String getAccessTypeDesc(int dbaccess)

getAccessTypeDescLong

public static final String getAccessTypeDescLong(int dbaccess)

getDatabaseInterfaces

public static final DatabaseInterface[] getDatabaseInterfaces()

getDatabaseInterfacesMap

public static final Map<String,DatabaseInterface> getDatabaseInterfacesMap()

getAccessTypeList

public static final int[] getAccessTypeList(String dbTypeDesc)

getPortForDBType

public static final int getPortForDBType(String strtype,
                                         String straccess)

getDefaultDatabasePort

public int getDefaultDatabasePort()

getNotFoundTK

public int getNotFoundTK(boolean use_autoinc)

getDriverClass

public String getDriverClass()

stripCR

public String stripCR(String sbsql)

stripCR

public String stripCR(StringBuffer sbsql)

getSeqNextvalSQL

public String getSeqNextvalSQL(String sequenceName)

getSQLCurrentSequenceValue

public String getSQLCurrentSequenceValue(String sequenceName)

isFetchSizeSupported

public boolean isFetchSizeSupported()

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.

getFunctionSum

public String getFunctionSum()

getFunctionAverage

public String getFunctionAverage()

getFunctionMaximum

public String getFunctionMaximum()

getFunctionMinimum

public String getFunctionMinimum()

getFunctionCount

public String getFunctionCount()

checkParameters

public String[] checkParameters()
Check the database connection parameters and give back an array of remarks

Returns:
an array of remarks Strings

getSchemaTableCombination

public String getSchemaTableCombination(String schemaName,
                                        String tableName)
Deprecated. please use getQuotedSchemaTableCombination()

This is now replaced with getQuotedSchemaTableCombination(), enforcing the use of the quoteFields call

Parameters:
schemaName -
tableName -
Returns:

getQuotedSchemaTableCombination

public String getQuotedSchemaTableCombination(String schemaName,
                                              String tableName)
Calculate the schema-table combination, usually this is the schema and table separated with a dot. (schema.table)

Parameters:
schemaName - the schema-name or null if no schema is used.
tableName - the table name
Returns:
the schemaname-tablename combination

isClob

public boolean isClob(ValueMetaInterface v)

getFieldDefinition

public String getFieldDefinition(ValueMetaInterface v,
                                 String tk,
                                 String pk,
                                 boolean use_autoinc)

getFieldDefinition

public String getFieldDefinition(ValueMetaInterface v,
                                 String tk,
                                 String pk,
                                 boolean use_autoinc,
                                 boolean add_fieldname,
                                 boolean add_cr)

getLimitClause

public String getLimitClause(int nrRows)

getSQLQueryFields

public String getSQLQueryFields(String tableName)
Parameters:
tableName - The table or schema-table combination. We expect this to be quoted properly already!
Returns:
the SQL for to get the fields of this table.

getAddColumnStatement

public String getAddColumnStatement(String tablename,
                                    ValueMetaInterface v,
                                    String tk,
                                    boolean use_autoinc,
                                    String pk,
                                    boolean semicolon)

getDropColumnStatement

public String getDropColumnStatement(String tablename,
                                     ValueMetaInterface v,
                                     String tk,
                                     boolean use_autoinc,
                                     String pk,
                                     boolean semicolon)

getModifyColumnStatement

public String getModifyColumnStatement(String tablename,
                                       ValueMetaInterface v,
                                       String tk,
                                       boolean use_autoinc,
                                       String pk,
                                       boolean semicolon)

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

quoteField

public String quoteField(String field)
Returns a quoted field if this is needed: contains spaces, is a reserved word, ...

Parameters:
field - The fieldname to check for quoting
Returns:
The quoted field (if this is needed.

isInNeedOfQuoting

public boolean isInNeedOfQuoting(String fieldname)
Determines whether or not this field is in need of quoting:
- When the fieldname contains spaces
- When the fieldname is a reserved word

Parameters:
fieldname - the fieldname to check if there is a need for quoting
Returns:
true if the fieldname needs to be quoted.

isReservedWord

public boolean isReservedWord(String word)
Returns true if the string specified is a reserved word on this database type.

Parameters:
word - The word to check
Returns:
true if word is a reserved word on this database.

hasSpacesInField

public boolean hasSpacesInField(String fieldname)
Detects if a field has spaces in the name. We need to quote the field in that case.

Parameters:
fieldname - The fieldname to check for spaces
Returns:
true if the fieldname contains spaces

hasSpecialCharInField

public boolean hasSpecialCharInField(String fieldname)
Detects if a field has spaces in the name. We need to quote the field in that case.

Parameters:
fieldname - The fieldname to check for spaces
Returns:
true if the fieldname contains spaces

hasDotInField

public boolean hasDotInField(String fieldname)

replaceReservedWords

public boolean replaceReservedWords(RowMetaInterface fields)
Checks the fields specified for reserved words and quotes them.

Parameters:
fields - the list of fields to check
Returns:
true if one or more values have a name that is a reserved word on this database type.

getNrReservedWords

public int getNrReservedWords(RowMetaInterface fields)
Checks the fields specified for reserved words

Parameters:
fields - the list of fields to check
Returns:
The nr of reserved words for this database.

getTableTypes

public String[] getTableTypes()
Returns:
a list of types to get the available tables

getViewTypes

public String[] getViewTypes()
Returns:
a list of types to get the available views

getSynonymTypes

public String[] getSynonymTypes()
Returns:
a list of types to get the available synonyms

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.

getTruncateTableStatement

public String getTruncateTableStatement(String schema,
                                        String tableName)
Parameters:
tableName - The tablename to be truncated
Returns:
The SQL statement to remove all rows from the specified statement, if possible without using transactions

supportsFloatRoundingOnUpdate

public boolean supportsFloatRoundingOnUpdate()
Returns:
true if the database rounds floating point numbers to the right precision. For example if the target field is number(7,2) the value 12.399999999 is converted into 12.40

getSQLLockTables

public String getSQLLockTables(String[] tableNames)
Parameters:
tableNames - The names of the tables to lock
Returns:
The SQL commands to lock database tables for write purposes. null is returned in case locking is not supported on the target database.

getSQLUnlockTables

public String getSQLUnlockTables(String[] tableNames)
Parameters:
tableNames - The names of the tables to unlock
Returns:
The SQL commands to unlock databases tables. null is returned in case locking is not supported on the target database.

getFeatureSummary

public List<RowMetaAndData> getFeatureSummary()
Returns:
a feature list for the chosen database type.

supportsTimeStampToDateConversion

public boolean supportsTimeStampToDateConversion()
Returns:
true if the database result sets support getTimeStamp() to retrieve date-time. (Date)

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

setSupportsBooleanDataType

public void setSupportsBooleanDataType(boolean b)
Parameters:
b - Set to true if the database supports a boolean, bit, logical, ... datatype

quoteReservedWords

public void quoteReservedWords(RowMetaInterface fields)
Changes the names of the fields to their quoted equivalent if this is needed

Parameters:
fields - The row of fields to change

getExtraOptions

public Map<String,String> getExtraOptions()
Returns:
a map of all the extra URL options you want to set.

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.

verifyAndModifyDatabaseName

public String verifyAndModifyDatabaseName(List<DatabaseMeta> databases,
                                          String oldname)
Verify the name of the database and if required, change it if it already exists in the list of databases.

Parameters:
databases - the databases to check against.
oldname - the old name of the database
Returns:
the new name of the database connection

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 initalPoolSize)
Parameters:
initalPoolSize - the initial pool size

isPartitioned

public boolean isPartitioned()
Returns:
true if the connection contains partitioning information

setPartitioned

public void setPartitioned(boolean partitioned)
Parameters:
partitioned - true if the connection is set to contain partitioning information

getPartitioningInformation

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

setPartitioningInformation

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

getPartitionMeta

public PartitionDatabaseMeta getPartitionMeta(String partitionId)
Finds the partition metadata for the given partition iD

Parameters:
partitionId - The partition ID to look for
Returns:
the partition database metadata or null if nothing was found.

getConnectionPoolingProperties

public Properties getConnectionPoolingProperties()

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:
quoteAllFields - true if all fields in DB should be quoted.

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

findDatabase

public static final DatabaseMeta findDatabase(List<? extends SharedObjectInterface> databases,
                                              String dbname)
Find a database with a certain name in an arraylist of databases.

Parameters:
databases - The ArrayList of databases
dbname - The name of the database connection
Returns:
The database object if one was found, null otherwise.

findDatabase

public static final DatabaseMeta findDatabase(List<DatabaseMeta> databases,
                                              ObjectId id)
Find a database with a certain ID in an arraylist of databases.

Parameters:
databases - The ArrayList of databases
id - The id of the database connection
Returns:
The database object if one was found, null otherwise.

copyVariablesFrom

public void copyVariablesFrom(VariableSpace space)
Description copied from interface: VariableSpace
Copy the variables from another space, without initializing with the defaults. This does not affect any parent relationship.

Specified by:
copyVariablesFrom in interface VariableSpace
Parameters:
space - the space to copy the variables from.

environmentSubstitute

public String environmentSubstitute(String aString)
Description copied from interface: VariableSpace
Substitute the string using the current variable space.

Specified by:
environmentSubstitute in interface VariableSpace
Parameters:
aString - The string to substitute.
Returns:
The substituted string.

environmentSubstitute

public String[] environmentSubstitute(String[] aString)
Description copied from interface: VariableSpace
Replaces environment variables in an array of strings. See also: environmentSubstitute(String string)

Specified by:
environmentSubstitute in interface VariableSpace
Parameters:
aString - The array of strings that wants its variables to be replaced.
Returns:
the array with the environment variables replaced.

getParentVariableSpace

public VariableSpace getParentVariableSpace()
Description copied from interface: VariableSpace
Get the parent of the variable space.

Specified by:
getParentVariableSpace in interface VariableSpace
Returns:
the parent.

setParentVariableSpace

public void setParentVariableSpace(VariableSpace parent)
Description copied from interface: VariableSpace
Set the parent variable space

Specified by:
setParentVariableSpace in interface VariableSpace
Parameters:
parent - The parent variable space to set

getVariable

public String getVariable(String variableName,
                          String defaultValue)
Description copied from interface: VariableSpace
Get the value of a variable with a default in case the variable is not found.

Specified by:
getVariable in interface VariableSpace
Parameters:
variableName - The name of the variable
defaultValue - The default value in case the variable could not be found
Returns:
the String value of a variable

getVariable

public String getVariable(String variableName)
Description copied from interface: VariableSpace
Get the value of a variable.

Specified by:
getVariable in interface VariableSpace
Parameters:
variableName - The name of the variable
Returns:
the String value of a variable or null in case the variable could not be found.

getBooleanValueOfVariable

public boolean getBooleanValueOfVariable(String variableName,
                                         boolean defaultValue)
Description copied from interface: VariableSpace
This method returns a boolean for the new variable check boxes. If the variable name is not set or the variable name is not specified, this method simply returns the default value. If not, it convert the variable value to a boolean. "Y", "YES" and "TRUE" all convert to true. (case insensitive)

Specified by:
getBooleanValueOfVariable in interface VariableSpace
Parameters:
variableName - The variable to look up.
defaultValue - The default value to return.
Returns:
See Also:
static method ValueMeta.convertStringToBoolean()

initializeVariablesFrom

public void initializeVariablesFrom(VariableSpace parent)
Description copied from interface: VariableSpace
Initialize variable space using the defaults, copy over the variables from the parent (using copyVariablesFrom()), after this the "injected" variables should be inserted (injectVariables()). The parent is set as parent variable space.

Specified by:
initializeVariablesFrom in interface VariableSpace
Parameters:
parent - the parent to start from, or null if root.

listVariables

public String[] listVariables()
Description copied from interface: VariableSpace
List the variables (not the values) that are currently in the variable space.

Specified by:
listVariables in interface VariableSpace
Returns:
Array of String variable names.

setVariable

public void setVariable(String variableName,
                        String variableValue)
Description copied from interface: VariableSpace
Sets a variable in the Kettle Variables list.

Specified by:
setVariable in interface VariableSpace
Parameters:
variableName - The name of the variable to set
variableValue - The value of the variable to set. If the variableValue is null, the variable is cleared from the list.

shareVariablesWith

public void shareVariablesWith(VariableSpace space)
Description copied from interface: VariableSpace
Share a variable space from another variable space. This means that the object should take over the space used as argument.

Specified by:
shareVariablesWith in interface VariableSpace
Parameters:
space - Variable space to be shared.

injectVariables

public void injectVariables(Map<String,String> prop)
Description copied from interface: VariableSpace
Inject variables. The behaviour should be that the properties object will be stored and at the time the VariableSpace is initialized (or upon calling this method if the space is already initialized). After injecting the link of the properties object should be removed.

Specified by:
injectVariables in interface VariableSpace
Parameters:
prop - Properties object containing key-value pairs.

getSQLServerInstance

public String getSQLServerInstance()
Returns:
the SQL Server instance

setSQLServerInstance

public void setSQLServerInstance(String instanceName)
Parameters:
instanceName - the SQL Server instance

isUsingDoubleDecimalAsSchemaTableSeparator

public boolean isUsingDoubleDecimalAsSchemaTableSeparator()
Returns:
true if the Microsoft SQL server uses two decimals (..) to separate schema and table (default==false).

setUsingDoubleDecimalAsSchemaTableSeparator

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

isRequiringTransactionsOnQueries

public boolean isRequiringTransactionsOnQueries()
Returns:
true if this database needs a transaction to perform a query (auto-commit turned off).

testConnection

public String testConnection()

getDatabaseFactory

public DatabaseFactoryInterface getDatabaseFactory()
                                            throws Exception
Throws:
Exception

getPreferredSchemaName

public String getPreferredSchemaName()

setPreferredSchemaName

public void setPreferredSchemaName(String preferredSchemaName)

getRepositoryDirectory

public RepositoryDirectoryInterface getRepositoryDirectory()
Not used in this case, simply return root /

Specified by:
getRepositoryDirectory in interface RepositoryElementInterface

setRepositoryDirectory

public void setRepositoryDirectory(RepositoryDirectoryInterface repositoryDirectory)
Specified by:
setRepositoryDirectory in interface RepositoryElementInterface

getRepositoryElementType

public RepositoryObjectType getRepositoryElementType()
Specified by:
getRepositoryElementType in interface RepositoryElementInterface

getObjectRevision

public ObjectRevision getObjectRevision()
Specified by:
getObjectRevision in interface RepositoryElementInterface

setObjectRevision

public void setObjectRevision(ObjectRevision objectRevision)
Specified by:
setObjectRevision in interface RepositoryElementInterface

getDescription

public String getDescription()
Specified by:
getDescription in interface RepositoryElementInterface

setDescription

public void setDescription(String description)
Specified by:
setDescription in interface RepositoryElementInterface

supportsSequenceNoMaxValueOption

public boolean supportsSequenceNoMaxValueOption()

requiresCreateTablePrimaryKeyAppend

public boolean requiresCreateTablePrimaryKeyAppend()

requiresCastToVariousForIsNull

public boolean requiresCastToVariousForIsNull()

isDisplaySizeTwiceThePrecision

public boolean isDisplaySizeTwiceThePrecision()

supportsPreparedStatementMetadataRetrieval

public boolean supportsPreparedStatementMetadataRetrieval()

isSystemTable

public boolean isSystemTable(String tableName)

getSQLListOfSchemas

public String getSQLListOfSchemas()

getMaxColumnsInIndex

public int getMaxColumnsInIndex()

supportsErrorHandlingOnBatchUpdates

public boolean supportsErrorHandlingOnBatchUpdates()

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.

getSQLListOfSequences

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

quoteSQLString

public String quoteSQLString(String string)

generateColumnAlias

public String generateColumnAlias(int columnIndex,
                                  String suggestedName)
See Also:
DatabaseInterface.generateColumnAlias(int, String)

isMySQLVariant

public boolean isMySQLVariant()

getNextBatchId

public Long getNextBatchId(Database ldb,
                           String schemaName,
                           String tableName,
                           String fieldName)
                    throws KettleDatabaseException
Throws:
KettleDatabaseException

getValueFromResultSet

public Object getValueFromResultSet(ResultSet rs,
                                    ValueMetaInterface val,
                                    int i)
                             throws KettleDatabaseException
Throws:
KettleDatabaseException