/** * INTERNAL: * Iterate over the schemas that need to be dropped. */ public void dropDatabaseSchemas() { for (String databaseSchema : dropDatabaseSchemas.keySet()) { if (shouldWriteToDatabase()) { dropDatabaseSchemas.get(databaseSchema).dropDatabaseSchemaOnDatabase(getSession()); } else { dropDatabaseSchemas.get(databaseSchema).dropDatabaseSchema(getSession(), getDropSchemaWriter()); appendToDDLWriter(getDropSchemaWriter(), "\n"); } } }
void createUniqueConstraints(TableDefinition tableDefinition) throws EclipseLinkException { if (shouldWriteToDatabase()) { tableDefinition.createUniqueConstraintsOnDatabase(getSession()); } else { tableDefinition.setCreateSQLFiles(createSQLFiles); tableDefinition.createUniqueConstraints(getSession(), createSchemaWriter); } }
void createForeignConstraints(TableDefinition tableDefinition) throws EclipseLinkException { if (shouldWriteToDatabase()) { tableDefinition.createForeignConstraintsOnDatabase(getSession()); } else { tableDefinition.setCreateSQLFiles(createSQLFiles); tableDefinition.createForeignConstraints(getSession(), createSchemaWriter); } }
void createUniqueConstraints(TableDefinition tableDefinition) throws EclipseLinkException { if (shouldWriteToDatabase()) { tableDefinition.createUniqueConstraintsOnDatabase(getSession()); } else { tableDefinition.setCreateSQLFiles(createSQLFiles); tableDefinition.createUniqueConstraints(getSession(), createSchemaWriter); } }
void createForeignConstraints(TableDefinition tableDefinition) throws EclipseLinkException { if (shouldWriteToDatabase()) { tableDefinition.createForeignConstraintsOnDatabase(getSession()); } else { tableDefinition.setCreateSQLFiles(createSQLFiles); tableDefinition.createForeignConstraints(getSession(), createSchemaWriter); } }
void createForeignConstraints(TableDefinition tableDefinition) throws EclipseLinkException { if (shouldWriteToDatabase()) { tableDefinition.createForeignConstraintsOnDatabase(getSession()); } else { tableDefinition.setCreateSQLFiles(createSQLFiles); tableDefinition.createForeignConstraints(getSession(), createSchemaWriter); } }
void createUniqueConstraints(TableDefinition tableDefinition) throws EclipseLinkException { if (shouldWriteToDatabase()) { tableDefinition.createUniqueConstraintsOnDatabase(getSession()); } else { tableDefinition.setCreateSQLFiles(createSQLFiles); tableDefinition.createUniqueConstraints(getSession(), createSchemaWriter); } }
/** * INTERNAL: * Iterate over the schemas that need to be dropped. */ public void dropDatabaseSchemas() { for (DatabaseObjectDefinition dod : dropDatabaseSchemas.values()) { if (shouldWriteToDatabase()) { dod.dropDatabaseSchemaOnDatabase(getSession()); } else { dod.dropDatabaseSchema(getSession(), getDropSchemaWriter()); appendToDDLWriter(getDropSchemaWriter(), "\n"); } } }
/** * Use the table definition to add the constraints to the database, this is normally done * in two steps to avoid dependencies. */ public void createConstraints(TableDefinition tableDefinition) throws EclipseLinkException { boolean usesBatchWriting = false; if (getSession().getPlatform().usesBatchWriting()) { usesBatchWriting = true; getSession().getPlatform().setUsesBatchWriting(false); } try { if (shouldWriteToDatabase()) { tableDefinition.createConstraintsOnDatabase(getSession()); } else { tableDefinition.setCreateSQLFiles(createSQLFiles); tableDefinition.createConstraints(getSession(), createSchemaWriter); } } finally { if (usesBatchWriting) { getSession().getPlatform().setUsesBatchWriting(true); } } }
/** * Use the table definition to add the constraints to the database, this is normally done * in two steps to avoid dependencies. */ public void createConstraints(TableDefinition tableDefinition) throws EclipseLinkException { boolean usesBatchWriting = false; if (getSession().getPlatform().usesBatchWriting()) { usesBatchWriting = true; getSession().getPlatform().setUsesBatchWriting(false); } try { if (shouldWriteToDatabase()) { tableDefinition.createConstraintsOnDatabase(getSession()); } else { tableDefinition.setCreateSQLFiles(createSQLFiles); tableDefinition.createConstraints(getSession(), createSchemaWriter); } } finally { if (usesBatchWriting) { getSession().getPlatform().setUsesBatchWriting(true); } } }
/** * Use the table definition to add the constraints to the database, this is normally done * in two steps to avoid dependencies. */ public void createConstraints(TableDefinition tableDefinition) throws EclipseLinkException { boolean usesBatchWriting = false; if (getSession().getPlatform().usesBatchWriting()) { usesBatchWriting = true; getSession().getPlatform().setUsesBatchWriting(false); } try { if (shouldWriteToDatabase()) { tableDefinition.createConstraintsOnDatabase(getSession()); } else { tableDefinition.setCreateSQLFiles(createSQLFiles); tableDefinition.createConstraints(getSession(), createSchemaWriter); } } finally { if (usesBatchWriting) { getSession().getPlatform().setUsesBatchWriting(true); } } }
/** * Use the table definition to drop the constraints from the table, this is normally done * in two steps to avoid dependencies. */ public void dropConstraints(TableDefinition tableDefinition) throws EclipseLinkException { boolean usesBatchWriting = false; if (getSession().getPlatform().usesBatchWriting()) { usesBatchWriting = true; getSession().getPlatform().setUsesBatchWriting(false); } try { if (shouldWriteToDatabase()) { tableDefinition.dropConstraintsOnDatabase(getSession()); } else { tableDefinition.setCreateSQLFiles(createSQLFiles); tableDefinition.dropConstraints(getSession(), getDropSchemaWriter()); } } finally { if (usesBatchWriting) { getSession().getPlatform().setUsesBatchWriting(true); } } }
/** * Use the table definition to drop the constraints from the table, this is normally done * in two steps to avoid dependencies. */ public void dropConstraints(TableDefinition tableDefinition) throws EclipseLinkException { boolean usesBatchWriting = false; if (getSession().getPlatform().usesBatchWriting()) { usesBatchWriting = true; getSession().getPlatform().setUsesBatchWriting(false); } try { if (shouldWriteToDatabase()) { tableDefinition.dropConstraintsOnDatabase(getSession()); } else { tableDefinition.setCreateSQLFiles(createSQLFiles); tableDefinition.dropConstraints(getSession(), getDropSchemaWriter()); } } finally { if (usesBatchWriting) { getSession().getPlatform().setUsesBatchWriting(true); } } }
/** * Use the table definition to drop the constraints from the table, this is normally done * in two steps to avoid dependencies. */ public void dropConstraints(TableDefinition tableDefinition) throws EclipseLinkException { boolean usesBatchWriting = false; if (getSession().getPlatform().usesBatchWriting()) { usesBatchWriting = true; getSession().getPlatform().setUsesBatchWriting(false); } try { if (shouldWriteToDatabase()) { tableDefinition.dropConstraintsOnDatabase(getSession()); } else { tableDefinition.setCreateSQLFiles(createSQLFiles); tableDefinition.dropConstraints(getSession(), getDropSchemaWriter()); } } finally { if (usesBatchWriting) { getSession().getPlatform().setUsesBatchWriting(true); } } }
/** * Use the definition to alter sequence. */ public void alterSequence(SequenceDefinition sequenceDefinition) throws EclipseLinkException { if (!sequenceDefinition.isAlterSupported(getSession())) { return; } boolean usesBatchWriting = false; if (getSession().getPlatform().usesBatchWriting()) { usesBatchWriting = true; getSession().getPlatform().setUsesBatchWriting(false); } try { if (shouldWriteToDatabase()) { sequenceDefinition.alterOnDatabase(getSession()); } else { sequenceDefinition.alter(getSession(), createSchemaWriter); } } finally { if (usesBatchWriting) { getSession().getPlatform().setUsesBatchWriting(true); } } }
/** * Use the definition to alter sequence. */ public void alterSequence(SequenceDefinition sequenceDefinition) throws EclipseLinkException { if (!sequenceDefinition.isAlterSupported(getSession())) { return; } boolean usesBatchWriting = false; if (getSession().getPlatform().usesBatchWriting()) { usesBatchWriting = true; getSession().getPlatform().setUsesBatchWriting(false); } try { if (shouldWriteToDatabase()) { sequenceDefinition.alterOnDatabase(getSession()); } else { sequenceDefinition.alter(getSession(), createSchemaWriter); } } finally { if (usesBatchWriting) { getSession().getPlatform().setUsesBatchWriting(true); } } }
/** * Use the definition to alter sequence. */ public void alterSequence(SequenceDefinition sequenceDefinition) throws EclipseLinkException { if (!sequenceDefinition.isAlterSupported(getSession())) { return; } boolean usesBatchWriting = false; if (getSession().getPlatform().usesBatchWriting()) { usesBatchWriting = true; getSession().getPlatform().setUsesBatchWriting(false); } try { if (shouldWriteToDatabase()) { sequenceDefinition.alterOnDatabase(getSession()); } else { sequenceDefinition.alter(getSession(), createSchemaWriter); } } finally { if (usesBatchWriting) { getSession().getPlatform().setUsesBatchWriting(true); } } }
/** * Use the definition object to drop the schema entity from the database. * This is used for dropping tables, views, procedures ... etc ... */ public void dropObject(DatabaseObjectDefinition databaseObjectDefinition) throws EclipseLinkException { boolean usesBatchWriting = false; if (getSession().getPlatform().usesBatchWriting()) { usesBatchWriting = true; getSession().getPlatform().setUsesBatchWriting(false); } try { if (shouldWriteToDatabase()) { // drop actual object databaseObjectDefinition.dropFromDatabase(getSession()); } else { Writer dropSchemaWriter = getDropSchemaWriter(); // drop actual object databaseObjectDefinition.dropObject(getSession(), dropSchemaWriter, createSQLFiles); if (createSQLFiles){ this.appendToDDLWriter(dropSchemaWriter, getSession().getPlatform().getStoredProcedureTerminationToken()); } this.appendToDDLWriter(dropSchemaWriter, "\n"); } } finally { if (usesBatchWriting) { getSession().getPlatform().setUsesBatchWriting(true); } } }
/** * Use the definition object to create the schema entity on the database. * This is used for creating tables, views, procedures ... etc ... */ public void createObject(DatabaseObjectDefinition databaseObjectDefinition) throws EclipseLinkException { boolean usesBatchWriting = false; if (getSession().getPlatform().usesBatchWriting()) { usesBatchWriting = true; getSession().getPlatform().setUsesBatchWriting(false); } try { if (shouldWriteToDatabase()) { databaseObjectDefinition.createOnDatabase(getSession()); } else { databaseObjectDefinition.createObject(getSession(), createSchemaWriter); if (createSQLFiles){ this.appendToDDLWriter(createSchemaWriter, getSession().getPlatform().getStoredProcedureTerminationToken()); } this.appendToDDLWriter(createSchemaWriter, "\n"); databaseObjectDefinition.postCreateObject(getSession(), createSchemaWriter, createSQLFiles); } } finally { if (usesBatchWriting) { getSession().getPlatform().setUsesBatchWriting(true); } } }