com.partnersoft.sql
Interface SqlDialect

All Superinterfaces:
Lib
All Known Implementing Classes:
DerbyDialect, GenericSqlDialect, HsqlDialect, MySqlDialect

public interface SqlDialect
extends Lib

Interface for creating Sql flavor specific statements.

Copyright 2009 Partner Software, Inc.

Version:
$Id$
Author:
Rich Stepanski

Method Summary
 java.lang.String addColumn(java.lang.String tableName, CogStructureField newField, CogType newFieldType)
          Returns complete Sql to add a column.
 java.lang.String alterColumn(java.lang.String tableName, CogStructureField newField, CogType newFieldType)
          Returns complete Sql to alter a column.
 java.lang.String cogTypeToSqlType(CogType type)
          Helper for converting from a CogType to a Sql flavor specific data type.
 java.lang.String createTable(CogSchema schema, CogStructureType tableType)
          Returns complete Sql create table statement.
 java.lang.String dropColumn(java.lang.String tableName, java.lang.String fieldName)
          Returns complete Sql to drop a column.
 java.lang.String selectSql(DataRecordQuery query, CogStructureType tableType)
          Returns complete Sql select statement.
 

Method Detail

selectSql

java.lang.String selectSql(DataRecordQuery query,
                           CogStructureType tableType)
Returns complete Sql select statement.

Parameters:
query - - Query describing select statement.
tableType - - CogStructureType defining table. Type name is assumed to be table name.
Returns:
Sql select statement for passed query.

createTable

java.lang.String createTable(CogSchema schema,
                             CogStructureType tableType)
Returns complete Sql create table statement.

Parameters:
schema - - Schema defining column types.
tableType - - CogStructureType defining table. Type name is assumed to be table name.
Returns:
Sql create table statement for passed schema and cog type.

alterColumn

java.lang.String alterColumn(java.lang.String tableName,
                             CogStructureField newField,
                             CogType newFieldType)
Returns complete Sql to alter a column.

Parameters:
tableName - - Name of table to alter column in.
newField - - Field to change.
newFieldType - - CogType for the passed field.
Returns:
Sql to alter a column.

addColumn

java.lang.String addColumn(java.lang.String tableName,
                           CogStructureField newField,
                           CogType newFieldType)
Returns complete Sql to add a column.

Parameters:
tableName - - Name of table to add a column to.
newField - - Field to add.
newFieldType - - CogType of field to add.
Returns:
Sql to add a column.

dropColumn

java.lang.String dropColumn(java.lang.String tableName,
                            java.lang.String fieldName)
Returns complete Sql to drop a column.

Parameters:
tableName - - Name of table to drop column from.
fieldName - - Name of field to drop.
Returns:
complete Sql to drop a column.

cogTypeToSqlType

java.lang.String cogTypeToSqlType(CogType type)
Helper for converting from a CogType to a Sql flavor specific data type. Default returns the CogPrimitiveType's sqlType, or VARCHAR(255)

Parameters:
type - - CogType to convert to Sql type.
Returns:
Sql flavor specific data type for the passed cog type.