Class ConnectedStatementsWriter

java.lang.Object
org.fastnate.generator.statements.AbstractStatementsWriter
org.fastnate.generator.statements.ConnectedStatementsWriter
All Implemented Interfaces:
Closeable, AutoCloseable, StatementsWriter

public class ConnectedStatementsWriter extends AbstractStatementsWriter
An implementation of a StatementsWriter which writes the SQL statements directly to a database connection.
Author:
Tobias Liefke
  • Field Details

    • DATABASE_DRIVER_KEY

      public static final String DATABASE_DRIVER_KEY
      Name of the setting that contains the connection driver class, if the writer create the a connection himself.
      See Also:
    • DATABASE_URL_KEY

      public static final String DATABASE_URL_KEY
      Name of the setting that contains the connection URL, if the writer create the a connection himself.
      See Also:
    • DATABASE_USER_KEY

      public static final String DATABASE_USER_KEY
      Name of the setting that contains the connection user, if the writer create the a connection himself.
      See Also:
    • DATABASE_PASSWORD_KEY

      public static final String DATABASE_PASSWORD_KEY
      Name of the setting that contains the connection password, if the writer create the a connection himself.
      See Also:
    • MAX_BATCH_SIZE_KEY

      public static final String MAX_BATCH_SIZE_KEY
      Name of the setting which controls the maximum size of generated batches. If set to something below 2, no batches are used.
      See Also:
    • LOG_STATEMENTS_KEY

      public static final String LOG_STATEMENTS_KEY
      Name of the setting which turns logging of statements on or off.
      See Also:
  • Constructor Details

    • ConnectedStatementsWriter

      public ConnectedStatementsWriter(Connection connection, GeneratorContext context) throws SQLException
      Creates a new StatementsWriter that writes to a database connection.
      Parameters:
      connection - the database connection
      context - contains the indices for initialization
      Throws:
      SQLException - if the connection is invalid
    • ConnectedStatementsWriter

      public ConnectedStatementsWriter(GeneratorContext context) throws SQLException
      Creates a new StatementsWriter that writes to a database connection. The database connection is created from the properties in the context.
      Parameters:
      context - contains the properties and indices for initialization
      Throws:
      SQLException - if the connection is invalid
  • Method Details