Class Database
- All Implemented Interfaces:
Closeable
,AutoCloseable
,LoggingObjectInterface
,LoggingObjectLifecycleInterface
,VariableSpace
- Since:
- 05-04-2003
- Author:
- Matt
-
Constructor Summary
ConstructorDescriptionDatabase
(DatabaseMeta databaseMeta) Deprecated.Please specify the parent object so that we can see which object is initiating a database connectionDatabase
(LoggingObjectInterface parentObject, DatabaseMeta databaseMeta) Construct a new Database Connection -
Method Summary
Modifier and TypeMethodDescriptionboolean
void
callProcedure
(String[] arg, String[] argdir, int[] argtype, String resultname, int resulttype) void
Cancel the open/running queries on the database connectionvoid
cancelStatement
(Statement statement) Cancel an open/running SQL statementboolean
checkColumnExists
(String columnname, String tablename) Deprecated.Deprecated in favor of the smartercheckColumnExists(String, String, String)
boolean
checkColumnExists
(String schemaname, String tablename, String columnname) See if the column specified exists by reading the metadata first, execution last.boolean
checkColumnExistsByDbMeta
(String schemaname, String tablename, String columnname) boolean
checkIndexExists
(String tableName, String[] idxFields) Check if an index on certain fields in a table exists.boolean
checkIndexExists
(String schemaName, String tableName, String[] idxFields) 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) Deprecated.Deprecated in favor ofcheckTableExists(String, String)
boolean
checkTableExists
(String schema, String tablename) See if the table specified exists.boolean
checkTableExistsByDbMeta
(String schema, String tablename) Deprecated.Deprecated in favor ofcheckTableExists(String, String)
void
cleanupLogRecords
(LogTableCoreInterface logTable, String transJobName) void
clearBatch
(PreparedStatement preparedStatement) void
Deprecated.void
close()
void
Only for unique connections usage, typically you use disconnect() to disconnect() from the database.void
void
void
void
void
closeQuery
(ResultSet res) void
void
commit()
Perform a commit the connection if this is supported by the databasevoid
commit
(boolean force) void
commitLog
(boolean force, LogTableCoreInterface logTable) This methods may be removed in future.void
commitLog
(LogTableCoreInterface logTable) This methods may be removed in future.void
connect()
Open the database connection.void
Open the database connection.void
void
copyVariablesFrom
(VariableSpace space) Copy the variables from another space, without initializing with the defaults.int
countParameters
(String sql) static KettleDatabaseBatchException
createKettleDatabaseBatchException
(String message, SQLException ex) void
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.environmentSubstitute
(String aString) Substitute the string using the current variable space.String[]
environmentSubstitute
(String[] aString) Replaces environment variables in an array of strings.boolean
This implementation is NullPointerException subject, and may not follow fundamental equals contract.execStatement
(String sql) Execute an SQL statement on the database connection (has to be open)execStatement
(String rawsql, RowMetaInterface params, Object[] data) execStatements
(String script) Execute a series of SQL statements, separated by ;execStatements
(String script, RowMetaInterface params, Object[] data) Execute a series of SQL statements, separated by ;execStatementsFromFile
(String filename, boolean sendSinglestatement) Execute an SQL statement inside a file on the database connection (has to be open)void
executeAndClearBatch
(PreparedStatement preparedStatement) fieldSubstitute
(String aString, RowMetaInterface rowMeta, Object[] rowData) Substitutes field values inaString
.void
getAlterTableStatement
(String tableName, RowMetaInterface fields, String tk, boolean useAutoinc, String pk, boolean semicolon) boolean
getBooleanValueOfVariable
(String variableName, boolean defaultValue) This method returns a boolean for the new variable check boxes.String[]
Gets the execution container (Carte/DI server/BI Server) object id.int
getCopy()
getCreateIndexStatement
(String tablename, String indexname, String[] idxFields, boolean tk, boolean unique, boolean bitmap, boolean semiColon) getCreateIndexStatement
(String schemaname, String tablename, String indexname, String[] idxFields, boolean tk, boolean unique, boolean bitmap, boolean semiColon) getCreateSequenceStatement
(String sequence, long startAt, long incrementBy, long maxValue, boolean semiColon) getCreateSequenceStatement
(String schemaName, String sequence, long startAt, long incrementBy, long maxValue, boolean semiColon) getCreateSequenceStatement
(String sequence, String startAt, String incrementBy, String maxValue, boolean semiColon) getCreateSequenceStatement
(String schemaName, String sequenceName, String startAt, String incrementBy, String maxValue, boolean semiColon) getCreateTableStatement
(String tableName, RowMetaInterface fields, String tk, boolean useAutoinc, String pk, boolean semicolon) Generates SQLgetDataSource
(String partitionId) getDDL
(String tablename, RowMetaInterface fields) getDDL
(String tablename, RowMetaInterface fields, String tk, boolean useAutoinc, String pk) getDDL
(String tableName, RowMetaInterface fields, String tk, boolean useAutoinc, String pk, boolean semicolon) getDDLCreationTable
(String tableName, RowMetaInterface fields) Return SQL CREATION statement for a TablegetDDLTruncateTable
(String schema, String tablename) Return SQL TRUNCATE statement for a TableGets the filename.getFirstRows
(String tableName, int limit) getFirstRows
(String tableName, int limit, ProgressMonitorListener monitor) Get the first rows from a table (for preview)getInsertStatement
(String schemaName, String tableName, RowMetaInterface fields) getInsertStatement
(String tableName, RowMetaInterface fields) Object[]
getLastLogDate
(String logtable, String name, boolean job, LogStatus status) Gets the log channel id.Gets the logging level of the log channel of this logging object.Object[]
Object[]
getLookup
(boolean failOnMultipleResults) Object[]
getLookup
(boolean failOnMultipleResults, boolean lazyConversion) Object[]
Object[]
getLookup
(PreparedStatement ps, boolean failOnMultipleResults) Object[]
getLookup
(PreparedStatement ps, boolean failOnMultipleResults, boolean lazyConversion) getMetaFromRow
(Object[] row, ResultSetMetaData md) getNextSequenceValue
(String sequenceName, String keyfield) getNextSequenceValue
(String schemaName, String sequenceName, String keyfield) getNextValue
(Hashtable<String, Counter> counters, String schemaName, String tableName, String valKey) int
Gets a string identifying a copy in a series of steps.Gets the object id in a repository.Gets the object name.Gets the objects revision in a repository.Gets the object type.Execute a query and return at most one row from the resultsetgetOneRow
(String sql, RowMetaInterface param, Object[] data) int
getParameterMetaData
(String sql, RowMetaInterface inform, Object[] data) Gets the parent.Get the parent of the variable space.String[]
getPrimaryKeyColumnNames
(String tablename) Return primary key column names ...String[]
getQueryFields
(String sql, boolean param) getQueryFields
(String sql, boolean param, RowMetaInterface inform, Object[] data) getQueryFieldsFallback
(String sql, boolean param, RowMetaInterface inform, Object[] data) StubGets the repository directory.Object[]
Get a row from the resultset.Object[]
Get a row from the resultset.Object[]
getRow
(ResultSet rs, ResultSetMetaData dummy, RowMetaInterface rowInfo) Get a row from the resultset.Reads the result of an SQL query into an ArrayListgetRows
(String sql, int limit, ProgressMonitorListener monitor) Reads the result of an SQL query into an ArrayListgetRows
(String sql, RowMetaInterface params, Object[] data, int fetchMode, boolean lazyConversion, int limit, ProgressMonitorListener monitor) Reads the result of an SQL query into an ArrayList.getRows
(ResultSet rset, int limit, ProgressMonitorListener monitor) Reads the result of a ResultSet into an ArrayListString[]
String[]
Return all sequence names from connectiongetSQLOutput
(String schemaName, String tableName, RowMetaInterface fields, Object[] r, String dateFormat) Return SQL statement (INSERT INTO TableName ...getSynonymMap
(String schemanamein) String[]
String[]
getSynonyms
(boolean includeSchema) String[]
getSynonyms
(String schemanamein, boolean includeSchema) getTableFields
(String tablename) Returns a RowMeta describing the fields of a table expression.getTableFieldsMeta
(String schemaName, String tableName) Returns a RowMeta describing the fields of a table.getTableFieldsMetaByDbMeta
(String schemaName, String tableName) getTableMap
(String schemanamein) getTableMap
(String schemanamein, Map<String, String> props) String[]
String[]
getTablenames
(boolean includeSchema) String[]
getTablenames
(String schemanamein, boolean includeSchema) String[]
getTablenames
(String schemanamein, boolean includeSchema, Map<String, String> props) String[]
boolean
getUseBatchInsert
(boolean batch) getVariable
(String variableName) Get the value of a variable.getVariable
(String variableName, String defaultValue) Get the value of a variable with a default in case the variable is not found.getViewMap
(String schemanamein) String[]
getViews()
String[]
getViews
(boolean includeSchema) String[]
void
initializeConnectionDataSource
(String partitionId) 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
void
insertRow
(boolean batch) void
insertRow
(String schemaName, String tableName, RowMetaInterface fields, Object[] data) void
insertRow
(String tableName, RowMetaInterface fields, Object[] data) void
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.boolean
boolean
boolean
Gets the boolean value of whether or not this object is gathering kettle metrics during execution.boolean
isSystemTable
(String tableName) String[]
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 operationsvoid
normalConnect
(String partitionId) Open the database connection.openQuery
(String sql, RowMetaInterface params, Object[] data) Open a query on the database with a set of parameters stored in a Kettle RowopenQuery
(String sql, RowMetaInterface params, Object[] data, int fetchMode) openQuery
(String sql, RowMetaInterface params, Object[] data, int fetchMode, boolean lazyConversion) openQuery
(PreparedStatement ps, RowMetaInterface params, Object[] data) 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 Rowvoid
prepareInsert
(RowMetaInterface rowMeta, String schemaName, String tableName) Prepare inserting values into a table, using the fields & values in a RowprepareSQL
(String sql) Prepare a statement to be executed on the database.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
boolean
void
releaseSavepoint
(Savepoint savepoint) void
rollback()
void
rollback
(boolean force) void
void
void
setAutoCommit
(boolean useAutoCommit) void
setCommit
(int commitSize) Specify after how many rows a commit needs to occur when inserting or updating values.void
setCommitSize
(int size) 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
setForcingSeparateLogging
(boolean forcingSeparateLogging) This option will force the create of a separate logging channel even if the logging concerns identical objects with identical names.void
setGatheringMetrics
(boolean gatheringMetrics) Enable of disable kettle metrics gathering during executionvoid
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
setOwnerName
(String name) void
setParentVariableSpace
(VariableSpace parent) Set the parent variable spacevoid
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.setSavepoint
(String savePointName) void
setValue
(PreparedStatement ps, ValueMetaInterface v, Object object, int pos) 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
setValues
(RowMetaAndData row) void
setValues
(RowMetaAndData row, PreparedStatement ps) void
setValuesInsert
(RowMetaInterface rowMeta, Object[] data) void
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.toString()
void
truncateTable
(String tablename) void
truncateTable
(String schema, String tablename) void
unlockTables
(String[] tableNames) Unlock certain tables in the database for write operationsvoid
void
writeLogRecord
(LogTableCoreInterface logTable, LogStatus status, Object subject, Object parent) Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.pentaho.di.core.logging.LoggingObjectLifecycleInterface
callAfterLog, callBeforeLog
Methods inherited from interface org.pentaho.di.core.variables.VariableSpace
environmentSubstitute
-
Constructor Details
-
Database
Deprecated.Please specify the parent object so that we can see which object is initiating a database connectionConstruct a new Database Connection- Parameters:
databaseMeta
- The Database Connection Info to construct the connection with.
-
Database
Construct a new Database Connection- Parameters:
databaseMeta
- The Database Connection Info to construct the connection with.
-
-
Method Details
-
equals
This implementation is NullPointerException subject, and may not follow fundamental equals contract. Databases equality is based onDatabaseMeta
equality. -
setConnection
Allows for the injection of a "life" connection, generated by a piece of software outside of Kettle.- Parameters:
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
- Returns:
- Returns the prepStatementInsert.
-
getPrepStatementLookup
- Returns:
- Returns the prepStatementLookup.
-
getPrepStatementUpdate
- Returns:
- Returns the prepStatementUpdate.
-
getDataSource
- Returns:
- Returns the dataSource.
- Throws:
KettleDatabaseException
-
connect
Open the database connection.- Throws:
KettleDatabaseException
- if something went wrong.
-
connect
Open the database connection.- Parameters:
partitionId
- the partition ID in the cluster to connect to.- Throws:
KettleDatabaseException
- if something went wrong.
-
connect
- Throws:
KettleDatabaseException
-
normalConnect
Open the database connection. The algorithm is:- If
databaseMeta.getAccessType()
returnsDatabaseMeta.TYPE_ACCESS_JNDI
, then the connection's datasource is looked up in JNDI - If
databaseMeta.isUsingConnectionPool()
, then the connection's datasource is looked up in the pool - otherwise, the connection is established via DriverManager
- Parameters:
partitionId
- the partition ID in the cluster to connect to.- Throws:
KettleDatabaseException
- if something went wrong.
- If
-
initializeConnectionDataSource
- Throws:
KettleDatabaseException
-
disconnect
public void disconnect()Disconnect from the database and close all open prepared statements. -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
closeConnectionOnly
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
Cancel the open/running queries on the database connection- Throws:
KettleDatabaseException
-
cancelStatement
Cancel an open/running SQL statement- Parameters:
statement
- the statement to cancel- Throws:
KettleDatabaseException
-
setCommit
public void setCommit(int commitSize) Specify after how many rows a commit needs to occur when inserting or updating values.- Parameters:
commitSize
- The number of rows to wait before doing a commit on the connection.
-
setAutoCommit
public void setAutoCommit() -
setCommitSize
public void setCommitSize(int size) -
setAutoCommit
- Throws:
KettleDatabaseException
-
commit
Perform a commit the connection if this is supported by the database- Throws:
KettleDatabaseException
-
commit
- Throws:
KettleDatabaseException
-
commitLog
This methods may be removed in future.- Parameters:
logTable
-- Throws:
KettleDatabaseException
-
commitLog
This methods may be removed in future.- Parameters:
force
-logTable
-- Throws:
KettleDatabaseException
-
rollback
- Throws:
KettleDatabaseException
-
rollback
- 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 insertedtableName
- 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 insertedschemaName
- The name of the schema in which we want to insert rowstableName
- The name of the table in which we want to insert rows- Throws:
KettleDatabaseException
- if something went wrong.
-
prepareSQL
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
Prepare a statement to be executed on the database.- Parameters:
sql
- The SQL to be preparedreturnKeys
- set to true if you want to return generated keys from an insert statement- Returns:
- The PreparedStatement object.
- Throws:
KettleDatabaseException
-
closeLookup
- Throws:
KettleDatabaseException
-
closePreparedStatement
- Throws:
KettleDatabaseException
-
closeInsert
- Throws:
KettleDatabaseException
-
closeUpdate
- Throws:
KettleDatabaseException
-
setValues
- Throws:
KettleDatabaseException
-
setValues
- Throws:
KettleDatabaseException
-
setValuesInsert
- Throws:
KettleDatabaseException
-
setValuesInsert
- Throws:
KettleDatabaseException
-
setValuesUpdate
- Throws:
KettleDatabaseException
-
setValuesLookup
- 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
- 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
- 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
-
getInsertStatement
-
insertRow
- Throws:
KettleDatabaseException
-
insertRow
- Throws:
KettleDatabaseException
-
updateRow
- Throws:
KettleDatabaseException
-
insertRow
- Throws:
KettleDatabaseException
-
insertRow
Insert a row into the database using a prepared statement that has all values set.- Parameters:
ps
- The prepared statementbatch
- 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
-
getUseBatchInsert
- 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 statementbatch
- 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
Deprecated.Clears batch of insert prepared statement- Throws:
KettleDatabaseException
-
clearBatch
- Throws:
KettleDatabaseException
-
executeAndClearBatch
public void executeAndClearBatch(PreparedStatement preparedStatement) throws KettleDatabaseException - Throws:
KettleDatabaseException
-
insertFinished
- Throws:
KettleDatabaseException
-
emptyAndCommit
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 processingbatchCounter
- The number of rows on the batch queue- Throws:
KettleDatabaseException
-
createKettleDatabaseBatchException
public static KettleDatabaseBatchException createKettleDatabaseBatchException(String message, SQLException ex) -
insertFinished
@Deprecated 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)- Throws:
KettleDatabaseException
-
execStatement
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 rawsql, RowMetaInterface params, Object[] data) throws KettleDatabaseException - Throws:
KettleDatabaseException
-
execStatements
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
-
execStatements
public Result execStatements(String script, RowMetaInterface params, Object[] data) 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 executeparams
- Parameters Metadata
- Parameters value- Returns:
- A result with counts of the number or records updates, inserted, deleted or read.
- Throws:
KettleDatabaseException
- In case an error occurs
-
openQuery
- 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 parametersparams
- 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 fetchMode) throws KettleDatabaseException - Throws:
KettleDatabaseException
-
openQuery
public ResultSet openQuery(String sql, RowMetaInterface params, Object[] data, int fetchMode, boolean lazyConversion) throws KettleDatabaseException - Throws:
KettleDatabaseException
-
openQuery
public ResultSet openQuery(PreparedStatement ps, RowMetaInterface params, Object[] data) throws KettleDatabaseException - Throws:
KettleDatabaseException
-
getTableFields
Returns a RowMeta describing the fields of a table expression.Note that this implementation makes use of a SQL statement in order to populate the ValueMeta object in the RowMeta it returns. This is sometimes necessary when the caller needs the ValueMeta values to be properly casted.
In cases where a simple list of columns is required, it is preferable to use
getTableFieldsMeta(String, String)
. This other method will not use a SQL query and will populate whatever information it can using @linkDatabaseMetaData.getColumns(String, String, String, String)
.- Parameters:
tablename
- This is the properly quoted, and schema prefixed table name.- Throws:
KettleDatabaseException
-
getQueryFields
- Throws:
KettleDatabaseException
-
checkTableExists
Deprecated.Deprecated in favor ofcheckTableExists(String, String)
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
-
checkTableExists
See if the table specified exists.This is a smarter implementation of
checkTableExists(String)
where metadata is used first and we only use statements when absolutely necessary.Contrary to previous versions of similar duplicated methods, this implementation does not require quoted identifiers.
- Parameters:
tablename
- The unquoted name of the table to check.
This is NOT the properly quoted name of the table or the complete schema-table name combination.schema
- The unquoted name of the schema.- Returns:
- true if the table exists, false if it doesn't.
- Throws:
KettleDatabaseException
-
checkTableExistsByDbMeta
@Deprecated public boolean checkTableExistsByDbMeta(String schema, String tablename) throws KettleDatabaseException Deprecated.Deprecated in favor ofcheckTableExists(String, String)
See if the table specified exists by getting db metadata.- 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 schemaname, String tablename, String columnname) throws KettleDatabaseException See if the column specified exists by reading the metadata first, execution last.This is a smarter implementation of
checkTableExists(String)
where metadata is used first and we only use statements when absolutely necessary.Contrary to previous versions of similar duplicated methods, this implementation does not require quoted identifiers.
- Parameters:
schemaname
- The name of the schema to check.tablename
- The name of the table to check.columnname
- The name of the column to check.- Returns:
- true if the table exists, false if it doesn't.
- Throws:
KettleDatabaseException
-
checkColumnExistsByDbMeta
public boolean checkColumnExistsByDbMeta(String schemaname, String tablename, String columnname) throws KettleDatabaseException - Throws:
KettleDatabaseException
-
checkColumnExists
@Deprecated public boolean checkColumnExists(String columnname, String tablename) throws KettleDatabaseException Deprecated.Deprecated in favor of the smartercheckColumnExists(String, String, String)
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
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[] idxFields) throws KettleDatabaseException Check if an index on certain fields in a table exists.- Parameters:
tableName
- The table on which the index is checkedidxFields
- 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[] idxFields) throws KettleDatabaseException Check if an index on certain fields in a table exists.- Parameters:
tableName
- The table on which the index is checkedidxFields
- The fields on which the indexe is checked- Returns:
- True if the index exists
- Throws:
KettleDatabaseException
-
getCreateIndexStatement
-
getCreateIndexStatement
-
getCreateSequenceStatement
-
getCreateSequenceStatement
-
getCreateSequenceStatement
-
getCreateSequenceStatement
-
getTableFieldsMeta
public RowMetaInterface getTableFieldsMeta(String schemaName, String tableName) throws KettleDatabaseException Returns a RowMeta describing the fields of a table.This is a lighter implementation of
getTableFields(String)
where metadata is used first and we only use statements when absolutely necessary.Note that the ValueMeta returned here will not contain any actual values and as such, this method should be used whenever a simple list of columns is required, and we're not planning on looking at the actual data.
Contrary to previous versions of similar duplicated methods, this implementation does not require quoted identifiers.
- Parameters:
schemaName
- The unquoted schema name. Can be null.tableName
- The unquoted table name. Cannot be null.- Throws:
KettleDatabaseException
-
getTableFieldsMetaByDbMeta
public RowMetaInterface getTableFieldsMetaByDbMeta(String schemaName, String tableName) throws KettleDatabaseException - Throws:
KettleDatabaseException
-
getQueryFields
public RowMetaInterface getQueryFields(String sql, boolean param, RowMetaInterface inform, Object[] data) throws KettleDatabaseException - Throws:
KettleDatabaseException
-
getQueryFieldsFromPreparedStatement
- Throws:
Exception
-
getQueryFieldsFromDatabaseMetaData
- Throws:
Exception
-
getQueryFieldsFallback
public RowMetaInterface getQueryFieldsFallback(String sql, boolean param, RowMetaInterface inform, Object[] data) throws KettleDatabaseException - Throws:
KettleDatabaseException
-
closeQuery
- Throws:
KettleDatabaseException
-
absolute
- Throws:
KettleDatabaseException
-
relative
- Throws:
KettleDatabaseException
-
afterLast
- Throws:
KettleDatabaseException
-
first
- Throws:
KettleDatabaseException
-
getRow
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
Get a row from the resultset.- Parameters:
rs
- The resultset to get the row fromlazyConversion
- 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
-
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
-
prepareUpdate
-
prepareDelete
Prepare a delete statement by giving it the tablename, fields and conditions to work with.- Parameters:
table
- The table-name to delete incodes
-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 intableName
- The table-name to delete incodes
-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
- Throws:
KettleDatabaseException
-
getLookup
- Throws:
KettleDatabaseException
-
getLookup
public Object[] getLookup(boolean failOnMultipleResults, boolean lazyConversion) throws KettleDatabaseException - Throws:
KettleDatabaseException
-
getLookup
- Throws:
KettleDatabaseException
-
getLookup
public Object[] getLookup(PreparedStatement ps, boolean failOnMultipleResults) throws KettleDatabaseException - Throws:
KettleDatabaseException
-
getLookup
public Object[] getLookup(PreparedStatement ps, boolean failOnMultipleResults, boolean lazyConversion) throws KettleDatabaseException - Throws:
KettleDatabaseException
-
getDatabaseMetaData
- Throws:
KettleDatabaseException
-
getDDL
- Throws:
KettleDatabaseException
-
getDDL
public String getDDL(String tablename, RowMetaInterface fields, String tk, boolean useAutoinc, String pk) throws KettleDatabaseException - Throws:
KettleDatabaseException
-
getDDL
public String getDDL(String tableName, RowMetaInterface fields, String tk, boolean useAutoinc, String pk, boolean semicolon) throws KettleDatabaseException - Throws:
KettleDatabaseException
-
getCreateTableStatement
public String getCreateTableStatement(String tableName, RowMetaInterface fields, String tk, boolean useAutoinc, 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 fieldstk
- the name of the technical key fielduseAutoinc
- true if we need to use auto-increment fields for a primary keypk
- the name of the primary/technical key fieldsemicolon
- append semicolon to the statement- Returns:
- the SQL needed to create the specified table and fields.
-
getAlterTableStatement
public String getAlterTableStatement(String tableName, RowMetaInterface fields, String tk, boolean useAutoinc, String pk, boolean semicolon) throws KettleDatabaseException - Throws:
KettleDatabaseException
-
truncateTable
- Throws:
KettleDatabaseException
-
truncateTable
- Throws:
KettleDatabaseException
-
getOneRow
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, KettleDatabaseException - Throws:
SQLException
KettleDatabaseException
-
getOneRow
public RowMetaAndData getOneRow(String sql, RowMetaInterface param, Object[] data) throws KettleDatabaseException - Throws:
KettleDatabaseException
-
getParameterMetaData
-
countParameters
-
getParameterMetaData
-
writeLogRecord
public void writeLogRecord(LogTableCoreInterface logTable, LogStatus status, Object subject, Object parent) throws KettleDatabaseException - Throws:
KettleDatabaseException
-
cleanupLogRecords
public void cleanupLogRecords(LogTableCoreInterface logTable, String transJobName) throws KettleDatabaseException - Throws:
KettleDatabaseException
-
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 valKey) throws KettleDatabaseException- Throws:
KettleDatabaseException
-
getNextValue
public Long getNextValue(Hashtable<String, Counter> counters, String schemaName, String tableName, String valKey) throws KettleDatabaseException- Throws:
KettleDatabaseException
-
toString
-
isSystemTable
-
getRows
Reads the result of an SQL query into an ArrayList- Parameters:
sql
- The SQL to launchlimit
- <=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 launchlimit
- <=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(String sql, RowMetaInterface params, Object[] data, int fetchMode, boolean lazyConversion, int limit, ProgressMonitorListener monitor) throws KettleDatabaseException Reads the result of an SQL query into an ArrayList.- Parameters:
sql
- The SQL to launchparams
- The types of any parameters to be passed to the querydata
- The values of any parameters to be passed to the queryfetchMode
- The fetch mode for the query (ResultSet.FETCH_FORWARD, e.g.)lazyConversion
- Whether to perform lazy conversion of the valueslimit
- <=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 outlimit
- <=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
- Throws:
KettleDatabaseException
-
getFirstRows
public List<Object[]> getFirstRows(String tableName, int limit, ProgressMonitorListener monitor) throws KettleDatabaseException Get the first rows from a table (for preview)- Parameters:
tableName
- The table name (or schema/table combination): this needs to be quoted properlylimit
- 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
-
getTableTypes
- Throws:
KettleDatabaseException
-
getTablenames
- Throws:
KettleDatabaseException
-
getTablenames
- Throws:
KettleDatabaseException
-
getTablenames
public String[] getTablenames(String schemanamein, boolean includeSchema) throws KettleDatabaseException - Throws:
KettleDatabaseException
-
getTablenames
public String[] getTablenames(String schemanamein, boolean includeSchema, Map<String, String> props) throws KettleDatabaseException- Throws:
KettleDatabaseException
-
getTableMap
- Throws:
KettleDatabaseException
-
getTableMap
public Map<String,Collection<String>> getTableMap(String schemanamein) throws KettleDatabaseException - Throws:
KettleDatabaseException
-
getTableMap
public Map<String,Collection<String>> getTableMap(String schemanamein, Map<String, String> props) throws KettleDatabaseException- Throws:
KettleDatabaseException
-
getViews
- Throws:
KettleDatabaseException
-
getViews
- Throws:
KettleDatabaseException
-
getViews
- Throws:
KettleDatabaseException
-
getViewMap
- Throws:
KettleDatabaseException
-
getViewMap
public Map<String,Collection<String>> getViewMap(String schemanamein) throws KettleDatabaseException - Throws:
KettleDatabaseException
-
getSynonyms
- Throws:
KettleDatabaseException
-
getSynonyms
- Throws:
KettleDatabaseException
-
getSynonyms
public String[] getSynonyms(String schemanamein, boolean includeSchema) throws KettleDatabaseException - Throws:
KettleDatabaseException
-
getSynonymMap
- Throws:
KettleDatabaseException
-
getSynonymMap
public Map<String,Collection<String>> getSynonymMap(String schemanamein) throws KettleDatabaseException - Throws:
KettleDatabaseException
-
getSchemas
- Throws:
KettleDatabaseException
-
getCatalogs
- Throws:
KettleDatabaseException
-
getProcedures
- Throws:
KettleDatabaseException
-
isAutoCommit
public boolean isAutoCommit() -
getDatabaseMeta
- Returns:
- Returns the databaseMeta.
-
lockTables
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
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
- Returns:
- the connectionGroup
-
setConnectionGroup
- Parameters:
connectionGroup
- the connectionGroup to set
-
getPartitionId
- Returns:
- the partitionId
-
setPartitionId
- 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
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 interfaceVariableSpace
- Parameters:
space
- the space to copy the variables from.
-
environmentSubstitute
Description copied from interface:VariableSpace
Substitute the string using the current variable space.- Specified by:
environmentSubstitute
in interfaceVariableSpace
- Parameters:
aString
- The string to substitute.- Returns:
- The substituted string.
-
environmentSubstitute
Description copied from interface:VariableSpace
Replaces environment variables in an array of strings. See also: environmentSubstitute(String string)- Specified by:
environmentSubstitute
in interfaceVariableSpace
- Parameters:
aString
- The array of strings that wants its variables to be replaced.- Returns:
- the array with the environment variables replaced.
-
fieldSubstitute
public String fieldSubstitute(String aString, RowMetaInterface rowMeta, Object[] rowData) throws KettleValueException Description copied from interface:VariableSpace
Substitutes field values inaString
. Field values are of the form "?{}". The values are retrieved from the specified row. Please note that the getString() method is used to convert to a String, for all values in the row. - Specified by:
fieldSubstitute
in interfaceVariableSpace
- Parameters:
aString
- the string on which to apply the substitution.rowMeta
- The row metadata to use.rowData
- The row data to use- Returns:
- the string with the substitution applied.
- Throws:
KettleValueException
- In case there is a String conversion error
-
getParentVariableSpace
Description copied from interface:VariableSpace
Get the parent of the variable space.- Specified by:
getParentVariableSpace
in interfaceVariableSpace
- Returns:
- the parent.
-
setParentVariableSpace
Description copied from interface:VariableSpace
Set the parent variable space- Specified by:
setParentVariableSpace
in interfaceVariableSpace
- Parameters:
parent
- The parent variable space to set
-
getVariable
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 interfaceVariableSpace
- Parameters:
variableName
- The name of the variabledefaultValue
- The default value in case the variable could not be found- Returns:
- the String value of a variable
-
getVariable
Description copied from interface:VariableSpace
Get the value of a variable.- Specified by:
getVariable
in interfaceVariableSpace
- 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
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 interfaceVariableSpace
- Parameters:
variableName
- The variable to look up.defaultValue
- The default value to return.- Returns:
- See Also:
-
static method ValueMeta.convertStringToBoolean()
-
initializeVariablesFrom
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 interfaceVariableSpace
- Parameters:
parent
- the parent to start from, or null if root.
-
listVariables
Description copied from interface:VariableSpace
List the variables (not the values) that are currently in the variable space.- Specified by:
listVariables
in interfaceVariableSpace
- Returns:
- Array of String variable names.
-
setVariable
Description copied from interface:VariableSpace
Sets a variable in the Kettle Variables list.- Specified by:
setVariable
in interfaceVariableSpace
- Parameters:
variableName
- The name of the variable to setvariableValue
- The value of the variable to set. If the variableValue is null, the variable is cleared from the list.
-
injectVariables
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 interfaceVariableSpace
- 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
- 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
Return SQL TRUNCATE statement for a Table- Parameters:
schema
- The schematablename
- 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 schematableName
-fields
-dateFormat
- date format of field- Throws:
KettleDatabaseException
-
setSavepoint
- Throws:
KettleDatabaseException
-
setSavepoint
- Throws:
KettleDatabaseException
-
releaseSavepoint
- Throws:
KettleDatabaseException
-
rollback
- Throws:
KettleDatabaseException
-
getParentObject
-
getPrimaryKeyColumnNames
Return primary key column names ...- Parameters:
tablename
-- Throws:
KettleDatabaseException
-
getSequences
Return all sequence names from connection- Returns:
- The sequences name list.
- Throws:
KettleDatabaseException
-
getFilename
Description copied from interface:LoggingObjectInterface
Gets the filename.- Specified by:
getFilename
in interfaceLoggingObjectInterface
- Returns:
- the filename
-
getLogChannelId
Description copied from interface:LoggingObjectInterface
Gets the log channel id.- Specified by:
getLogChannelId
in interfaceLoggingObjectInterface
- Returns:
- the log channel id
-
getObjectName
Description copied from interface:LoggingObjectInterface
Gets the object name.- Specified by:
getObjectName
in interfaceLoggingObjectInterface
- Returns:
- the name
-
getObjectCopy
Description copied from interface:LoggingObjectInterface
Gets a string identifying a copy in a series of steps.- Specified by:
getObjectCopy
in interfaceLoggingObjectInterface
- Returns:
- A string identifying a copy in a series of steps.
-
getObjectId
Description copied from interface:LoggingObjectInterface
Gets the object id in a repository.- Specified by:
getObjectId
in interfaceLoggingObjectInterface
- Returns:
- the objectId in a repository
-
getObjectRevision
Description copied from interface:LoggingObjectInterface
Gets the objects revision in a repository.- Specified by:
getObjectRevision
in interfaceLoggingObjectInterface
- Returns:
- the object revision in a repository
-
getObjectType
Description copied from interface:LoggingObjectInterface
Gets the object type.- Specified by:
getObjectType
in interfaceLoggingObjectInterface
- Returns:
- the objectType
-
getParent
Description copied from interface:LoggingObjectInterface
Gets the parent.- Specified by:
getParent
in interfaceLoggingObjectInterface
- Returns:
- the parent
-
getRepositoryDirectory
Description copied from interface:LoggingObjectInterface
Gets the repository directory.- Specified by:
getRepositoryDirectory
in interfaceLoggingObjectInterface
- Returns:
- the repositoryDirectory
-
getLogLevel
Description copied from interface:LoggingObjectInterface
Gets the logging level of the log channel of this logging object.- Specified by:
getLogLevel
in interfaceLoggingObjectInterface
- Returns:
- The logging level of the log channel of this logging object.
-
setLogLevel
-
getContainerObjectId
Description copied from interface:LoggingObjectInterface
Gets the execution container (Carte/DI server/BI Server) object id. We use this to see to which copy of the job/trans hierarchy this object belongs. If it is null, we assume that we are running a single copy in Spoon/Pan/Kitchen.- Specified by:
getContainerObjectId
in interfaceLoggingObjectInterface
- Returns:
- the carteObjectId
-
setContainerObjectId
- Parameters:
containerObjectId
- the execution container Object id to set
-
getRegistrationDate
Stub- Specified by:
getRegistrationDate
in interfaceLoggingObjectInterface
- 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
-
execStatementsFromFile
public Result execStatementsFromFile(String filename, boolean sendSinglestatement) throws KettleException Execute an SQL statement inside a file on the database connection (has to be open)- Parameters:
filename
- The file that contains SQL to execute- Returns:
- a Result object indicating the number of lines read, deleted, inserted, updated, ...
- Throws:
KettleDatabaseException
- in case anything goes wrong.KettleException
-
isGatheringMetrics
public boolean isGatheringMetrics()Description copied from interface:LoggingObjectInterface
Gets the boolean value of whether or not this object is gathering kettle metrics during execution.- Specified by:
isGatheringMetrics
in interfaceLoggingObjectInterface
- Returns:
- true if this logging object is gathering kettle metrics during execution
-
setGatheringMetrics
public void setGatheringMetrics(boolean gatheringMetrics) Description copied from interface:LoggingObjectInterface
Enable of disable kettle metrics gathering during execution- Specified by:
setGatheringMetrics
in interfaceLoggingObjectInterface
- Parameters:
gatheringMetrics
- set to true to enable metrics gathering during execution.
-
isForcingSeparateLogging
public boolean isForcingSeparateLogging()- Specified by:
isForcingSeparateLogging
in interfaceLoggingObjectInterface
- Returns:
- True if the logging is forcibly separated out from even identical objects.
-
setForcingSeparateLogging
public void setForcingSeparateLogging(boolean forcingSeparateLogging) Description copied from interface:LoggingObjectInterface
This option will force the create of a separate logging channel even if the logging concerns identical objects with identical names.- Specified by:
setForcingSeparateLogging
in interfaceLoggingObjectInterface
- Parameters:
forcingSeparateLogging
- Set to true to force separate logging
-
setOwnerName
-
getOwnerName
-