Extension SDK 10.1.3.36.73

oracle.javatools.db.ora
Class OracleDDLGenerator

java.lang.Object
  extended byoracle.javatools.db.AbstractDDLGenerator
      extended byoracle.javatools.db.ora.OracleDDLGenerator
All Implemented Interfaces:
DDLGenerator
Direct Known Subclasses:
Oracle9iR2DDLGenerator, OracleDDLAlterTable

public class OracleDDLGenerator
extends AbstractDDLGenerator
implements DDLGenerator

Implementation of DDLGenerator for Oracle Databases.


Field Summary
protected static java.lang.String ADD
           
protected static java.lang.String AFTER
           
protected static java.lang.String ALTER
           
protected static java.lang.String AS
           
protected static java.lang.String BEFORE
           
protected static java.lang.String BEGIN
           
protected static java.lang.String BODY
           
protected static java.lang.String BUFFER_POOL
           
protected static java.lang.String BY
           
protected static java.lang.String CACHE
           
protected static java.lang.String CASCADE
           
protected static java.lang.String CHECK
           
protected static java.lang.String COLUMN
           
protected static java.lang.String COMMA
           
protected static java.lang.String COMMENT
           
protected static java.lang.String COMMIT
           
protected static java.lang.String CONSTRAINT
           
protected static java.lang.String CONSTRAINTS
           
protected static java.lang.String CREATE
           
protected static java.lang.String CREATE_OR_REPLACE
           
protected static java.lang.String CYCLE
           
protected static java.lang.String DATABASE
           
protected static java.lang.String DEFAULT
           
protected static java.lang.String DELETE
           
protected static java.lang.String DISABLE
           
protected static java.lang.String DOT
           
protected static java.lang.String DQ
           
protected static java.lang.String DROP
           
protected static java.lang.String EACH
           
protected static java.lang.String ENABLE
           
protected static java.lang.String END
           
protected static java.lang.String FOR
           
protected static java.lang.String FORCE
           
protected static java.lang.String FOREIGN
           
protected static java.lang.String FREELIST
           
protected static java.lang.String FREELISTS
           
protected static java.lang.String GLOBAL
           
protected static java.lang.String GRANT
           
protected static java.lang.String GROUPS
           
protected static java.lang.String IDENTIFIED
           
protected static java.lang.String INCREMENT
           
protected static java.lang.String INDEX
           
protected static java.lang.String INITIAL
           
protected static java.lang.String INITRANS
           
protected static java.lang.String INSERT
           
protected static java.lang.String INSTEAD
           
protected static java.lang.String IS
           
protected static java.lang.String KEEP
           
protected static java.lang.String KEY
           
protected static java.lang.String LOGGING
           
protected static java.lang.String LPAREN
           
protected  boolean m_diagnosticPrint
           
protected  DBObjectProvider m_prov
           
protected static java.lang.String MAXEXTENTS
           
protected static java.lang.String MAXTRANS
           
protected static java.lang.String MAXVALUE
           
protected static java.lang.String MINEXTENTS
           
protected static java.lang.String MINVALUE
           
protected static java.lang.String MODIFY
           
protected static java.lang.String NEW
           
protected static java.lang.String NEWLINE
           
protected static java.lang.String NEXT
           
protected static java.lang.String NO
           
protected static java.lang.String NOCYCLE
           
protected static java.lang.String NOLOGGING
           
protected static java.lang.String NOORDER
           
protected static java.lang.String NOT
           
protected static java.lang.String NULL
           
protected static java.lang.String OF
           
protected static java.lang.String OFF
           
protected static java.lang.String OLD
           
protected static java.lang.String ON
           
protected static java.lang.String OR
           
protected static java.lang.String ORDER
           
protected static java.lang.String PCTFREE
           
protected static java.lang.String PCTINCREASE
           
protected static java.lang.String PCTUSED
           
protected static java.lang.String PRESERVE
           
protected static java.lang.String PRIMARY
           
protected static java.lang.String PROMPT
           
protected static java.lang.String PUBLIC
           
protected static java.lang.String RECYCLE
           
protected static java.lang.String REFERENCES
           
protected static java.lang.String REFERENCING
           
