|
Dresden OCL Toolkit | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttudresden.ocl.sql.DDLGenerator
A DDL (Data Definition Language) generator. The generator takes a ORMapping implementation as input and generates a script that contains a number of table definitions including primary and foreign key references. Which tables are going to be created is determined by the implementation of ORMapping, which does the actual object relational mapping. The DDLGenerator just queries the information produced by the implementation of ORMapping and generates the appropriate DDL script. The generated DDL script is executable on Oracle 8i. To adapt the Generator for other database systems, just subclass DDLGenerator and replace the String variables that contain the DDL tokens.
ORMapping
Field Summary | |
private static String |
CONSTRAINT_NAME
|
private int |
constraintCount
|
private boolean |
scriptGenerated
|
private String |
theScript
|
private SQLBuilder |
theSQLBuilder
|
Constructor Summary | |
(package private) |
DDLGenerator()
|
Method Summary | |
void |
createDDL(ORMapping orm,
SQLBuilder sqlb)
Creates the DDL script. |
private void |
createTable(Table t)
Generates the table definition including the primary key constraints for a table. |
String |
getDDLScript()
|
static void |
main(String[] arg)
For command line and debugging operations only. |
private void |
setForeignKeys(Table t)
Generates alter table statements to create foreign key references. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private String theScript
private int constraintCount
private boolean scriptGenerated
private SQLBuilder theSQLBuilder
private static String CONSTRAINT_NAME
Constructor Detail |
DDLGenerator()
Method Detail |
public static void main(String[] arg)
public String getDDLScript() throws IllegalStateException
IllegalStateException
- if no script was generated before calling this methodepublic void createDDL(ORMapping orm, SQLBuilder sqlb)
private void createTable(Table t)
t
- the table for which the definitions should be createdprivate void setForeignKeys(Table t)
t
- the table for which the alter table statements should be created
|
Dresden OCL Toolkit | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |