Class DMLTransformer
java.lang.Object
net.sf.jailer.database.Session.AbstractResultSetReader
net.sf.jailer.database.DMLTransformer
- All Implemented Interfaces:
Session.ResultSetReader
A
Session.ResultSetReader that writes the read rows as DML-statements
into the export-script.- Author:
- Ralf Wisser
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AtomicLongCounts the exported LOBs.protected QuotingFor quoting of column names. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDMLTransformer(Table table, OutputStreamWriter scriptFileWriter, boolean upsertOnly, int maxBodySize, Session session, DBMS targetDBMSConfiguration, ImportFilterTransformer importFilterTransformer, AtomicReference<Table> identityInsertTable, ExecutionContext executionContext) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Flushes the export-reader.protected StringconvertToSql(CellContentConverter cellContentConverter, ResultSet resultSet, int i, Object content, int callerId, String suffix) Converts cell content to SQL literals.protected QuotingcreateQuoting(Session session) Creates aQuotinginstance for the given session.voidflush()Flushes the export-reader.protected StringGets qualified table name.voidreadCurrentRow(ResultSet resultSet) Reads result-set and writes into export-script.Methods inherited from class net.sf.jailer.database.Session.AbstractResultSetReader
getCellContentConverter, getMetaData, init
-
Field Details
-
numberOfExportedLOBs
Counts the exported LOBs. (GUI support) -
quoting
For quoting of column names.
-
-
Constructor Details
-
DMLTransformer
protected DMLTransformer(Table table, OutputStreamWriter scriptFileWriter, boolean upsertOnly, int maxBodySize, Session session, DBMS targetDBMSConfiguration, ImportFilterTransformer importFilterTransformer, AtomicReference<Table> identityInsertTable, ExecutionContext executionContext) throws SQLException Constructor.- Parameters:
table- the table to read fromscriptFileWriter- the file to write toupsertOnly- use 'upsert' statements for all entitiesmaxBodySize- maximum length of SQL values list (for generated inserts)session- the sessiontargetDBMSConfiguration- configuration of the target DBMSimportFilterTransformer- transforms import filters into SQL expressionsidentityInsertTable- tracks the table currently enabled for identity insertsexecutionContext- the execution context- Throws:
SQLException
-
-
Method Details
-
createQuoting
Creates aQuotinginstance for the given session.- Parameters:
session- the session- Returns:
- a
Quotinginstance for the session - Throws:
SQLException
-
readCurrentRow
Reads result-set and writes into export-script.- Parameters:
resultSet- the result-set- Throws:
SQLException
-
convertToSql
protected String convertToSql(CellContentConverter cellContentConverter, ResultSet resultSet, int i, Object content, int callerId, String suffix) throws SQLException Converts cell content to SQL literals.- Parameters:
cellContentConverter- converterresultSet- points to current rowi- current result set indexcontent- cell contentcallerId- identifier of the caller (used to de-duplicate filter reason comments)suffix- optional SQL type suffix to append (e.g. a PostgreSQL cast), ornull- Returns:
- SQL literal
- Throws:
SQLException
-
qualifiedTableName
-
flush
public void flush()Flushes the export-reader. -
close
public void close()Flushes the export-reader.- Specified by:
closein interfaceSession.ResultSetReader- Overrides:
closein classSession.AbstractResultSetReader
-