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 java.lang.Object

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


Field Summary
protected  java.lang.String[] platforms
           
protected  Project project
           
 
Constructor Summary
GenericSQLProducer(Project project)
           
GenericSQLProducer(Project project, java.lang.String[] platforms)
           
 
Method Summary
protected  java.util.List addForeignKey(Table table, Column col, java.lang.String keyname, java.util.List statements)
          INTERNAL: Generate the DDL statement(s) to add foreigns keys for the specified column.
protected  java.util.List addPrimaryKeys(Table table, java.util.List statements)
          INTERNAL: Generate the DDL statement(s) to add primary keys for the specified table.
protected  java.util.List createIndexes(Table table, java.util.List statements)
          INTERNAL: Generate the DDL statement(s) to create indexes for the specified table.
protected  java.util.List createStatement(Table table, java.util.List statements)
          INTERNAL: Generate the DDL statement(s) to create the specified table.
protected  java.util.List dropConstraint(Table table, Column col, java.lang.String keyname, java.util.List statements)
          INTERNAL: Generate the DDL statement(s) to drop foreigns keys for the specified column.
protected  java.util.List dropStatement(Table table, java.util.List statements)
          INTERNAL: Generate the DDL statement(s) to drop the specified table.
 void executeCreate(java.sql.Connection conn)
           
 void executeDrop(java.sql.Connection conn)
           
protected  void executeStatements(java.util.List statements, java.sql.Connection conn)
           
protected  java.lang.String getIndexName(Index index)
           
protected  java.lang.String getPrimaryKeyName(Table table)
           
protected  void outputStatements(java.util.List statements, java.io.Writer writer)
           
protected  boolean supportsForeignKeys()
           
protected  boolean supportsNullInColumnDefinition()
           
 void writeCreate(java.io.Writer writer)
          INTERNAL: Create the DDL statement(s) to create the database schema.
 void writeDrop(java.io.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 java.lang.String[] platforms
Constructor Detail

GenericSQLProducer

public GenericSQLProducer(Project project)

GenericSQLProducer

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

writeCreate

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

Throws:
java.io.IOException

executeCreate

public void executeCreate(java.sql.Connection conn)
                   throws java.io.IOException,
                          java.sql.SQLException
Throws:
java.io.IOException
java.sql.SQLException

writeDrop

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

Throws:
java.io.IOException

executeDrop

public void executeDrop(java.sql.Connection conn)
                 throws java.io.IOException,
                        java.sql.SQLException
Throws:
java.io.IOException
java.sql.SQLException

createStatement

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

Throws:
java.io.IOException

getPrimaryKeyName

protected java.lang.String getPrimaryKeyName(Table table)

getIndexName

protected java.lang.String getIndexName(Index index)

supportsNullInColumnDefinition

protected boolean supportsNullInColumnDefinition()

dropStatement

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

Throws:
java.io.IOException

addPrimaryKeys

protected java.util.List addPrimaryKeys(Table table,
                                        java.util.List statements)
                                 throws java.io.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:
java.io.IOException

addForeignKey

protected java.util.List addForeignKey(Table table,
                                       Column col,
                                       java.lang.String keyname,
                                       java.util.List statements)
                                throws java.io.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:
java.io.IOException

dropConstraint

protected java.util.List dropConstraint(Table table,
                                        Column col,
                                        java.lang.String keyname,
                                        java.util.List statements)
                                 throws java.io.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:
java.io.IOException

createIndexes

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

Throws:
java.io.IOException

outputStatements

protected void outputStatements(java.util.List statements,
                                java.io.Writer writer)
                         throws java.io.IOException
Throws:
java.io.IOException

executeStatements

protected void executeStatements(java.util.List statements,
                                 java.sql.Connection conn)
                          throws java.io.IOException,
                                 java.sql.SQLException
Throws:
java.io.IOException
java.sql.SQLException

supportsForeignKeys

protected boolean supportsForeignKeys()


Copyright © 2000-2012 Ontopia.