Package net.ontopia.persistence.rdbms
Class GenericSQLProducer
- java.lang.Object
-
- 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.
-
-
Constructor Summary
Constructors Constructor Description GenericSQLProducer(Project project)
GenericSQLProducer(Project project, String[] platforms)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<String>
addForeignKey(Table table, Column col, String keyname, List<String> statements)
INTERNAL: Generate the DDL statement(s) to add foreigns keys for the specified column.protected List<String>
addPrimaryKeys(Table table, List<String> statements)
INTERNAL: Generate the DDL statement(s) to add primary keys for the specified table.protected List<String>
createIndexes(Table table, List<String> statements)
INTERNAL: Generate the DDL statement(s) to create indexes for the specified table.protected List<String>
createStatement(Table table, List<String> statements)
INTERNAL: Generate the DDL statement(s) to create the specified table.protected List<String>
dropConstraint(Table table, Column col, String keyname, List<String> statements)
INTERNAL: Generate the DDL statement(s) to drop foreigns keys for the specified column.protected List<String>
dropStatement(Table table, List<String> statements)
INTERNAL: Generate the DDL statement(s) to drop the specified table.void
executeCreate(Connection conn)
void
executeDrop(Connection conn)
protected void
executeStatements(List<String> statements, Connection conn)
protected String
getIndexName(Index index)
protected String
getPrimaryKeyName(Table table)
protected void
outputStatements(List<String> 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.
-
-
-
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<String> createStatement(Table table, List<String> statements) throws IOException
INTERNAL: Generate the DDL statement(s) to create the specified table.- Throws:
IOException
-
supportsNullInColumnDefinition
protected boolean supportsNullInColumnDefinition()
-
dropStatement
protected List<String> dropStatement(Table table, List<String> statements) throws IOException
INTERNAL: Generate the DDL statement(s) to drop the specified table.- Throws:
IOException
-
addPrimaryKeys
protected List<String> addPrimaryKeys(Table table, List<String> 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<String> addForeignKey(Table table, Column col, String keyname, List<String> 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<String> dropConstraint(Table table, Column col, String keyname, List<String> 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<String> createIndexes(Table table, List<String> statements) throws IOException
INTERNAL: Generate the DDL statement(s) to create indexes for the specified table.- Throws:
IOException
-
outputStatements
protected void outputStatements(List<String> statements, Writer writer) throws IOException
- Throws:
IOException
-
executeStatements
protected void executeStatements(List<String> statements, Connection conn) throws IOException, SQLException
- Throws:
IOException
SQLException
-
supportsForeignKeys
protected boolean supportsForeignKeys()
-
-