wt.tools.generation.sql
Class SQLServerSQLGenerator

java.lang.Object
  extended bywt.tools.generation.sql.SQLGenerator
      extended bywt.tools.generation.sql.SQLServerSQLGenerator

public class SQLServerSQLGenerator
extends SQLGenerator

Construct a block of sql code to create a table


Field Summary
private static String ENDPROC
           
private static int MAX_COLUMN_BYTE_SIZE
           
private static int MAX_DECIMAL_PRECISION
           
private static int MAX_INDEXNAME_LENGTH
           
private static int MAXSQLSTRINGSIZE
           
private static String NOT_NULL_CLAUSE
           
private static int ORACLE_BLOB_TYPE
           
protected static WTProperties properties
           
private static HashMap UNIQUE_NAMES
           
 
Fields inherited from class wt.tools.generation.sql.SQLGenerator
COMMA_DELIMITER, DB_DELIMITER
 
Constructor Summary
SQLServerSQLGenerator()
           
 
Method Summary
 void createAlterTableAddColumns(BaseTableInfo a_baseTableInfo, StringBuffer a_buffer)
           
 void createAlterTableDropColumns(BaseTableInfo a_baseTableInfo, StringBuffer a_buffer)
           
 void createColumnIndex(String a_className, DatabaseInfo a_dbInfo, StringBuffer a_buffer)
           
 void createIndicies(BaseTableInfo a_baseTableInfo, String[][] a_indexColumns, boolean a_isUnique, StringBuffer a_buffer)
           
 void createTable(String a_className, ClassInfo a_classInfo, DatabaseInfo a_dbInfo, StringBuffer a_buffer)
           
 void dropColumnIndex(String a_className, DatabaseInfo a_dbInfo, StringBuffer a_buffer)
           
 void dropIndex(BaseTableInfo a_tableInfo, String[] a_columns, boolean a_isUnique, String a_indexName, StringBuffer a_buffer)
           
 void dropIndicies(BaseTableInfo a_baseTableInfo, String[][] a_indexColumns, boolean a_isUnique, StringBuffer a_buffer)
           
 String dropTable(String aTablename, StringBuffer a_buffer)
          This method constructs the statement to drop the table.
 String dropView(String a_viewName, StringBuffer a_buffer)
          This method constructs the statement to drop the view.
protected  String getCommitDelimiter()
           
 ColumnDescriptor[] getComputedColumns(BaseTableInfo a_tableInfo)
           
 String[] getIndexColumns_function(BaseTableInfo a_baseTableInfo, String[] a_indexColumns, boolean a_isUnique, int a_indexOffset)
           
 String[] getIndexColumns(BaseTableInfo a_baseTableInfo, String[] a_indexColumns, boolean a_isUnique, int a_indexOffset)
           
protected  int getMaxIndexNameLength()
           
 String getSQLTypeAsString(int sql_type, int string_length)
           
static String getSQLTypeString(int sqltype, int stringLength)
           
protected  Map getUniqueNames()
           
 boolean isComputedColumn(String colName, String[] allColumnNames)
           
protected  boolean isReservedWord(String a_name)
           
 boolean isSQLTypeBlob(int sql_type)
           
protected  void preCreateView(String a_viewName, StringBuffer a_buffer)
           
 
Methods inherited from class wt.tools.generation.sql.SQLGenerator
createAllClassesTriggerConstraintItems, createArray, createFKConstraintItems, createFKConstraintItems, createFKConstraintItems, createFKConstraints, createIndex, createIndexItems, createIndexOption, createLinkSpecificTriggerConstraintItems, createLinkTriggerConstraintItems, createRoleFKConstraintItems, createRoleTriggerConstraintItems, createSequence, createStruct, createTableItems, createTriggerConstraintItems, createTriggerConstraints_removeLink, createTriggerConstraints_removeRole, createTriggerItems, createView, dropArray, dropFKConstraints, dropIndexItems, dropSequence, dropStruct, dropTriggerItems, getAdjustedName, getComputedIndexColumns, getDescendentTables, getIndexName, getProcessedLinkInfos, getTableColumns, getTriggerNameList, getUpdateColumnList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOT_NULL_CLAUSE

private static final String NOT_NULL_CLAUSE
See Also:
Constant Field Values

ENDPROC

private static final String ENDPROC
See Also:
Constant Field Values

MAXSQLSTRINGSIZE

private static final int MAXSQLSTRINGSIZE

MAX_INDEXNAME_LENGTH

private static final int MAX_INDEXNAME_LENGTH
See Also:
Constant Field Values

MAX_COLUMN_BYTE_SIZE

private static final int MAX_COLUMN_BYTE_SIZE
See Also:
Constant Field Values

MAX_DECIMAL_PRECISION