protected static java.lang.String RENAME
           
protected static java.lang.String ROW
           
protected static java.lang.String ROWS
           
protected static java.lang.String RPAREN
           
protected static java.lang.String SCHEMA
           
protected static java.lang.String SEMICOLON
           
protected static java.lang.String SEQUENCE
           
protected static java.lang.String SET
           
protected static java.lang.String SINGLEQUOTE
           
protected static java.lang.String SLASH
           
protected static java.lang.String SP
           
protected static java.lang.String SPEC
           
protected static java.lang.String SPOOL
           
protected static java.lang.String SQ
           
protected static java.lang.String SQLBLANKLINES
           
protected static java.lang.String START
           
protected static java.lang.String STORAGE
           
protected static java.lang.String SYNONYM
           
protected static java.lang.String TABLE
           
protected static java.lang.String TABLESPACE
           
protected static java.lang.String TEMPORARY
           
protected static java.lang.String TO
           
protected static java.lang.String TRIGGER
           
protected static java.lang.String TYPE
           
protected static java.lang.String UNIQUE
           
protected static java.lang.String UNLIMITED
           
protected static java.lang.String UPDATE
           
static int UPDATE_ALTER
           
static int UPDATE_REPLACE
           
static int UPDATE_UNKNOWN
           
protected static java.lang.String USER
           
protected static java.lang.String VIEW
           
protected static java.lang.String WHEN
           
protected static java.lang.String WITH
           
protected static java.lang.String YES
           
 
Constructor Summary
OracleDDLGenerator(DBObjectProvider prov)
           
 
Method Summary
protected  void appendConstraintName(java.lang.StringBuffer buf, java.lang.String name)
           
protected  java.lang.String createCommentOn(java.lang.String objType, java.lang.String name, java.lang.String comment)
          create comment on object
protected  Ddl createIndex(Index index)
          Generate the DDL to create an index
protected  OracleDDLAlterTable createOracleDDLAlterTable(ResultSet rs)
           
 Ddl getCreateDDL(Schema schema)
          Retrieves the DDL for creating a new Schema
 Ddl getCreateDDL(SchemaObject[] dbObjects, boolean replace, boolean cascade)
          Retrieves the DDL for creating the specified objects.
 Ddl getCreateDDL(SchemaObject dbObject, boolean replace, boolean cascade)
          Retrieves the DDL for creating the specified object.
 Ddl getDeleteDDL(Schema schema, boolean cascade)
           
 Ddl getDeleteDDL(SchemaObject[] dbObjects, boolean cascade)
          Retrieves the DDL for deleting an array of objects.
 Ddl getDeleteDDL(SchemaObject dbObject, boolean cascade)
          Retrieves the DDL for deleting an object.
protected  java.lang.String getSchemaDotName(DBObject obj)
          get the DB object name in the form SCHEMA.TABLE
protected  java.lang.String getSchemaDotName(Schema schema, java.lang.String objectName)
          get the DB object name in the form SCHEMA.TABLE
 Ddl[] getUpdateDDL(ResultSet rs)
          Get the DDL statments to implement the differences defined by the given result set
 Ddl[] getUpdateDDL(SchemaObject[] dbMaster, SchemaObject[] dbUpdatable)
          Generate DDL to update an array of SchemaObject objects.
 Ddl[] getUpdateDDL(SchemaObject dbMaster, SchemaObject dbUpdatable)
          Generate DDL to update a SchemaObject object.
 boolean hasCreatePrompts()
          is SQL*Plus code being created
protected  java.lang.String schemaDot(FKConstraint fkConstraint)
          Get the schema, iff required.
 void setCreatePrompts(boolean value)
          adds PROMPT statements to the generated DDL.
 void setPrefixSchemaName(boolean value)
          Prefix the Schema Object name with the schema name If this is true, Schema Object names are always prefixed with the schema name.
 void setSpooling(java.lang.String filename)
          adds SPOOL statements to the generated DDL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_diagnosticPrint

protected boolean m_diagnosticPrint

m_prov

protected DBObjectProvider m_prov

UPDATE_UNKNOWN

public static final int UPDATE_UNKNOWN
See Also:
Constant Field Values

