net.ontopia.persistence.rdbms
Class GenericSQLProducer

java.lang.Object
  extended by net.ontopia.persistence.rdbms.GenericSQLProducer
Direct Known Subclasses:
DB2SQLProducer, FirebirdSQLProducer, MySqlSQLProducer, OracleSQLProducer, PostgreSQLProducer, SQLServerSQLProducer

public class GenericSQLProducer
extends Object

INTERNAL: Class that generates DDL statements for the generic database platform.


Field Summary
protected  String[] platforms
           
protected  Project project
           
 
Constructor Summary
GenericSQLProducer(Project project)
           
GenericSQLProducer(Project project, String[] platforms)
           
 
Method Summary
protected  List addForeignKey(Table table, Column col, String keyname, List statements)
          INTERNAL: Generate the DDL statement(s) to add foreigns keys for the specified column.
protected  List addPrimaryKeys(Table table, List statements)
          INTERNAL: Generate the DDL statement(s) to add primary keys for the specified table.
protected  List createIndexes(Table table, List statements)
          INTERNAL: Generate the DDL statement(s) to create indexes for the specified table.
protected  List createStatement(Table table, List statements)
          INTERNAL: Generate the DDL statement(s) to create the specified table.
protected  List dropConstraint(Table table, Column col, String keyname, List statements)
          INTERNAL: Generate the DDL statement(s) to drop foreigns keys for the specified column.
protected  List dropStatement(Table table, List statements)
          INTERNAL: Generate the DDL statement(s) to drop the specified table.
 void executeCreate(Connection conn)
           
 void executeDrop(Connection conn)
           
protected  void executeStatements(List statements, Connection conn)
           
protected  String getIndexName(Index index)
           
protected  String getPrimaryKeyName(Table table)
           
protected  void outputStatements(List statements, Writer writer)
           
protected  boolean supportsForeignKeys()
           
protected  boolean supportsNullInColumnDefinition()
           
 void writeCreate(Writer writer)
          INTERNAL: Create the DDL statement(s) to create the database schema.
 void writeDrop(Writer writer)
          INTERNAL: Create the DDL statement(s) to drop the database schema.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

project

protected Project project

platforms

protected String[] platforms
Constructor Detail

GenericSQLProducer

public GenericSQLProducer(Project project)

GenericSQLProducer

public GenericSQLProducer(Project project,
                          String[] platforms)
Method Detail

writeCreate

public void writeCreate(Writer writer)
                 throws IOException
INTERNAL: Create the DDL statement(s) to create the database schema.

Throws:
IOException

executeCreate

public void executeCreate(Connection conn)
                   throws IOException,
                          SQLException
Throws:
IOException
SQLException

writeDrop

public void writeDrop(Writer writer)
               throws IOException
INTERNAL: Create the DDL statement(s) to drop the database schema.

Throws:
IOException

executeDrop

public void executeDrop(Connection conn)
                 throws IOException,
                        SQLException
Throws:
IOException
SQLException

createStatement

protected List createStatement(Table table,
                               List statements)
                        throws IOException
INTERNAL: Generate the DDL statement(s) to create the specified table.

Throws:
IOException

getPrimaryKeyName

protected String getPrimaryKeyName(Table table)

getIndexName

protected String getIndexName(Index index)

supportsNullInColumnDefinition

protected boolean supportsNullInColumnDefinition()

dropStatement

protected List dropStatement(Table table,
                             List statements)
                      throws IOException
INTERNAL: Generate the DDL statement(s) to drop the specified table.

Throws:
IOException

addPrimaryKeys

protected List addPrimaryKeys(Table table,
                              List statements)
                       throws IOException
INTERNAL: Generate the DDL statement(s) to add primary keys for the specified table. This method should only be implemented if primary keys need to be created by a separate statement.

Throws:
IOException

addForeignKey

protected List addForeignKey(Table table,
                             Column col,
                             String keyname,
                             List statements)
                      throws IOException
INTERNAL: Generate the DDL statement(s) to add foreigns keys for the specified column. This method should only be implemented if foreign keys need to be created by a separate statement.

Throws:
IOException

dropConstraint

protected List dropConstraint(Table table,
                              Column col,
                              String keyname,
                              List statements)
                       throws IOException
INTERNAL: Generate the DDL statement(s) to drop foreigns keys for the specified column. This method should only be implemented if foreign keys need to be created by a separate statement.

Throws:
IOException

createIndexes

protected List createIndexes(Table table,
                             List statements)
                      throws IOException
INTERNAL: Generate the DDL statement(s) to create indexes for the specified table.

Throws:
IOException

outputStatements

protected void outputStatements(List statements,
                                Writer writer)
                         throws IOException
Throws:
IOException

executeStatements

protected void executeStatements(List statements,
                                 Connection conn)
                          throws IOException,
                                 SQLException
Throws:
IOException
SQLException

supportsForeignKeys

protected boolean supportsForeignKeys()


Copyright © 2000-2012 Ontopia.