Class DMLTransformer

All Implemented Interfaces:
Session.ResultSetReader

public class DMLTransformer extends Session.AbstractResultSetReader
A Session.ResultSetReader that writes the read rows as DML-statements into the export-script.
Author:
Ralf Wisser
  • Field Details

    • numberOfExportedLOBs

      public static final AtomicLong numberOfExportedLOBs
      Counts the exported LOBs. (GUI support)
    • quoting

      protected Quoting 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 from
      scriptFileWriter - the file to write to
      upsertOnly - use 'upsert' statements for all entities
      maxBodySize - maximum length of SQL values list (for generated inserts)
      session - the session
      targetDBMSConfiguration - configuration of the target DBMS
      importFilterTransformer - transforms import filters into SQL expressions
      identityInsertTable - tracks the table currently enabled for identity inserts
      executionContext - the execution context
      Throws:
      SQLException
  • Method Details

    • createQuoting

      protected Quoting createQuoting(Session session) throws SQLException
      Creates a Quoting instance for the given session.
      Parameters:
      session - the session
      Returns:
      a Quoting instance for the session
      Throws:
      SQLException
    • readCurrentRow

      public void readCurrentRow(ResultSet resultSet) throws SQLException
      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 - converter
      resultSet - points to current row
      i - current result set index
      content - cell content
      callerId - identifier of the caller (used to de-duplicate filter reason comments)
      suffix - optional SQL type suffix to append (e.g. a PostgreSQL cast), or null
      Returns:
      SQL literal
      Throws:
      SQLException
    • qualifiedTableName

      protected String qualifiedTableName(Table t)
      Gets qualified table name.
      Parameters:
      t - the table
      Returns:
      qualified name of t
    • flush

      public void flush()
      Flushes the export-reader.
    • close

      public void close()
      Flushes the export-reader.
      Specified by:
      close in interface Session.ResultSetReader
      Overrides:
      close in class Session.AbstractResultSetReader