Class DDLCreator

java.lang.Object
net.sf.jailer.ddl.DDLCreator

public class DDLCreator extends Object
Creates the DDL for the working-tables.
Author:
Ralf Wisser
  • Field Details

    • uPKWasTooLong

      public static volatile boolean uPKWasTooLong
    • uPK

      public static volatile String uPK
    • lastDDL

      public static String lastDDL
  • Constructor Details

    • DDLCreator

      public DDLCreator(ExecutionContext executionContext)
      Constructor.
      Parameters:
      executionContext - the execution context
  • Method Details

    • createDDL

      public boolean createDDL(DataSource dataSource, DBMS dbms, WorkingTableScope temporaryTableScope, String workingTableSchema) throws SQLException, FileNotFoundException, IOException
      Creates the DDL for the working-tables.
      Parameters:
      dataSource - the data source, or null to print DDL to stdout
      dbms - the target DBMS configuration
      temporaryTableScope - the scope for working tables
      workingTableSchema - the schema for working tables, or null for the default schema
      Returns:
      true if DDL was created successfully
      Throws:
      SQLException
      FileNotFoundException
      IOException
    • createDDL

      public void createDDL(Session localSession, WorkingTableScope temporaryTableScope, String workingTableSchema) throws FileNotFoundException, IOException, SQLException
      Creates the DDL for the working-tables.
      Parameters:
      localSession - the database session to execute DDL against
      temporaryTableScope - the scope for working tables
      workingTableSchema - the schema for working tables, or null for the default schema
      Throws:
      FileNotFoundException
      IOException
      SQLException
    • createDDL

      public boolean createDDL(DataModel datamodel, Session session, WorkingTableScope temporaryTableScope, String workingTableSchema) throws FileNotFoundException, IOException, SQLException
      Creates the DDL for the working-tables.
      Parameters:
      datamodel - the data model
      session - the database session, or null to print DDL to stdout
      temporaryTableScope - the scope for working tables
      workingTableSchema - the schema for working tables, or null for the default schema
      Returns:
      true if DDL was created successfully
      Throws:
      FileNotFoundException
      IOException
      SQLException
    • createDDL

      public boolean createDDL(DataModel datamodel, Session session, WorkingTableScope temporaryTableScope, RowIdSupport rowIdSupport, String workingTableSchema) throws FileNotFoundException, IOException, SQLException
      Creates the DDL for the working-tables.
      Parameters:
      datamodel - the data model
      session - the database session, or null to print DDL to stdout
      temporaryTableScope - the scope for working tables
      rowIdSupport - the row-id support configuration
      workingTableSchema - the schema for working tables, or null for the default schema
      Returns:
      true if DDL was created successfully
      Throws:
      FileNotFoundException
      IOException
      SQLException
    • isUptodate

      public boolean isUptodate(DataSource dataSource, DBMS dbms, boolean useRowId, boolean useRowIdsOnlyForTablesWithoutPK, String workingTableSchema)
      Checks whether working-tables schema is up-to-date.
      Parameters:
      dataSource - the data source
      dbms - the target DBMS configuration
      useRowId - true if row IDs are used instead of primary keys
      useRowIdsOnlyForTablesWithoutPK - true to use row IDs only for tables without a primary key
      workingTableSchema - the schema for working tables, or null for the default schema
      Returns:
      true if working-tables schema is up-to-date
    • isUptodate

      public boolean isUptodate(Session session, boolean useRowId, boolean useRowIdsOnlyForTablesWithoutPK, String workingTableSchema)
      Checks whether working-tables schema is up-to-date.
      Parameters:
      session - the database session
      useRowId - true if row IDs are used instead of primary keys
      useRowIdsOnlyForTablesWithoutPK - true to use row IDs only for tables without a primary key
      workingTableSchema - the schema for working tables, or null for the default schema
      Returns:
      true if working-tables schema is up-to-date
    • getTableInConflict

      public String getTableInConflict(DataSource dataSource, DBMS dbms)
      Checks for conflicts of existing tables and working-tables.
      Parameters:
      dataSource - the data source
      dbms - the target DBMS configuration
      Returns:
      name of table in conflict or null