UPDATE_ALTER

public static final int UPDATE_ALTER
See Also:
Constant Field Values

UPDATE_REPLACE

public static final int UPDATE_REPLACE
See Also:
Constant Field Values

LPAREN

protected static final java.lang.String LPAREN
See Also:
Constant Field Values

RPAREN

protected static final java.lang.String RPAREN
See Also:
Constant Field Values

SP

protected static final java.lang.String SP
See Also:
Constant Field Values

DOT

protected static final java.lang.String DOT
See Also:
Constant Field Values

COMMA

protected static final java.lang.String COMMA
See Also:
Constant Field Values

SEMICOLON

protected static final java.lang.String SEMICOLON
See Also:
Constant Field Values

SLASH

protected static final java.lang.String SLASH
See Also:
Constant Field Values

SINGLEQUOTE

protected static final java.lang.String SINGLEQUOTE
See Also:
Constant Field Values

DQ

protected static final java.lang.String DQ
See Also:
Constant Field Values

SQ

protected static final java.lang.String SQ
See Also:
Constant Field Values

NEWLINE

protected static final java.lang.String NEWLINE
See Also:
Constant Field Values

ADD

protected static final java.lang.String ADD
See Also:
Constant Field Values

AS

protected static final java.lang.String AS
See Also:
Constant Field Values

AFTER

protected static final java.lang.String AFTER
See Also:
Constant Field Values

ALTER

protected static final java.lang.String ALTER
See Also:
Constant Field Values

BEFORE

protected static final java.lang.String BEFORE
See Also:
Constant Field Values

BEGIN

protected static final java.lang.String BEGIN
See Also:
Constant Field Values

BODY

protected static final java.lang.String BODY
See Also:
Constant Field Values

BY

protected static final java.lang.String BY
See Also:
Constant Field Values

BUFFER_POOL

protected static final java.lang.String BUFFER_POOL
See Also:
Constant Field Values

CACHE

protected static final java.lang.String CACHE
See Also:
Constant Field Values

CASCADE

protected static final java.lang.String CASCADE
See Also:
Constant Field Values

CHECK

protected static final java.lang.String CHECK
See Also:
Constant Field Values

COLUMN

protected static final java.lang.String COLUMN
See Also:
Constant Field Values

COMMENT

protected static final java.lang.String COMMENT
See Also:
Constant Field Values

COMMIT

protected static final java.lang.String COMMIT
See Also:
Constant Field Values

CONSTRAINT

protected static final java.lang.String CONSTRAINT
See Also:
Constant Field Values

CONSTRAINTS

protected static final java.lang.String CONSTRAINTS
See Also:
Constant Field Values

CREATE

protected static final java.lang.String CREATE
See Also:
Constant Field Values

CREATE_OR_REPLACE

protected static final java.lang.String CREATE_OR_REPLACE
See Also:
Constant Field Values

CYCLE

protected static final java.lang.String CYCLE
See Also:
Constant Field Values

DATABASE

protected static final java.lang.String DATABASE
See Also:
Constant Field Values

DEFAULT

protected static final java.lang.String DEFAULT
See Also:
Constant Field Values

DELETE

protected static final java.lang.String DELETE
See Also:
Constant Field Values

DISABLE

protected static final java.lang.String DISABLE
See Also:
Constant Field Values

DROP

protected static final java.lang.String DROP
See Also:
Constant Field Values

EACH

protected static final java.lang.String EACH
See Also:
Constant Field Values

ENABLE

protected static final java.lang.String ENABLE
See Also:
Constant Field Values

END

protected static final java.lang.String END
See Also:
Constant Field Values

FOR

protected static final java.lang.String FOR
See Also:
Constant Field Values

FORCE

protected static final java.lang.String FORCE
See Also:
Constant Field Values

FOREIGN

protected static final java.lang.String FOREIGN
See Also:
Constant Field Values

FREELIST

protected static final java.lang.String FREELIST
See Also:
Constant Field Values

FREELISTS

protected static final java.lang.String FREELISTS
See Also:
Constant Field Values

GLOBAL

protected static final java.lang.String GLOBAL
See Also:
Constant Field Values

