java.lang.Object
com.sun.jdo.spi.persistence.generator.database.DDLGenerator

public class DDLGenerator extends Object
This class generates DDL for a given SchemaElement.
Author:
Jie Leng, Dave Bristor
  • Constructor Details

    • DDLGenerator

      public DDLGenerator()
  • Method Details

    • generateDDL

      public static void generateDDL(org.netbeans.modules.dbschema.SchemaElement schema, String dbVendorName, OutputStream createDDLSql, OutputStream dropDDLSql, OutputStream dropDDLJdbc, OutputStream createDDLJdbc, OutputStream dbStream, boolean dropAndCreateTbl) throws org.netbeans.modules.dbschema.DBException, SQLException, IOException
      Generate DDL from schema and database vendor name. Up to four files containing DDL are created:
      • create table DDL destined for human readers
      • create table DDL destined for a JDBC connection
      • drop table DDL destined for human readers
      • drop table DDL destined for a JDBC connection
      Furthermore, if the datbase output stream is not null, then create tables in database.
      Parameters:
      schema - Database schema for which DDL is generated.
      dbVendorName - Name of database vendor, which must match one of the names of the .properties files in this package.
      createDDLSql - An OutputStream to which human-readable DDL for creating tables gets written.
      dropDDLSql - An OutputStream to which human-readable DDL for dropping tables gets written.
      dropDDLJdbc - An OutputStream to which DDL for dropping tables gets written. This parameter differs from dropDDLSql because the data written into it is supposed to be used with a JDBC connection.
      createDDLJdbc - An OutputStream to which DDL for creating tables gets written. This parameter differs from createDDLSql because the data written into it is supposed to be used with a JDBC connection.
      dbStream - DatabaseOutputStream which, if not null, is used to create tables in a live database during this method call.
      dropAndCreateTbl - If true, and dbStream is not null, then existing tables are dropped before new ones are created.
      Throws:
      org.netbeans.modules.dbschema.DBException
      SQLException
      IOException