/** * PUBLIC: If the schema manager is writing to a writer, append this string * to that writer. */ public void appendToDDLWriter(String stringToWrite) { // If this method is called, we know that it is the old case and // it would not matter which schemaWriter we use as both the // create and drop schemaWriters are essentially the same. // So just pick one. appendToDDLWriter(createSchemaWriter, stringToWrite); }
/** * PUBLIC: If the schema manager is writing to a writer, append this string * to that writer. */ public void appendToDDLWriter(String stringToWrite) { // If this method is called, we know that it is the old case and // it would not matter which schemaWriter we use as both the // create and drop schemaWriters are essentially the same. // So just pick one. appendToDDLWriter(createSchemaWriter, stringToWrite); }
/** * PUBLIC: If the schema manager is writing to a writer, append this string * to that writer. */ public void appendToDDLWriter(String stringToWrite) { // If this method is called, we know that it is the old case and // it would not matter which schemaWriter we use as both the // create and drop schemaWriters are essentially the same. // So just pick one. appendToDDLWriter(createSchemaWriter, stringToWrite); }
/** * 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"); } } }
/** * 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 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); } } }
/** * 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); } } }
appendToDDLWriter(createSchemaWriter, "\n"); this.appendToDDLWriter(createSchemaWriter, getSession().getPlatform().getStoredProcedureTerminationToken()); this.appendToDDLWriter(createSchemaWriter, "\n");
appendToDDLWriter(createSchemaWriter, "\n"); this.appendToDDLWriter(createSchemaWriter, getSession().getPlatform().getStoredProcedureTerminationToken()); this.appendToDDLWriter(createSchemaWriter, "\n");
this.appendToDDLWriter(dropSchemaWriter, getSession().getPlatform().getStoredProcedureTerminationToken()); this.appendToDDLWriter(dropSchemaWriter, "\n");
this.appendToDDLWriter(dropSchemaWriter, getSession().getPlatform().getStoredProcedureTerminationToken()); this.appendToDDLWriter(dropSchemaWriter, "\n");