GRANT

protected static final java.lang.String GRANT
See Also:
Constant Field Values

GROUPS

protected static final java.lang.String GROUPS
See Also:
Constant Field Values

IDENTIFIED

protected static final java.lang.String IDENTIFIED
See Also:
Constant Field Values

INCREMENT

protected static final java.lang.String INCREMENT
See Also:
Constant Field Values

INDEX

protected static final java.lang.String INDEX
See Also:
Constant Field Values

INITIAL

protected static final java.lang.String INITIAL
See Also:
Constant Field Values

INITRANS

protected static final java.lang.String INITRANS
See Also:
Constant Field Values

INSERT

protected static final java.lang.String INSERT
See Also:
Constant Field Values

INSTEAD

protected static final java.lang.String INSTEAD
See Also:
Constant Field Values

IS

protected static final java.lang.String IS
See Also:
Constant Field Values

KEEP

protected static final java.lang.String KEEP
See Also:
Constant Field Values

KEY

protected static final java.lang.String KEY
See Also:
Constant Field Values

LOGGING

protected static final java.lang.String LOGGING
See Also:
Constant Field Values

MAXEXTENTS

protected static final java.lang.String MAXEXTENTS
See Also:
Constant Field Values

MAXTRANS

protected static final java.lang.String MAXTRANS
See Also:
Constant Field Values

MAXVALUE

protected static final java.lang.String MAXVALUE
See Also:
Constant Field Values

MINEXTENTS

protected static final java.lang.String MINEXTENTS
See Also:
Constant Field Values

MINVALUE

protected static final java.lang.String MINVALUE
See Also:
Constant Field Values

MODIFY

protected static final java.lang.String MODIFY
See Also:
Constant Field Values

NEXT

protected static final java.lang.String NEXT
See Also:
Constant Field Values

NEW

protected static final java.lang.String NEW
See Also:
Constant Field Values

NO

protected static final java.lang.String NO
See Also:
Constant Field Values

NOCYCLE

protected static final java.lang.String NOCYCLE
See Also:
Constant Field Values

NOLOGGING

protected static final java.lang.String NOLOGGING
See Also:
Constant Field Values

NOORDER

protected static final java.lang.String NOORDER
See Also:
Constant Field Values

NOT

protected static final java.lang.String NOT
See Also:
Constant Field Values

NULL

protected static final java.lang.String NULL
See Also:
Constant Field Values

OF

protected static final java.lang.String OF
See Also:
Constant Field Values

OFF

protected static final java.lang.String OFF
See Also:
Constant Field Values

OLD

protected static final java.lang.String OLD
See Also:
Constant Field Values

ON

protected static final java.lang.String ON
See Also:
Constant Field Values

OR

protected static final java.lang.String OR
See Also:
Constant Field Values

ORDER

protected static final java.lang.String ORDER
See Also:
Constant Field Values

PCTFREE

protected static final java.lang.String PCTFREE
See Also:
Constant Field Values

PCTINCREASE

protected static final java.lang.String PCTINCREASE
See Also:
Constant Field Values

PCTUSED

protected static final java.lang.String PCTUSED
See Also:
Constant Field Values

PRESERVE

protected static final java.lang.String PRESERVE
See Also:
Constant Field Values

PRIMARY

protected static final java.lang.String PRIMARY
See Also:
Constant Field Values

PROMPT

protected static final java.lang.String PROMPT
See Also:
Constant Field Values

PUBLIC

protected static final java.lang.String PUBLIC
See Also:
Constant Field Values

RECYCLE

protected static final java.lang.String RECYCLE
See Also:
Constant Field Values

RENAME

protected static final java.lang.String RENAME
See Also:
Constant Field Values

REFERENCES

protected static final java.lang.String REFERENCES
See Also:
Constant Field Values

REFERENCING

protected static final java.lang.String REFERENCING
See Also:
Constant Field Values

ROW

protected static final java.lang.String ROW
See Also:
Constant Field Values

ROWS

protected static final java.lang.String ROWS
See Also:
Constant Field Values

SCHEMA

protected static final java.lang.String SCHEMA
See Also:
Constant Field Values

SEQUENCE

