Class SqlClobGenerator

All Implemented Interfaces:
DataGenerator<Clob>

public class SqlClobGenerator extends AbstractDataGenerator<Clob>
Generator for SQL CLOB (character large object) columns.

Generation is not yet implemented: generate() and generateAsString() currently return null, so nullable CLOB columns fill with null and a non-nullable one will fail at insert. set(Connection, PreparedStatement, int, Clob) and get(ResultSet, int) bind and read a Clob normally, so round-tripping an existing value works.

  • Method Details

    • generate

      public Clob generate()
      Description copied from interface: DataGenerator
      Generates a random value of type T.
      Returns:
      a generated value, may be null if the generator supports nullable columns
    • generateAsString

      public String generateAsString()
      Description copied from interface: DataGenerator
      Generates a value and returns its string representation.
      Specified by:
      generateAsString in interface DataGenerator<Clob>
      Overrides:
      generateAsString in class AbstractDataGenerator<Clob>
      Returns:
      the string representation of a generated value
    • set

      public void set(Connection connection, PreparedStatement statement, int parameterIndex, Clob value) throws SQLException
      Description copied from interface: DataGenerator
      Sets a specific value on a PreparedStatement parameter.
      Specified by:
      set in interface DataGenerator<Clob>
      Overrides:
      set in class AbstractDataGenerator<Clob>
      Parameters:
      connection - the database connection
      statement - the prepared statement to set the parameter on
      parameterIndex - the 1-based parameter index
      value - the value to set
      Throws:
      SQLException - if the database operation fails
    • get

      public Clob get(ResultSet resultSet, int columnIndex) throws SQLException
      Description copied from interface: DataGenerator
      Retrieves a value from a ResultSet column.
      Parameters:
      resultSet - the result set to read from
      columnIndex - the 1-based column index
      Returns:
      the value from the result set, properly cast to type T
      Throws:
      SQLException - if the database operation fails