private static final int MAX_DECIMAL_PRECISION
See Also:
Constant Field Values

ORACLE_BLOB_TYPE

private static final int ORACLE_BLOB_TYPE
See Also:
Constant Field Values

properties

protected static WTProperties properties

UNIQUE_NAMES

private static final HashMap UNIQUE_NAMES
Constructor Detail

SQLServerSQLGenerator

public SQLServerSQLGenerator()
Method Detail

createTable

public void createTable(String a_className,
                        ClassInfo a_classInfo,
                        DatabaseInfo a_dbInfo,
                        StringBuffer a_buffer)
                 throws WTException
Specified by:
createTable in class SQLGenerator
Throws:
WTException

dropTable

public String dropTable(String aTablename,
                        StringBuffer a_buffer)
This method constructs the statement to drop the table.

Specified by:
dropTable in class SQLGenerator

createColumnIndex

public void createColumnIndex(String a_className,
                              DatabaseInfo a_dbInfo,
                              StringBuffer a_buffer)
                       throws WTException
Specified by:
createColumnIndex in class SQLGenerator
Throws:
WTException

dropColumnIndex

public void dropColumnIndex(String a_className,
                            DatabaseInfo a_dbInfo,
                            StringBuffer a_buffer)
                     throws WTException
Specified by:
dropColumnIndex in class SQLGenerator
Throws:
WTException

dropView

public String dropView(String a_viewName,
                       StringBuffer a_buffer)
This method constructs the statement to drop the view.

Overrides:
dropView in class SQLGenerator

preCreateView

protected void preCreateView(String a_viewName,
                             StringBuffer a_buffer)
Specified by:
preCreateView in class SQLGenerator

getCommitDelimiter

protected String getCommitDelimiter()
Specified by:
getCommitDelimiter in class SQLGenerator

getMaxIndexNameLength

protected int getMaxIndexNameLength()
Specified by:
getMaxIndexNameLength in class SQLGenerator

getUniqueNames

protected Map getUniqueNames()
Specified by:
getUniqueNames in class SQLGenerator

isReservedWord

protected boolean isReservedWord(String a_name)
Specified by:
isReservedWord in class SQLGenerator

getSQLTypeString

public static String getSQLTypeString(int sqltype,
                                      int stringLength)

isSQLTypeBlob

public boolean isSQLTypeBlob(int sql_type)
Specified by:
isSQLTypeBlob in class SQLGenerator

getSQLTypeAsString

public String getSQLTypeAsString(int sql_type,
                                 int string_length)
Specified by:
getSQLTypeAsString in class SQLGenerator

getComputedColumns

public ColumnDescriptor[] getComputedColumns(BaseTableInfo a_tableInfo)
                                      throws WTException
Overrides:
getComputedColumns in class SQLGenerator
Throws:
WTException

getIndexColumns

public String[] getIndexColumns(BaseTableInfo a_baseTableInfo,
                                String[] a_indexColumns,
                                boolean a_isUnique,
                                int a_indexOffset)
Specified by:
getIndexColumns in class SQLGenerator

getIndexColumns_function

public String[] getIndexColumns_function(BaseTableInfo a_baseTableInfo,
                                         String[] a_indexColumns,
                                         boolean a_isUnique,
                                         int a_indexOffset)

createAlterTableAddColumns

public void createAlterTableAddColumns(BaseTableInfo a_baseTableInfo,
                                       StringBuffer a_buffer)
                                throws WTException
Overrides:
createAlterTableAddColumns in class SQLGenerator
Throws:
WTException

createAlterTableDropColumns

public void createAlterTableDropColumns(BaseTableInfo a_baseTableInfo,
                                        StringBuffer a_buffer)
                                 throws WTException
Overrides:
createAlterTableDropColumns in class SQLGenerator
Throws:
WTException

createIndicies

public void createIndicies(BaseTableInfo a_baseTableInfo,
                           String[][] a_indexColumns,
                           boolean a_isUnique,
                           StringBuffer a_buffer)
                    throws WTException
Specified by:
createIndicies in class SQLGenerator
Throws:
WTException

dropIndicies

public void dropIndicies(BaseTableInfo a_baseTableInfo,
                         String[][] a_indexColumns,
                         boolean a_isUnique,
                         StringBuffer a_buffer)
                  throws WTException
Specified by:
dropIndicies in class SQLGenerator
Throws:
WTException

dropIndex

public void dropIndex(BaseTableInfo a_tableInfo,
                      String[] a_columns,
                      boolean a_isUnique,
                      String a_indexName,
                      StringBuffer a_buffer)
Specified by:
dropIndex in class SQLGenerator

isComputedColumn

public boolean isComputedColumn(String colName,
                                String[] allColumnNames)
Overrides:
isComputedColumn in class SQLGenerator