Class CellContentConverter

java.lang.Object
net.sf.jailer.util.CellContentConverter

public class CellContentConverter extends Object
Converts a cell-content to valid SQL-literal.
Author:
Ralf Wisser
  • Field Details

    • TIMESTAMP_WITH_NANO

      public static final int TIMESTAMP_WITH_NANO
      See Also:
    • hexChar

      public static final char[] hexChar
      All hex digits.
  • Constructor Details

    • CellContentConverter

      public CellContentConverter(ResultSetMetaData resultSetMetaData, Session session, DBMS targetConfiguration)
      Constructor.
      Parameters:
      resultSetMetaData - meta data of the result set to read from
      session - database session
      targetConfiguration - configuration of the target DBMS
  • Method Details

    • toSql

      public String toSql(Object content)
      Converts a cell-content to valid SQL-literal.
      Parameters:
      content - the content
      Returns:
      the SQL-literal
    • getObject

      public Object getObject(ResultSet resultSet, int i) throws SQLException
      Gets object from result-set.
      Parameters:
      resultSet - result-set
      i - column index
      Returns:
      object
      Throws:
      SQLException
    • isPostgresObjectType

      public static boolean isPostgresObjectType(String columnTypeName)
      Checks whether the given column type name is a PostgreSQL object type.
      Parameters:
      columnTypeName - the column type name to check
      Returns:
      true if the type is a known PostgreSQL object type
    • getObject

      public Object getObject(ResultSet resultSet, String columnName) throws SQLException
      Gets object from result-set.
      Parameters:
      resultSet - result-set
      columnName - column name
      Returns:
      the object
      Throws:
      SQLException
    • getSmallLob

      public String getSmallLob(ResultSet resultSet, int i)
      Gets SQL expression for a C/BLOB for small LOBS.
      Parameters:
      resultSet - the result set
      i - index of LOB column
      Returns:
      SQL expression for a C/BLOB for small LOBS
    • getSmallLob

      public static String getSmallLob(Object lob, DBMS targetConfiguration, Integer maxBlobLength, Integer maxClobLength)
      Gets SQL expression for a C/BLOB for small LOBS.
      Parameters:
      lob - the lob
      Returns:
      SQL expression for a C/BLOB for small LOBS
    • prepareForComparison

      public static String prepareForComparison(Session session, Column column)
      Returns a SQL expression for a column that can be used in a comparison, applying any necessary type cast for DBMS-specific non-comparable types.
      Parameters:
      session - the current database session
      column - the column to prepare
      Returns:
      SQL expression for the column suitable for comparison