protected static final java.lang.String SEQUENCE
See Also:
Constant Field Values

SET

protected static final java.lang.String SET
See Also:
Constant Field Values

SPEC

protected static final java.lang.String SPEC
See Also:
Constant Field Values

SPOOL

protected static final java.lang.String SPOOL
See Also:
Constant Field Values

SQLBLANKLINES

protected static final java.lang.String SQLBLANKLINES
See Also:
Constant Field Values

START

protected static final java.lang.String START
See Also:
Constant Field Values

STORAGE

protected static final java.lang.String STORAGE
See Also:
Constant Field Values

SYNONYM

protected static final java.lang.String SYNONYM
See Also:
Constant Field Values

TABLE

protected static final java.lang.String TABLE
See Also:
Constant Field Values

TABLESPACE

protected static final java.lang.String TABLESPACE
See Also:
Constant Field Values

TEMPORARY

protected static final java.lang.String TEMPORARY
See Also:
Constant Field Values

TO

protected static final java.lang.String TO
See Also:
Constant Field Values

TRIGGER

protected static final java.lang.String TRIGGER
See Also:
Constant Field Values

TYPE

protected static final java.lang.String TYPE
See Also:
Constant Field Values

UPDATE

protected static final java.lang.String UPDATE
See Also:
Constant Field Values

UNIQUE

protected static final java.lang.String UNIQUE
See Also:
Constant Field Values

UNLIMITED

protected static final java.lang.String UNLIMITED
See Also:
Constant Field Values

USER

protected static final java.lang.String USER
See Also:
Constant Field Values

VIEW

protected static final java.lang.String VIEW
See Also:
Constant Field Values

WHEN

protected static final java.lang.String WHEN
See Also:
Constant Field Values

WITH

protected static final java.lang.String WITH
See Also:
Constant Field Values

YES

protected static final java.lang.String YES
See Also:
Constant Field Values
Constructor Detail

OracleDDLGenerator

public OracleDDLGenerator(DBObjectProvider prov)
Method Detail

getCreateDDL

public Ddl getCreateDDL(SchemaObject dbObject,
                        boolean replace,
                        boolean cascade)
Description copied from interface: DDLGenerator
Retrieves the DDL for creating the specified object.

If the replace option is specified, and the object exists in the provider, DDL is create to drop the object. (except views, where CREATE OR REPLACE is generated)

Specified by:
getCreateDDL in interface DDLGenerator
Parameters:
dbObject - the object for which DDL is required
replace - whether an existing object should be replaced
cascade - whether any DROP associated with replace should be cascaded
Returns:
a string array containing the DDL statements necessary to create the object

getCreateDDL

public Ddl getCreateDDL(SchemaObject[] dbObjects,
                        boolean replace,
                        boolean cascade)
Description copied from interface: DDLGenerator
Retrieves the DDL for creating the specified objects.

If the replace option is specified, DDL is generated to drop all the Foreign Keys in the tables in the specified objects. DDL is then generated to drop all of the specified objects (except views) which exist in the provider.

Specified by:
getCreateDDL in interface DDLGenerator
Parameters:
replace - whether an existing object should be replaced
cascade - whether any DROP associated with replace should be cascaded
Returns:
a string array containing the DDL statements necessary to create the objects

getDeleteDDL

public Ddl getDeleteDDL(SchemaObject dbObject,
                        boolean cascade)
Description copied from interface: DDLGenerator
Retrieves the DDL for deleting an object.

Specified by:
getDeleteDDL in interface DDLGenerator
Parameters:
dbObject - the object to be deleted
cascade - a boolean value indicating whether a cascade delete should be performed, if appropriate for the object type
Returns:
a string array containing the DDL statements for deleting the object

getDeleteDDL

public Ddl getDeleteDDL(SchemaObject[] dbObjects,
                        boolean cascade)
Description copied from interface: DDLGenerator
Retrieves the DDL for deleting an array of objects.

Specified by:
getDeleteDDL in interface DDLGenerator
Parameters:
cascade - a boolean value indicating whether a cascade delete should be performed, if appropriate for the object type
Returns:
a string array containing the DDL statements for deleting the object

getUpdateDDL

