Dresden OCL Toolkit

tudresden.ocl.sql
Class OracleSQLBuilder

java.lang.Object
  extended bytudresden.ocl.sql.OracleSQLBuilder
All Implemented Interfaces:
SQLBuilder

public class OracleSQLBuilder
extends Object
implements SQLBuilder

Implements the SQLBuilder interface for Oracle specific SQL code. See the documentation of the SQLBuilder interface for more information.

Version:
1.1 (revised by Andrea Kling 2002, added usage of TypeManager)
Author:
Sten L?cher
See Also:
SQLBuilder, TypeManager

Field Summary
private  int aliasCount
           
private  Hashtable datatypes
           
private  int nextAliasPos
           
private  String pks
           
private  HashSet reserved
           
private  StringBuffer theCode
           
 
Constructor Summary
OracleSQLBuilder()
           
 
Method Summary
 void addAlias(String name)
           
 void addAnd()
           
 void addColumn(String name)
           
 void addColumn(String colName, boolean optional, String colType)
           
 void addColumn(String colName, String colType, boolean pk)
           
 void addColumnSeparator()
           
 void addEquation(String op1, String op2)
           
 void addFKConstraint(String conName, String tableName, String[] colName, String fkTable, String[] fkColName)
           
 void addFKConstraint(String conName, String tableName, String colName, String fkTable, String fkColName)
           
 void addTable(String name)
           
private  void append(String s)
           
 void beginTable(String tableName)
           
private  String check(String word)
           
 void createAssertionReplacement(String triggerName, String tableName, String viewName, String errMsg)
           
 void createECATriggerTemplate(String triggerName, String tableName, String viewName)
           
 void createFrom()
           
 void createSelect()
           
 void createUnion()
           
 void createView(String name, boolean alias)
           
 void createWhere()
           
 void endStatement()
          adds a statement seperator for sql-scripts
 void endTable()
           
 void endView()
           
 String getCode()
           
 String getDescription()
           
private  void insert(String s)
           
 void reset()
          Resets the Builder to an empty product.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theCode

private StringBuffer theCode

nextAliasPos

private int nextAliasPos

aliasCount

private int aliasCount

datatypes

private Hashtable datatypes

pks

private String pks

reserved

private HashSet reserved
Constructor Detail

OracleSQLBuilder

public OracleSQLBuilder()
Method Detail

getCode

public String getCode()
Specified by:
getCode in interface SQLBuilder
Returns:
the product that was build (database specific DDL)

reset

public void reset()
Description copied from interface: SQLBuilder
Resets the Builder to an empty product.

Specified by:
reset in interface SQLBuilder

append

private void append(String s)

insert

private void insert(String s)

createView

public void createView(String name,
                       boolean alias)
Specified by:
createView in interface SQLBuilder

addAlias

public void addAlias(String name)
Specified by:
addAlias in interface SQLBuilder

createSelect

public void createSelect()
Specified by:
createSelect in interface SQLBuilder

addColumn

public void addColumn(String name)
Specified by:
addColumn in interface SQLBuilder

createFrom

public void createFrom()
Specified by:
createFrom in interface SQLBuilder

addTable

public void addTable(String name)
Specified by:
addTable in interface SQLBuilder

createWhere

public void createWhere()
Specified by:
createWhere in interface SQLBuilder

createUnion

public void createUnion()
Specified by:
createUnion in interface SQLBuilder

addEquation

public void addEquation(String op1,
                        String op2)
Specified by:
addEquation in interface SQLBuilder

addAnd

public void addAnd()
Specified by:
addAnd in interface SQLBuilder

createAssertionReplacement

public void createAssertionReplacement(String triggerName,
                                       String tableName,
                                       String viewName,
                                       String errMsg)
Specified by:
createAssertionReplacement in interface SQLBuilder

createECATriggerTemplate

public void createECATriggerTemplate(String triggerName,
                                     String tableName,
                                     String viewName)
Specified by:
createECATriggerTemplate in interface SQLBuilder

beginTable

public void beginTable(String tableName)
Specified by:
beginTable in interface SQLBuilder

addColumn

public void addColumn(String colName,
                      String colType,
                      boolean pk)
Specified by:
addColumn in interface SQLBuilder

check

private String check(String word)

addColumn

public void addColumn(String colName,
                      boolean optional,
                      String colType)
Specified by:
addColumn in interface SQLBuilder

endTable

public void endTable()
Specified by:
endTable in interface SQLBuilder

addColumnSeparator

public void addColumnSeparator()
Specified by:
addColumnSeparator in interface SQLBuilder

addFKConstraint

public void addFKConstraint(String conName,
                            String tableName,
                            String colName,
                            String fkTable,
                            String fkColName)
Specified by:
addFKConstraint in interface SQLBuilder

addFKConstraint

public void addFKConstraint(String conName,
                            String tableName,
                            String[] colName,
                            String fkTable,
                            String[] fkColName)
Specified by:
addFKConstraint in interface SQLBuilder

endView

public void endView()
Specified by:
endView in interface SQLBuilder

endStatement

public void endStatement()
Description copied from interface: SQLBuilder
adds a statement seperator for sql-scripts

Specified by:
endStatement in interface SQLBuilder

getDescription

public String getDescription()
Specified by:
getDescription in interface SQLBuilder
Returns:
a description of the database system(s) the builder is for

Dresden OCL Toolkit

Submit a bug
Developed at the Dresden University of Technology.
This software is published under the GNU Lesser General Public License.