Dresden OCL Toolkit

tudresden.ocl.sql
Interface SQLBuilder

All Known Implementing Classes:
OracleSQLBuilder, SybaseSQLBuilder

public interface SQLBuilder

This interface specifies methodes to build SQL code. It should be implemented by classes to build database specific statements. This interface realizes the builder interface of the Builder pattern from Gamma. The director part is realized by implementations of the SQLDirector interface. The product is a String. See the OracleSQLBuilder for an example how to implement a SQLBuilder. Basically, the product should be build by concatenating single parts.

Version:
1.1 (revised by Andrea Kling, added optional columns and multiple Foreign keys)
Author:
Sten Löcher
See Also:
SQLDirector

Method Summary
 void addAlias(String name)
           
 void addAnd()
           
 void addColumn(String name)
           
 void addColumn(String colName, boolean isOptional, 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)
           
 void beginTable(String tableName)
           
 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()
           
 void reset()
          Resets the Builder to an empty product.
 

Method Detail

getCode

public String getCode()
Returns:
the product that was build (database specific DDL)

reset

public void reset()
Resets the Builder to an empty product.


beginTable

public void beginTable(String tableName)

addColumn

public void addColumn(String colName,
                      String colType,
                      boolean pk)

addColumn

public void addColumn(String colName,
                      boolean isOptional,
                      String colType)

addColumnSeparator

public void addColumnSeparator()

endTable

public void endTable()

addFKConstraint

public void addFKConstraint(String conName,
                            String tableName,
                            String colName,
                            String fkTable,
                            String fkColName)

addFKConstraint

public void addFKConstraint(String conName,
                            String tableName,
                            String[] colName,
                            String fkTable,
                            String[] fkColName)

createView

public void createView(String name,
                       boolean alias)

addAlias

public void addAlias(String name)

endView

public void endView()

createAssertionReplacement

public void createAssertionReplacement(String triggerName,
                                       String tableName,
                                       String viewName,
                                       String errMsg)

createECATriggerTemplate

public void createECATriggerTemplate(String triggerName,
                                     String tableName,
                                     String viewName)

createSelect

public void createSelect()

addColumn

public void addColumn(String name)

createFrom

public void createFrom()

addTable

public void addTable(String name)

createWhere

public void createWhere()

createUnion

public void createUnion()

addEquation

public void addEquation(String op1,
                        String op2)

addAnd

public void addAnd()

getDescription

public String getDescription()
Returns:
a description of the database system(s) the builder is for

endStatement

public void endStatement()
adds a statement seperator for sql-scripts


Dresden OCL Toolkit

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