public Ddl[] getUpdateDDL(SchemaObject dbMaster,
                          SchemaObject dbUpdatable)
Generate DDL to update a SchemaObject object.

The generated DDL will modified the dbUpdatable object to match the dbMaster object.

If manual reconcile has been requested (see setManualReconcile, the user is presented with a shuttle which allows him to view the differences between dbMaster an dbUpdatable and choose which changes to accept.

If prompts have been requested (see setCreatePrompts) SQLPlus prompts are generated. If prompts and spooling have been requested (see setSpooling) a SPOOL <filename> and SPOOL OFF commands are generated.

Specified by:
getUpdateDDL in interface DDLGenerator
Parameters:
dbMaster - the original version of the object
dbUpdatable - the updated data model
Returns:
a array of objects containing the DDL statements that will update the old object to the new model

getUpdateDDL

public Ddl[] getUpdateDDL(SchemaObject[] dbMaster,
                          SchemaObject[] dbUpdatable)
Generate DDL to update an array of SchemaObject objects.

The generated DDL will modified the dbUpdatable objects to match the dbMaster objects.

If manual reconcile has been requested (see setManualReconcile, the user is presented with a shuttle which allows him to view the differences between dbMaster an dbUpdatable and choose which changes to accept.

If prompts have been requested (see setCreatePrompts) SQLPlus prompts are generated. If prompts and spooling have been requested (see setSpooling) a SPOOL <filename> and SPOOL OFF commands are generated.

Specified by:
getUpdateDDL in interface DDLGenerator
Parameters:
dbMaster - the original versions of the objects
dbUpdatable - the updated data model
Returns:
an array of objects containing the DDL statements that will update the old objects to the new model

getUpdateDDL

public Ddl[] getUpdateDDL(ResultSet rs)
Get the DDL statments to implement the differences defined by the given result set


createOracleDDLAlterTable

protected OracleDDLAlterTable createOracleDDLAlterTable(ResultSet rs)

getCreateDDL

public Ddl getCreateDDL(Schema schema)
Description copied from interface: DDLGenerator
Retrieves the DDL for creating a new Schema

Specified by:
getCreateDDL in interface DDLGenerator
Parameters:
schema - the Schema for which the DDL is required
Returns:
an array of the DDL statements for creating the new Schema

getDeleteDDL

public Ddl getDeleteDDL(Schema schema,
                        boolean cascade)
Specified by:
getDeleteDDL in interface DDLGenerator

setCreatePrompts

public void setCreatePrompts(boolean value)
adds PROMPT statements to the generated DDL. eg PROMPT Creating Table 'EMP'


setSpooling

public void setSpooling(java.lang.String filename)
adds SPOOL statements to the generated DDL. eg PROMPT Creating Table 'EMP'


setPrefixSchemaName

public void setPrefixSchemaName(boolean value)
Prefix the Schema Object name with the schema name If this is true, Schema Object names are always prefixed with the schema name. E.G. SCHEMA.TABLE

If it is false, the schema name is only prepended if it is different to the schema of the object being generated.

Parameters:
value - if true, alway prefix the schema name

hasCreatePrompts

public boolean hasCreatePrompts()
is SQL*Plus code being created

Returns:

getSchemaDotName

protected java.lang.String getSchemaDotName(DBObject obj)
get the DB object name in the form SCHEMA.TABLE


getSchemaDotName

protected java.lang.String getSchemaDotName(Schema schema,
                                            java.lang.String objectName)
get the DB object name in the form SCHEMA.TABLE


schemaDot

protected java.lang.String schemaDot(FKConstraint fkConstraint)
Get the schema, iff required. if the reference schema is different to the current schema, append the schema name and a dot


createIndex

protected Ddl createIndex(Index index)
Generate the DDL to create an index


appendConstraintName

protected void appendConstraintName(java.lang.StringBuffer buf,
                                    java.lang.String name)

createCommentOn

protected java.lang.String createCommentOn(java.lang.String objType,
                                           java.lang.String name,
                                           java.lang.String comment)
create comment on object


Extension SDK 10.1.3.36.73

 

Copyright © 1997, 2005, Oracle.All rights reserved.