org.pentaho.di.core.database
Class Database

java.lang.Object
  extended by org.pentaho.di.core.database.Database
All Implemented Interfaces:
LoggingObjectInterface, VariableSpace

public class Database
extends Object
implements VariableSpace, LoggingObjectInterface

Database handles the process of connecting to, reading from, writing to and updating databases. The database specific parameters are defined in DatabaseInfo.

Since:
05-04-2003
Author:
Matt

Constructor Summary
Database(DatabaseMeta databaseMeta)
          Deprecated. Please specify the parent object so that we can see which object is initiating a database connection
Database(LoggingObjectInterface parentObject, DatabaseMeta databaseMeta)
          Construct a new Database Connection
 
Method Summary
 boolean absolute(ResultSet rs, int position)
           
 void afterLast(ResultSet rs)
           
 RowMetaAndData callProcedure(String[] arg, String[] argdir, int[] argtype, String resultname, int resulttype)
           
 void cancelQuery()
          Cancel the open/running queries on the database connection
 void cancelStatement(Statement statement)
          Cancel an open/running SQL statement
 boolean checkColumnExists(String columnname, String tablename)
          See if the column specified exists by reading
 boolean checkIndexExists(String tableName, String[] idx_fields)
          Check if an index on certain fields in a table exists.
 boolean checkIndexExists(String schemaName, String tableName, String[] idx_fields)
          Check if an index on certain fields in a table exists.
 boolean checkSequenceExists(String sequenceName)
          Check whether the sequence exists, Oracle only!
 boolean checkSequenceExists(String schemaName, String sequenceName)
          Check whether the sequence exists, Oracle only!
 boolean checkTableExists(String tablename)
          See if the table specified exists by reading
 void cleanupLogRecords(LogTableInterface logTable)
           
 void clearBatch(PreparedStatement preparedStatement)
           
 void clearInsertBatch()
          Deprecated.  
 void closeConnectionOnly()
          Only for unique connections usage, typically you use disconnect() to disconnect() from the database.
 void closeInsert()
           
 void closeLookup()
           
 void closePreparedStatement(PreparedStatement ps)
           
 void closeProcedureStatement()
           
 void closeQuery(ResultSet res)
           
 void closeUpdate()
           
 void commit()
          Perform a commit the connection if this is supported by the database
 void commit(boolean force)
           
 void connect()
          Open the database connection.
 void connect(String partitionId)
          Open the database connection.
 void connect(String group, String partitionId)
           
 void copyVariablesFrom(VariableSpace space)
          Copy the variables from another space, without initializing with the defaults.
 int countParameters(String sql)
           
 void disconnect()
          Disconnect from the database and close all open prepared statements.
 void emptyAndCommit(PreparedStatement ps, boolean batch)
          Close the passed prepared statement.
 void emptyAndCommit(PreparedStatement ps, boolean batch, int batchCounter)
          Close the prepared statement of the insert statement.
 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)
           
 Result execStatement(String sql)
          Execute an SQL statement on the database connection (has to be open)
 Result execStatement(String sql, RowMetaInterface params, Object[] data)
           
 Result execStatements(String script)
          Execute a series of SQL statements, separated by ; We are already connected...
 void first(ResultSet rs)
           
 String getAlterTableStatement(String tableName, RowMetaInterface fields, String tk, boolean use_autoinc, String pk, boolean semicolon)
           
 boolean getBooleanValueOfVariable(String variableName, boolean defaultValue)
          This method returns a boolean for the new variable check boxes.
 String[] getCatalogs()
           
 Connection getConnection()
           
 String getConnectionGroup()
           
 String getContainerObjectId()
           
 int getCopy()
           
 String getCreateIndexStatement(String tablename, String indexname, String[] idx_fields, boolean tk, boolean unique, boolean bitmap, boolean semi_colon)
           
 String getCreateIndexStatement(String schemaname, String tablename, String indexname, String[] idx_fields, boolean tk, boolean unique, boolean bitmap, boolean semi_colon)
           
 String getCreateSequenceStatement(String sequence, long start_at, long increment_by, long max_value, boolean semi_colon)
           
 String getCreateSequenceStatement(String schemaName, String sequence, long start_at, long increment_by, long max_value, boolean semi_colon)
           
 String getCreateSequenceStatement(String sequence, String start_at, String increment_by, String max_value, boolean semi_colon)
           
 String getCreateSequenceStatement(String schemaName, String sequenceName, String start_at, String increment_by, String max_value, boolean semi_colon)
           
 String getCreateTableStatement(String tableName, RowMetaInterface fields, String tk, boolean use_autoinc, String pk, boolean semicolon)
          Generates SQL
 DatabaseMeta getDatabaseMeta()
           
 DatabaseMetaData getDatabaseMetaData()
           
 String getDDL(String tablename, RowMetaInterface fields)
           
 String getDDL(String tablename, RowMetaInterface fields, String tk, boolean use_autoinc, String pk)
           
 String getDDL(String tableName, RowMetaInterface fields, String tk, boolean use_autoinc, String pk, boolean semicolon)
           
 String getDDLCreationTable(String tableName, RowMetaInterface fields)
          Return SQL CREATION statement for a Table
 String getDDLTruncateTable(String schema, String tablename)
          Return SQL TRUNCATE statement for a Table
 String getFilename()
           
 List<Object[]> getFirstRows(String table_name, int limit)
           
 List<Object[]> getFirstRows(String table_name, int limit, ProgressMonitorListener monitor)
          Get the first rows from a table (for preview)
 RowMetaAndData getGeneratedKeys(PreparedStatement ps)
           
 String getInsertStatement(String tableName, RowMetaInterface fields)
           
 String getInsertStatement(String schemaName, String tableName, RowMetaInterface fields)
           
 Object[] getLastLogDate(String logtable, String name, boolean job, LogStatus status)
           
 String getLogChannelId()
           
 LogLevel getLogLevel()
           
 Object[] getLookup()
           
 Object[] getLookup(boolean failOnMultipleResults)
           
 Object[] getLookup(PreparedStatement ps)
           
 Object[] getLookup(PreparedStatement ps, boolean failOnMultipleResults)
           
 RowMeta getMetaFromRow(Object[] row, ResultSetMetaData md)
           
 Long getNextSequenceValue(String sequenceName, String keyfield)
           
 Long getNextSequenceValue(String schemaName, String sequenceName, String keyfield)
           
 Long getNextValue(Hashtable<String,Counter> counters, String tableName, String val_key)
           
 Long getNextValue(Hashtable<String,Counter> counters, String schemaName, String tableName, String val_key)
           
 int getNrExecutedCommits()
           
 String getObjectCopy()
           
 ObjectId getObjectId()
           
 String getObjectName()
           
 ObjectRevision getObjectRevision()
           
 LoggingObjectType getObjectType()
           
 RowMetaAndData getOneRow(String sql)
          Execute a query and return at most one row from the resultset
 RowMetaAndData getOneRow(String sql, RowMetaInterface param, Object[] data)
           
 int getOpened()
           
 RowMetaInterface getParameterMetaData(PreparedStatement ps)
           
 RowMetaInterface getParameterMetaData(String sql, RowMetaInterface inform, Object[] data)
           
 LoggingObjectInterface getParent()
           
 Object getParentObject()
           
 VariableSpace getParentVariableSpace()
          Get the parent of the variable space.
 String getPartitionId()
           
 PreparedStatement getPrepStatementInsert()
           
 PreparedStatement getPrepStatementLookup()
           
 PreparedStatement getPrepStatementUpdate()
           
 String[] getPrimaryKeyColumnNames(String tablename)
          Return primary key column names ...
 String[] getProcedures()
           
 RowMetaInterface getQueryFields(String sql, boolean param)
           
 RowMetaInterface getQueryFields(String sql, boolean param, RowMetaInterface inform, Object[] data)
           
 Date getRegistrationDate()
          Stub
 RepositoryDirectory getRepositoryDirectory()
           
 RowMetaInterface getReturnRowMeta()
           
 Object[] getRow(ResultSet rs)
          Get a row from the resultset.
 Object[] getRow(ResultSet rs, boolean lazyConversion)
          Get a row from the resultset.
 Object[] getRow(ResultSet rs, ResultSetMetaData dummy, RowMetaInterface rowInfo)
          Get a row from the resultset.
 List<Object[]> getRows(ResultSet rset, int limit, ProgressMonitorListener monitor)
          Reads the result of a ResultSet into an ArrayList
 List<Object[]> getRows(String sql, int limit)
          Reads the result of an SQL query into an ArrayList
 List<Object[]> getRows(String sql, int limit, ProgressMonitorListener monitor)
          Reads the result of an SQL query into an ArrayList
 String[] getSchemas()
           
 String[] getSequences()
          Return all sequence names from connection
 String getSQLOutput(String schemaName, String tableName, RowMetaInterface fields, Object[] r, String dateFormat)
          Return SQL statement (INSERT INTO TableName ...
 Map<String,Collection<String>> getSynonymMap()
           
 Map<String,Collection<String>> getSynonymMap(String schemanamein)
           
 String[] getSynonyms()
           
 String[] getSynonyms(boolean includeSchema)
           
 String[] getSynonyms(String schemanamein, boolean includeSchema)
           
 RowMetaInterface getTableFields(String tablename)
           
 Map<String,Collection<String>> getTableMap()
           
 Map<String,Collection<String>> getTableMap(String schemanamein)
           
 String[] getTablenames()
           
 String[] getTablenames(boolean includeSchema)
           
 String[] getTablenames(String schemanamein, boolean includeSchema)
           
 String[] getTableTypes()
           
 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.
 Map<String,Collection<String>> getViewMap()
           
 Map<String,Collection<String>> getViewMap(String schemanamein)
           
 String[] getViews()
           
 String[] getViews(boolean includeSchema)
           
 String[] getViews(String schemanamein, boolean includeSchema)
           
 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.
 void insertFinished(boolean batch)
           
 void insertFinished(PreparedStatement ps, boolean batch)
          Deprecated. use emptyAndCommit() instead (pass in the number of rows left in the batch)
 void insertRow()
           
 void insertRow(boolean batch)
           
 void insertRow(PreparedStatement ps)
           
 boolean insertRow(PreparedStatement ps, boolean batch)
          Insert a row into the database using a prepared statement that has all values set.
 boolean insertRow(PreparedStatement ps, boolean batch, boolean handleCommit)
          Insert a row into the database using a prepared statement that has all values set.
 void insertRow(String tableName, RowMetaInterface fields, Object[] data)
           
 void insertRow(String schemaName, String tableName, RowMetaInterface fields, Object[] data)
           
 boolean isAutoCommit()
           
 boolean isSystemTable(String table_name)
           
 String[] listVariables()
          List the variables (not the values) that are currently in the variable space.
 void lockTables(String[] tableNames)
          Lock a tables in the database for write operations
 void normalConnect(String partitionId)
          Open the database connection.
 ResultSet openQuery(PreparedStatement ps, RowMetaInterface params, Object[] data)
           
 ResultSet openQuery(String sql)
           
 ResultSet openQuery(String sql, RowMetaInterface params, Object[] data)
          Open a query on the database with a set of parameters stored in a Kettle Row
 ResultSet openQuery(String sql, RowMetaInterface params, Object[] data, int fetch_mode)
           
 ResultSet openQuery(String sql, RowMetaInterface params, Object[] data, int fetch_mode, boolean lazyConversion)
           
 boolean prepareDelete(String table, String[] codes, String[] condition)
          Prepare a delete statement by giving it the tablename, fields and conditions to work with.
 boolean prepareDelete(String schemaName, String tableName, String[] codes, String[] condition)
          Prepare a delete statement by giving it the tablename, fields and conditions to work with.
 void prepareInsert(RowMetaInterface rowMeta, String tableName)
          Prepare inserting values into a table, using the fields & values in a Row
 void prepareInsert(RowMetaInterface rowMeta, String schemaName, String tableName)
          Prepare inserting values into a table, using the fields & values in a Row
 PreparedStatement prepareSQL(String sql)
          Prepare a statement to be executed on the database.
 PreparedStatement prepareSQL(String sql, boolean returnKeys)
          Prepare a statement to be executed on the database.
 boolean prepareUpdate(String table, String[] codes, String[] condition, String[] sets)
           
 boolean prepareUpdate(String schemaName, String tableName, String[] codes, String[] condition, String[] sets)
           
 void printSQLException(SQLException ex)
           
 boolean relative(ResultSet rs, int rows)
           
 void releaseSavepoint(Savepoint savepoint)
           
 void rollback()
           
 void rollback(boolean force)
           
 void rollback(Savepoint savepoint)
           
 void setAutoCommit(boolean useAutoCommit)
           
 void setCommit(int commsize)
          Specify after how many rows a commit needs to occur when inserting or updating values.
 void setConnection(Connection connection)
          Allows for the injection of a "life" connection, generated by a piece of software outside of Kettle.
 void setConnectionGroup(String connectionGroup)
           
 void setContainerObjectId(String containerObjectId)
           
 void setCopy(int copy)
           
 void setLogLevel(LogLevel logLevel)
           
 void setLookup(String table, String[] codes, String[] condition, String[] gets, String[] rename, String orderby)
           
 void setLookup(String tableName, String[] codes, String[] condition, String[] gets, String[] rename, String orderby, boolean checkForMultipleResults)
           
 void setLookup(String schema, String table, String[] codes, String[] condition, String[] gets, String[] rename, String orderby)
           
 void setLookup(String schemaName, String tableName, String[] codes, String[] condition, String[] gets, String[] rename, String orderby, boolean checkForMultipleResults)
           
 void setNrExecutedCommits(int nrExecutedCommits)
           
 void setOpened(int opened)
           
 void setParentVariableSpace(VariableSpace parent)
          Set the parent variable space
 void setPartitionId(String partitionId)
           
 void setProcLookup(String proc, String[] arg, String[] argdir, int[] argtype, String returnvalue, int returntype)
           
 void setProcValues(RowMetaInterface rowMeta, Object[] data, int[] argnrs, String[] argdir, boolean result)
           
 void setQueryLimit(int rows)
          Set the maximum number of records to retrieve from a query.
 Savepoint setSavepoint()
           
 Savepoint setSavepoint(String savePointName)
           
 void setValue(PreparedStatement ps, ValueMetaInterface v, Object object, int pos)
           
 void setValues(RowMetaAndData row)
           
 void setValues(RowMetaAndData row, PreparedStatement ps)
           
 void setValues(RowMetaInterface rowMeta, Object[] data)
           
 void setValues(RowMetaInterface rowMeta, Object[] data, PreparedStatement ps)
           
 void setValues(RowMetaInterface rowMeta, Object[] data, PreparedStatement ps, int ignoreThisValueIndex)
          Sets the values of the preparedStatement pstmt.
 void setValuesInsert(RowMetaAndData row)
           
 void setValuesInsert(RowMetaInterface rowMeta, Object[] data)
           
 void setValuesLookup(RowMetaInterface rowMeta, Object[] data)
           
 void setValuesUpdate(RowMetaInterface rowMeta, Object[] data)
           
 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 toString()
           
 void truncateTable(String tablename)
           
 void truncateTable(String schema, String tablename)
           
 void unlockTables(String[] tableNames)
          Unlock certain tables in the database for write operations
 void updateRow()
           
 void writeLogRecord(LogTableInterface logTable, LogStatus status, Object subject, Object parent)
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Database

public Database(DatabaseMeta databaseMeta)
Deprecated. Please specify the parent object so that we can see which object is initiating a database connection

Construct a new Database Connection

Parameters:
databaseMeta - The Database Connection Info to construct the connection with.

Database

public Database(LoggingObjectInterface parentObject,
                DatabaseMeta databaseMeta)
Construct a new Database Connection

Parameters:
databaseMeta - The Database Connection Info to construct the connection with.
Method Detail

equals

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

setConnection

public void setConnection(Connection connection)
Allows for the injection of a "life" connection, generated by a piece of software outside of Kettle.

Parameters:
connection -

getConnection

public Connection getConnection()
Returns:
Returns the connection.

setQueryLimit

public void setQueryLimit(int rows)
Set the maximum number of records to retrieve from a query.

Parameters:
rows -

getPrepStatementInsert

public PreparedStatement getPrepStatementInsert()
Returns:
Returns the prepStatementInsert.

getPrepStatementLookup

public PreparedStatement getPrepStatementLookup()
Returns:
Returns the prepStatementLookup.

getPrepStatementUpdate

public PreparedStatement getPrepStatementUpdate()
Returns:
Returns the prepStatementUpdate.

connect

public void connect()
             throws KettleDatabaseException
Open the database connection.

Throws:
KettleDatabaseException - if something went wrong.

connect

public void connect(String partitionId)
             throws KettleDatabaseException
Open the database connection.

Parameters:
partitionId - the partition ID in the cluster to connect to.
Throws:
KettleDatabaseException - if something went wrong.

connect

public void connect(String group,
                    String partitionId)
             throws KettleDatabaseException
Throws:
KettleDatabaseException

normalConnect

public void normalConnect(String partitionId)
                   throws KettleDatabaseException
Open the database connection.

Parameters:
partitionId - the partition ID in the cluster to connect to.
Throws:
KettleDatabaseException - if something went wrong.

disconnect

public void disconnect()
Disconnect from the database and close all open prepared statements.


closeConnectionOnly

public void closeConnectionOnly()
                         throws KettleDatabaseException
Only for unique connections usage, typically you use disconnect() to disconnect() from the database.

Throws:
KettleDatabaseException - in case there is an error during connection close.

cancelQuery

public void cancelQuery()
                 throws KettleDatabaseException
Cancel the open/running queries on the database connection

Throws:
KettleDatabaseException

cancelStatement

public void cancelStatement(Statement statement)
                     throws KettleDatabaseException
Cancel an open/running SQL statement

Parameters:
statement - the statement to cancel
Throws:
KettleDatabaseException

setCommit

public void setCommit(int commsize)
Specify after how many rows a commit needs to occur when inserting or updating values.

Parameters:
commsize - The number of rows to wait before doing a commit on the connection.

setAutoCommit

public void setAutoCommit(boolean useAutoCommit)
                   throws KettleDatabaseException
Throws:
KettleDatabaseException

commit

public void commit()
            throws KettleDatabaseException
Perform a commit the connection if this is supported by the database

Throws:
KettleDatabaseException

commit

public void commit(boolean force)
            throws KettleDatabaseException
Throws:
KettleDatabaseException

rollback

public void rollback()
              throws KettleDatabaseException
Throws:
KettleDatabaseException

rollback

public void rollback(boolean force)
              throws KettleDatabaseException
Throws:
KettleDatabaseException

prepareInsert

public void prepareInsert(RowMetaInterface rowMeta,
                          String tableName)
                   throws KettleDatabaseException
Prepare inserting values into a table, using the fields & values in a Row

Parameters:
rowMeta - The row metadata to determine which values need to be inserted
table - The name of the table in which we want to insert rows
Throws:
KettleDatabaseException - if something went wrong.

prepareInsert

public void prepareInsert(RowMetaInterface rowMeta,
                          String schemaName,
                          String tableName)
                   throws KettleDatabaseException
Prepare inserting values into a table, using the fields & values in a Row

Parameters:
rowMeta - The metadata row to determine which values need to be inserted
schemaName - The name of the schema in which we want to insert rows
tableName - The name of the table in which we want to insert rows
Throws:
KettleDatabaseException - if something went wrong.

prepareSQL

public PreparedStatement prepareSQL(String sql)
                             throws KettleDatabaseException
Prepare a statement to be executed on the database. (does not return generated keys)

Parameters:
sql - The SQL to be prepared
Returns:
The PreparedStatement object.
Throws:
KettleDatabaseException

prepareSQL

public PreparedStatement prepareSQL(String sql,
                                    boolean returnKeys)
                             throws KettleDatabaseException
Prepare a statement to be executed on the database.

Parameters:
sql - The SQL to be prepared
returnKeys - set to true if you want to return generated keys from an insert statement
Returns:
The PreparedStatement object.
Throws:
KettleDatabaseException

closeLookup

public void closeLookup()
                 throws KettleDatabaseException
Throws:
KettleDatabaseException

closePreparedStatement

public void closePreparedStatement(PreparedStatement ps)
                            throws KettleDatabaseException
Throws:
KettleDatabaseException

closeInsert

public void closeInsert()
                 throws KettleDatabaseException
Throws:
KettleDatabaseException

closeUpdate

public void closeUpdate()
                 throws KettleDatabaseException
Throws:
KettleDatabaseException

setValues

public void setValues(RowMetaInterface rowMeta,
                      Object[] data)
               throws KettleDatabaseException
Throws:
KettleDatabaseException

setValues

public void setValues(RowMetaAndData row)
               throws KettleDatabaseException
Throws:
KettleDatabaseException

setValuesInsert

public void setValuesInsert(RowMetaInterface rowMeta,
                            Object[] data)
                     throws KettleDatabaseException
Throws:
KettleDatabaseException

setValuesInsert

public void setValuesInsert(RowMetaAndData row)
                     throws KettleDatabaseException
Throws:
KettleDatabaseException

setValuesUpdate

public void setValuesUpdate(RowMetaInterface rowMeta,
                            Object[] data)
                     throws KettleDatabaseException
Throws:
KettleDatabaseException

setValuesLookup

public void setValuesLookup(RowMetaInterface rowMeta,
                            Object[] data)
                     throws KettleDatabaseException
Throws:
KettleDatabaseException

setProcValues

public void setProcValues(RowMetaInterface rowMeta,
                          Object[] data,
                          int[] argnrs,
                          String[] argdir,
                          boolean result)
                   throws KettleDatabaseException
Throws:
KettleDatabaseException

setValue

public void setValue(PreparedStatement ps,
                     ValueMetaInterface v,
                     Object object,
                     int pos)
              throws KettleDatabaseException
Throws:
KettleDatabaseException

setValues

public void setValues(RowMetaAndData row,
                      PreparedStatement ps)
               throws KettleDatabaseException
Throws:
KettleDatabaseException

setValues

public void setValues(RowMetaInterface rowMeta,
                      Object[] data,
                      PreparedStatement ps)
               throws KettleDatabaseException
Throws:
KettleDatabaseException

setValues

public void setValues(RowMetaInterface rowMeta,
                      Object[] data,
                      PreparedStatement ps,
                      int ignoreThisValueIndex)
               throws KettleDatabaseException
Sets the values of the preparedStatement pstmt.

Parameters:
rowMeta -
data -
Throws:
KettleDatabaseException

getGeneratedKeys

public RowMetaAndData getGeneratedKeys(PreparedStatement ps)
                                throws KettleDatabaseException
Parameters:
ps - The prepared insert statement to use
Returns:
The generated keys in auto-increment fields
Throws:
KettleDatabaseException - in case something goes wrong retrieving the keys.

getNextSequenceValue

public Long getNextSequenceValue(String sequenceName,
                                 String keyfield)
                          throws KettleDatabaseException
Throws:
KettleDatabaseException

getNextSequenceValue

public Long getNextSequenceValue(String schemaName,
                                 String sequenceName,
                                 String keyfield)
                          throws KettleDatabaseException
Throws:
KettleDatabaseException

insertRow

public void insertRow(String tableName,
                      RowMetaInterface fields,
                      Object[] data)
               throws KettleDatabaseException
Throws:
KettleDatabaseException

insertRow

public void insertRow(String schemaName,
                      String tableName,
                      RowMetaInterface fields,
                      Object[] data)
               throws KettleDatabaseException
Throws:
KettleDatabaseException

getInsertStatement

public String getInsertStatement(String tableName,
                                 RowMetaInterface fields)

getInsertStatement

public String getInsertStatement(String schemaName,
                                 String tableName,
                                 RowMetaInterface fields)

insertRow

public void insertRow()
               throws KettleDatabaseException
Throws:
KettleDatabaseException

insertRow

public void insertRow(boolean batch)
               throws KettleDatabaseException
Throws:
KettleDatabaseException

updateRow

public void updateRow()
               throws KettleDatabaseException
Throws:
KettleDatabaseException

insertRow

public void insertRow(PreparedStatement ps)
               throws KettleDatabaseException
Throws:
KettleDatabaseException

insertRow

public boolean insertRow(PreparedStatement ps,
                         boolean batch)
                  throws KettleDatabaseException
Insert a row into the database using a prepared statement that has all values set.

Parameters:
ps - The prepared statement
batch - True if you want to use batch inserts (size = commit size)
Returns:
true if the rows are safe: if batch of rows was sent to the database OR if a commit was done.
Throws:
KettleDatabaseException

insertRow

public boolean insertRow(PreparedStatement ps,
                         boolean batch,
                         boolean handleCommit)
                  throws KettleDatabaseException
Insert a row into the database using a prepared statement that has all values set.

Parameters:
ps - The prepared statement
batch - True if you want to use batch inserts (size = commit size)
handleCommit - True if you want to handle the commit here after the commit size (False e.g. in case the step handles this, see TableOutput)
Returns:
true if the rows are safe: if batch of rows was sent to the database OR if a commit was done.
Throws:
KettleDatabaseException

clearInsertBatch

public void clearInsertBatch()
                      throws KettleDatabaseException
Deprecated. 

Clears batch of insert prepared statement

Throws:
KettleDatabaseException

clearBatch

public void clearBatch(PreparedStatement preparedStatement)
                throws KettleDatabaseException
Throws:
KettleDatabaseException

insertFinished

public void insertFinished(boolean batch)
                    throws KettleDatabaseException
Throws:
KettleDatabaseException

emptyAndCommit

public void emptyAndCommit(PreparedStatement ps,
                           boolean batch)
                    throws KettleDatabaseException
Close the passed prepared statement. This object's "written" property is passed to the method that does the execute and commit.

Parameters:
ps -
batch -
Throws:
KettleDatabaseException

emptyAndCommit

public void emptyAndCommit(PreparedStatement ps,
                           boolean batch,
                           int batchCounter)
                    throws KettleDatabaseException
Close the prepared statement of the insert statement.

Parameters:
ps - The prepared statement to empty and close.
batch - true if you are using batch processing
psBatchCounter - The number of rows on the batch queue
Throws:
KettleDatabaseException

insertFinished

public void insertFinished(PreparedStatement ps,
                           boolean batch)
                    throws KettleDatabaseException
Deprecated. use emptyAndCommit() instead (pass in the number of rows left in the batch)

Close the prepared statement of the insert statement.

Parameters:
ps - The prepared statement to empty and close.
batch - true if you are using batch processing (typically true for this method)
psBatchCounter - The number of rows on the batch queue
Throws:
KettleDatabaseException

execStatement

public Result execStatement(String sql)
                     throws KettleDatabaseException
Execute an SQL statement on the database connection (has to be open)

Parameters:
sql - The SQL to execute
Returns:
a Result object indicating the number of lines read, deleted, inserted, updated, ...
Throws:
KettleDatabaseException - in case anything goes wrong.

execStatement

public Result execStatement(String sql,
                            RowMetaInterface params,
                            Object[] data)
                     throws KettleDatabaseException
Throws:
KettleDatabaseException

execStatements

public Result execStatements(String script)
                      throws KettleDatabaseException
Execute a series of SQL statements, separated by ; We are already connected... Multiple statements have to be split into parts We use the ";" to separate statements... We keep the results in Result object from Jobs

Parameters:
script - The SQL script to be execute
Returns:
A result with counts of the number or records updates, inserted, deleted or read.
Throws:
KettleDatabaseException - In case an error occurs

openQuery

public ResultSet openQuery(String sql)
                    throws KettleDatabaseException
Throws:
KettleDatabaseException

openQuery

public ResultSet openQuery(String sql,
                           RowMetaInterface params,
                           Object[] data)
                    throws KettleDatabaseException
Open a query on the database with a set of parameters stored in a Kettle Row

Parameters:
sql - The SQL to launch with question marks (?) as placeholders for the parameters
params - The parameters or null if no parameters are used.
Returns:
A JDBC ResultSet
Throws:
KettleDatabaseException - when something goes wrong with the query.

openQuery

public ResultSet openQuery(String sql,
                           RowMetaInterface params,
                           Object[] data,
                           int fetch_mode)
                    throws KettleDatabaseException
Throws:
KettleDatabaseException

openQuery

public ResultSet openQuery(String sql,
                           RowMetaInterface params,
                           Object[] data,
                           int fetch_mode,
                           boolean lazyConversion)
                    throws KettleDatabaseException
Throws:
KettleDatabaseException

openQuery

public ResultSet openQuery(PreparedStatement ps,
                           RowMetaInterface params,
                           Object[] data)
                    throws KettleDatabaseException
Throws:
KettleDatabaseException

getTableFields

public RowMetaInterface getTableFields(String tablename)
                                throws KettleDatabaseException
Throws:
KettleDatabaseException

getQueryFields

public RowMetaInterface getQueryFields(String sql,
                                       boolean param)
                                throws KettleDatabaseException
Throws:
KettleDatabaseException

checkTableExists

public boolean checkTableExists(String tablename)
                         throws KettleDatabaseException
See if the table specified exists by reading

Parameters:
tablename - The name of the table to check.
This is supposed to be the properly quoted name of the table or the complete schema-table name combination.
Returns:
true if the table exists, false if it doesn't.
Throws:
KettleDatabaseException

checkColumnExists

public boolean checkColumnExists(String columnname,
                                 String tablename)
                          throws KettleDatabaseException
See if the column specified exists by reading

Parameters:
columnname - The name of the column to check.
tablename - The name of the table to check.
This is supposed to be the properly quoted name of the table or the complete schema-table name combination.
Returns:
true if the table exists, false if it doesn't.
Throws:
KettleDatabaseException

checkSequenceExists

public boolean checkSequenceExists(String sequenceName)
                            throws KettleDatabaseException
Check whether the sequence exists, Oracle only!

Parameters:
sequenceName - The name of the sequence
Returns:
true if the sequence exists.
Throws:
KettleDatabaseException

checkSequenceExists

public boolean checkSequenceExists(String schemaName,
                                   String sequenceName)
                            throws KettleDatabaseException
Check whether the sequence exists, Oracle only!

Parameters:
sequenceName - The name of the sequence
Returns:
true if the sequence exists.
Throws:
KettleDatabaseException

checkIndexExists

public boolean checkIndexExists(String tableName,
                                String[] idx_fields)
                         throws KettleDatabaseException
Check if an index on certain fields in a table exists.

Parameters:
tableName - The table on which the index is checked
idx_fields - The fields on which the indexe is checked
Returns:
True if the index exists
Throws:
KettleDatabaseException

checkIndexExists

public boolean checkIndexExists(String schemaName,
                                String tableName,
                                String[] idx_fields)
                         throws KettleDatabaseException
Check if an index on certain fields in a table exists.

Parameters:
tablename - The table on which the index is checked
idx_fields - The fields on which the indexe is checked
Returns:
True if the index exists
Throws:
KettleDatabaseException

getCreateIndexStatement

public String getCreateIndexStatement(String tablename,
                                      String indexname,
                                      String[] idx_fields,
                                      boolean tk,
                                      boolean unique,
                                      boolean bitmap,
                                      boolean semi_colon)

getCreateIndexStatement

public String getCreateIndexStatement(String schemaname,
                                      String tablename,
                                      String indexname,
                                      String[] idx_fields,
                                      boolean tk,
                                      boolean unique,
                                      boolean bitmap,
                                      boolean semi_colon)

getCreateSequenceStatement

public String getCreateSequenceStatement(String sequence,
                                         long start_at,
                                         long increment_by,
                                         long max_value,
                                         boolean semi_colon)

getCreateSequenceStatement

public String getCreateSequenceStatement(String sequence,
                                         String start_at,
                                         String increment_by,
                                         String max_value,
                                         boolean semi_colon)

getCreateSequenceStatement

public String getCreateSequenceStatement(String schemaName,
                                         String sequence,
                                         long start_at,
                                         long increment_by,
                                         long max_value,
                                         boolean semi_colon)

getCreateSequenceStatement

public String getCreateSequenceStatement(String schemaName,
                                         String sequenceName,
                                         String start_at,
                                         String increment_by,
                                         String max_value,
                                         boolean semi_colon)

getQueryFields

public RowMetaInterface getQueryFields(String sql,
                                       boolean param,
                                       RowMetaInterface inform,
                                       Object[] data)
                                throws KettleDatabaseException
Throws:
KettleDatabaseException

closeQuery

public void closeQuery(ResultSet res)
                throws KettleDatabaseException
Throws:
KettleDatabaseException

absolute

public boolean absolute(ResultSet rs,
                        int position)
                 throws KettleDatabaseException
Throws:
KettleDatabaseException

relative

public boolean relative(ResultSet rs,
                        int rows)
                 throws KettleDatabaseException
Throws:
KettleDatabaseException

afterLast

public void afterLast(ResultSet rs)
               throws KettleDatabaseException
Throws:
KettleDatabaseException

first

public void first(ResultSet rs)
           throws KettleDatabaseException
Throws:
KettleDatabaseException

getRow

public Object[] getRow(ResultSet rs)
                throws KettleDatabaseException
Get a row from the resultset. Do not use lazy conversion

Parameters:
rs - The resultset to get the row from
Returns:
one row or null if no row was found on the resultset or if an error occurred.
Throws:
KettleDatabaseException

getRow

public Object[] getRow(ResultSet rs,
                       boolean lazyConversion)
                throws KettleDatabaseException
Get a row from the resultset.

Parameters:
rs - The resultset to get the row from
lazyConversion - set to true if strings need to have lazy conversion enabled
Returns:
one row or null if no row was found on the resultset or if an error occurred.
Throws:
KettleDatabaseException

getRow

public Object[] getRow(ResultSet rs,
                       ResultSetMetaData dummy,
                       RowMetaInterface rowInfo)
                throws KettleDatabaseException
Get a row from the resultset.

Parameters:
rs - The resultset to get the row from
Returns:
one row or null if no row was found on the resultset or if an error occurred.
Throws:
KettleDatabaseException

printSQLException

public void printSQLException(SQLException ex)

setLookup

public void setLookup(String table,
                      String[] codes,
                      String[] condition,
                      String[] gets,
                      String[] rename,
                      String orderby)
               throws KettleDatabaseException
Throws:
KettleDatabaseException

setLookup

public void setLookup(String schema,
                      String table,
                      String[] codes,
                      String[] condition,
                      String[] gets,
                      String[] rename,
                      String orderby)
               throws KettleDatabaseException
Throws:
KettleDatabaseException

setLookup

public void setLookup(String tableName,
                      String[] codes,
                      String[] condition,
                      String[] gets,
                      String[] rename,
                      String orderby,
                      boolean checkForMultipleResults)
               throws KettleDatabaseException
Throws:
KettleDatabaseException

setLookup

public void setLookup(String schemaName,
                      String tableName,
                      String[] codes,
                      String[] condition,
                      String[] gets,
                      String[] rename,
                      String orderby,
                      boolean checkForMultipleResults)
               throws KettleDatabaseException
Throws:
KettleDatabaseException

prepareUpdate

public boolean prepareUpdate(String table,
                             String[] codes,
                             String[] condition,
                             String[] sets)

prepareUpdate

public boolean prepareUpdate(String schemaName,
                             String tableName,
                             String[] codes,
                             String[] condition,
                             String[] sets)

prepareDelete

public boolean prepareDelete(String table,
                             String[] codes,
                             String[] condition)
Prepare a delete statement by giving it the tablename, fields and conditions to work with.

Parameters:
table - The table-name to delete in
codes -
condition -
Returns:
true when everything went OK, false when something went wrong.

prepareDelete

public boolean prepareDelete(String schemaName,
                             String tableName,
                             String[] codes,
                             String[] condition)
Prepare a delete statement by giving it the tablename, fields and conditions to work with.

Parameters:
schemaName - the schema-name to delete in
tableName - The table-name to delete in
codes -
condition -
Returns:
true when everything went OK, false when something went wrong.

setProcLookup

public void setProcLookup(String proc,
                          String[] arg,
                          String[] argdir,
                          int[] argtype,
                          String returnvalue,
                          int returntype)
                   throws KettleDatabaseException
Throws:
KettleDatabaseException

getLookup

public Object[] getLookup()
                   throws KettleDatabaseException
Throws:
KettleDatabaseException

getLookup

public Object[] getLookup(boolean failOnMultipleResults)
                   throws KettleDatabaseException
Throws:
KettleDatabaseException

getLookup

public Object[] getLookup(PreparedStatement ps)
                   throws KettleDatabaseException
Throws:
KettleDatabaseException

getLookup

public Object[] getLookup(PreparedStatement ps,
                          boolean failOnMultipleResults)
                   throws KettleDatabaseException
Throws:
KettleDatabaseException

getDatabaseMetaData

public DatabaseMetaData getDatabaseMetaData()
                                     throws KettleDatabaseException
Throws:
KettleDatabaseException

getDDL

public String getDDL(String tablename,
                     RowMetaInterface fields)
              throws KettleDatabaseException
Throws:
KettleDatabaseException

getDDL

public String getDDL(String tablename,
                     RowMetaInterface fields,
                     String tk,
                     boolean use_autoinc,
                     String pk)
              throws KettleDatabaseException
Throws:
KettleDatabaseException

getDDL

public String getDDL(String tableName,
                     RowMetaInterface fields,
                     String tk,
                     boolean use_autoinc,
                     String pk,
                     boolean semicolon)
              throws KettleDatabaseException
Throws:
KettleDatabaseException

getCreateTableStatement

public String getCreateTableStatement(String tableName,
                                      RowMetaInterface fields,
                                      String tk,
                                      boolean use_autoinc,
                                      String pk,
                                      boolean semicolon)
Generates SQL

Parameters:
tableName - the table name or schema/table combination: this needs to be quoted properly in advance.
fields - the fields
tk - the name of the technical key field
use_autoinc - true if we need to use auto-increment fields for a primary key
pk - the name of the primary/technical key field
semicolon - append semicolon to the statement
pkc - primary key composite ( name of the key fields)
Returns:
the SQL needed to create the specified table and fields.

getAlterTableStatement

public String getAlterTableStatement(String tableName,
                                     RowMetaInterface fields,
                                     String tk,
                                     boolean use_autoinc,
                                     String pk,
                                     boolean semicolon)
                              throws KettleDatabaseException
Throws:
KettleDatabaseException

truncateTable

public void truncateTable(String tablename)
                   throws KettleDatabaseException
Throws:
KettleDatabaseException

truncateTable

public void truncateTable(String schema,
                          String tablename)
                   throws KettleDatabaseException
Throws:
KettleDatabaseException

getOneRow

public RowMetaAndData getOneRow(String sql)
                         throws KettleDatabaseException
Execute a query and return at most one row from the resultset

Parameters:
sql - The SQL for the query
Returns:
one Row with data or null if nothing was found.
Throws:
KettleDatabaseException

getMetaFromRow

public RowMeta getMetaFromRow(Object[] row,
                              ResultSetMetaData md)
                       throws SQLException
Throws:
SQLException

getOneRow

public RowMetaAndData getOneRow(String sql,
                                RowMetaInterface param,
                                Object[] data)
                         throws KettleDatabaseException
Throws:
KettleDatabaseException

getParameterMetaData

public RowMetaInterface getParameterMetaData(PreparedStatement ps)

countParameters

public int countParameters(String sql)

getParameterMetaData

public RowMetaInterface getParameterMetaData(String sql,
                                             RowMetaInterface inform,
                                             Object[] data)

writeLogRecord

public void writeLogRecord(LogTableInterface logTable,
                           LogStatus status,
                           Object subject,
                           Object parent)
                    throws KettleException
Throws:
KettleException

cleanupLogRecords

public void cleanupLogRecords(LogTableInterface logTable)
                       throws KettleException
Throws:
KettleException

getLastLogDate

public Object[] getLastLogDate(String logtable,
                               String name,
                               boolean job,
                               LogStatus status)
                        throws KettleDatabaseException
Throws:
KettleDatabaseException

getNextValue

public Long getNextValue(Hashtable<String,Counter> counters,
                         String tableName,
                         String val_key)
                  throws KettleDatabaseException
Throws:
KettleDatabaseException

getNextValue

public Long getNextValue(Hashtable<String,Counter> counters,
                         String schemaName,
                         String tableName,
                         String val_key)
                  throws KettleDatabaseException
Throws:
KettleDatabaseException

toString

public String toString()
Overrides:
toString in class Object

isSystemTable

public boolean isSystemTable(String table_name)

getRows

public List<Object[]> getRows(String sql,
                              int limit)
                       throws KettleDatabaseException
Reads the result of an SQL query into an ArrayList

Parameters:
sql - The SQL to launch
limit - <=0 means unlimited, otherwise this specifies the maximum number of rows read.
Returns:
An ArrayList of rows.
Throws:
KettleDatabaseException - if something goes wrong.

getRows

public List<Object[]> getRows(String sql,
                              int limit,
                              ProgressMonitorListener monitor)
                       throws KettleDatabaseException
Reads the result of an SQL query into an ArrayList

Parameters:
sql - The SQL to launch
limit - <=0 means unlimited, otherwise this specifies the maximum number of rows read.
monitor - The progress monitor to update while getting the rows.
Returns:
An ArrayList of rows.
Throws:
KettleDatabaseException - if something goes wrong.

getRows

public List<Object[]> getRows(ResultSet rset,
                              int limit,
                              ProgressMonitorListener monitor)
                       throws KettleDatabaseException
Reads the result of a ResultSet into an ArrayList

Parameters:
rset - the ResultSet to read out
limit - <=0 means unlimited, otherwise this specifies the maximum number of rows read.
monitor - The progress monitor to update while getting the rows.
Returns:
An ArrayList of rows.
Throws:
KettleDatabaseException - if something goes wrong.

getFirstRows

public List<Object[]> getFirstRows(String table_name,
                                   int limit)
                            throws KettleDatabaseException
Throws:
KettleDatabaseException

getFirstRows

public List<Object[]> getFirstRows(String table_name,
                                   int limit,
                                   ProgressMonitorListener monitor)
                            throws KettleDatabaseException
Get the first rows from a table (for preview)

Parameters:
table_name - The table name (or schema/table combination): this needs to be quoted properly
limit - limit <=0 means unlimited, otherwise this specifies the maximum number of rows read.
monitor - The progress monitor to update while getting the rows.
Returns:
An ArrayList of rows.
Throws:
KettleDatabaseException - in case something goes wrong

getReturnRowMeta

public RowMetaInterface getReturnRowMeta()

getTableTypes

public String[] getTableTypes()
                       throws KettleDatabaseException
Throws:
KettleDatabaseException

getTablenames

public String[] getTablenames()
                       throws KettleDatabaseException
Throws:
KettleDatabaseException

getTablenames

public String[] getTablenames(boolean includeSchema)
                       throws KettleDatabaseException
Throws:
KettleDatabaseException

getTablenames

public String[] getTablenames(String schemanamein,
                              boolean includeSchema)
                       throws KettleDatabaseException
Throws:
KettleDatabaseException

getTableMap

public Map<String,Collection<String>> getTableMap()
                                           throws KettleDatabaseException
Throws:
KettleDatabaseException

getTableMap

public Map<String,Collection<String>> getTableMap(String schemanamein)
                                           throws KettleDatabaseException
Throws:
KettleDatabaseException

getViews

public String[] getViews()
                  throws KettleDatabaseException
Throws:
KettleDatabaseException

getViews

public String[] getViews(boolean includeSchema)
                  throws KettleDatabaseException
Throws:
KettleDatabaseException

getViews

public String[] getViews(String schemanamein,
                         boolean includeSchema)
                  throws KettleDatabaseException
Throws:
KettleDatabaseException

getViewMap

public Map<String,Collection<String>> getViewMap()
                                          throws KettleDatabaseException
Throws:
KettleDatabaseException

getViewMap

public Map<String,Collection<String>> getViewMap(String schemanamein)
                                          throws KettleDatabaseException
Throws:
KettleDatabaseException

getSynonyms

public String[] getSynonyms()
                     throws KettleDatabaseException
Throws:
KettleDatabaseException

getSynonyms

public String[] getSynonyms(boolean includeSchema)
                     throws KettleDatabaseException
Throws:
KettleDatabaseException

getSynonyms

public String[] getSynonyms(String schemanamein,
                            boolean includeSchema)
                     throws KettleDatabaseException
Throws:
KettleDatabaseException

getSynonymMap

public Map<String,Collection<String>> getSynonymMap()
                                             throws KettleDatabaseException
Throws:
KettleDatabaseException

getSynonymMap

public Map<String,Collection<String>> getSynonymMap(String schemanamein)
                                             throws KettleDatabaseException
Throws:
KettleDatabaseException

getSchemas

public String[] getSchemas()
                    throws KettleDatabaseException
Throws:
KettleDatabaseException

getCatalogs

public String[] getCatalogs()
                     throws KettleDatabaseException
Throws:
KettleDatabaseException

getProcedures

public String[] getProcedures()
                       throws KettleDatabaseException
Throws:
KettleDatabaseException

isAutoCommit

public boolean isAutoCommit()

getDatabaseMeta

public DatabaseMeta getDatabaseMeta()
Returns:
Returns the databaseMeta.

lockTables

public void lockTables(String[] tableNames)
                throws KettleDatabaseException
Lock a tables in the database for write operations

Parameters:
tableNames - The tables to lock. These need to be the appropriately quoted fully qualified (schema+table) names.
Throws:
KettleDatabaseException

unlockTables

public void unlockTables(String[] tableNames)
                  throws KettleDatabaseException
Unlock certain tables in the database for write operations

Parameters:
tableNames - The tables to unlock
Throws:
KettleDatabaseException

getOpened

public int getOpened()
Returns:
the opened

setOpened

public void setOpened(int opened)
Parameters:
opened - the opened to set

getConnectionGroup

public String getConnectionGroup()
Returns:
the connectionGroup

setConnectionGroup

public void setConnectionGroup(String connectionGroup)
Parameters:
connectionGroup - the connectionGroup to set

getPartitionId

public String getPartitionId()
Returns:
the partitionId

setPartitionId

public void setPartitionId(String partitionId)
Parameters:
partitionId - the partitionId to set

getCopy

public int getCopy()
Returns:
the copy

setCopy

public void setCopy(int copy)
Parameters:
copy - the copy to set

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.

callProcedure

public RowMetaAndData callProcedure(String[] arg,
                                    String[] argdir,
                                    int[] argtype,
                                    String resultname,
                                    int resulttype)
                             throws KettleDatabaseException
Throws:
KettleDatabaseException

closeProcedureStatement

public void closeProcedureStatement()
                             throws KettleDatabaseException
Throws:
KettleDatabaseException

getDDLCreationTable

public String getDDLCreationTable(String tableName,
                                  RowMetaInterface fields)
                           throws KettleDatabaseException
Return SQL CREATION statement for a Table

Parameters:
tableName - The table to create
Throws:
KettleDatabaseException

getDDLTruncateTable

public String getDDLTruncateTable(String schema,
                                  String tablename)
                           throws KettleDatabaseException
Return SQL TRUNCATE statement for a Table

Parameters:
schema - The schema
tableNameWithSchema - The table to create
Throws:
KettleDatabaseException

getSQLOutput

public String getSQLOutput(String schemaName,
                           String tableName,
                           RowMetaInterface fields,
                           Object[] r,
                           String dateFormat)
                    throws KettleDatabaseException
Return SQL statement (INSERT INTO TableName ...

Parameters:
schemaName - tableName The schema
tableName -
fields -
dateFormat - date format of field
Throws:
KettleDatabaseException

setSavepoint

public Savepoint setSavepoint()
                       throws KettleDatabaseException
Throws:
KettleDatabaseException

setSavepoint

public Savepoint setSavepoint(String savePointName)
                       throws KettleDatabaseException
Throws:
KettleDatabaseException

releaseSavepoint

public void releaseSavepoint(Savepoint savepoint)
                      throws KettleDatabaseException
Throws:
KettleDatabaseException

rollback

public void rollback(Savepoint savepoint)
              throws KettleDatabaseException
Throws:
KettleDatabaseException

getParentObject

public Object getParentObject()

getPrimaryKeyColumnNames

public String[] getPrimaryKeyColumnNames(String tablename)
                                  throws KettleDatabaseException
Return primary key column names ...

Parameters:
tablename -
Throws:
KettleDatabaseException

getSequences

public String[] getSequences()
                      throws KettleDatabaseException
Return all sequence names from connection

Returns:
The sequences name list.
Throws:
KettleDatabaseException

getFilename

public String getFilename()
Specified by:
getFilename in interface LoggingObjectInterface
Returns:
the filename

getLogChannelId

public String getLogChannelId()
Specified by:
getLogChannelId in interface LoggingObjectInterface
Returns:
the log channel id

getObjectName

public String getObjectName()
Specified by:
getObjectName in interface LoggingObjectInterface
Returns:
the name

getObjectCopy

public String getObjectCopy()
Specified by:
getObjectCopy in interface LoggingObjectInterface
Returns:
A string identifying a copy in a series of steps...

getObjectId

public ObjectId getObjectId()
Specified by:
getObjectId in interface LoggingObjectInterface
Returns:
the objectId in a repository

getObjectRevision

public ObjectRevision getObjectRevision()
Specified by:
getObjectRevision in interface LoggingObjectInterface
Returns:
the object revision in a repository

getObjectType

public LoggingObjectType getObjectType()
Specified by:
getObjectType in interface LoggingObjectInterface
Returns:
the objectType

getParent

public LoggingObjectInterface getParent()
Specified by:
getParent in interface LoggingObjectInterface
Returns:
the parent

getRepositoryDirectory

public RepositoryDirectory getRepositoryDirectory()
Specified by:
getRepositoryDirectory in interface LoggingObjectInterface
Returns:
the repositoryDirectory

getLogLevel

public LogLevel getLogLevel()
Specified by:
getLogLevel in interface LoggingObjectInterface
Returns:
The logging level of the log channel of this logging object.

setLogLevel

public void setLogLevel(LogLevel logLevel)

getContainerObjectId

public String getContainerObjectId()
Specified by:
getContainerObjectId in interface LoggingObjectInterface
Returns:
the carteObjectId

setContainerObjectId

public void setContainerObjectId(String containerObjectId)
Parameters:
containerObjectId - the execution container Object id to set

getRegistrationDate

public Date getRegistrationDate()
Stub

Specified by:
getRegistrationDate in interface LoggingObjectInterface
Returns:
The registration date of this logging object. Null if it's not registered.

getNrExecutedCommits

public int getNrExecutedCommits()
Returns:
the nrExecutedCommits

setNrExecutedCommits

public void setNrExecutedCommits(int nrExecutedCommits)
Parameters:
nrExecutedCommits - the nrExecutedCommits to set