com.partnersoft.sql
Class HsqlDialect

java.lang.Object
  extended by com.partnersoft.sql.GenericSqlDialect
      extended by com.partnersoft.sql.HsqlDialect
All Implemented Interfaces:
Lib, SqlDialect

public class HsqlDialect
extends GenericSqlDialect

SqlDialect for Hypersonic databases.

Copyright 2009 Partner Software, Inc.

Version:
$Id$
Author:
Rich Stepanski

Constructor Summary
HsqlDialect()
          Creates a new HsqlDialect.
 
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.
 
Methods inherited from class com.partnersoft.sql.GenericSqlDialect
constantToSql, handleSorts, listFields, parseFilter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HsqlDialect

public HsqlDialect()
Creates a new HsqlDialect.

Method Detail

selectSql

public java.lang.String selectSql(DataRecordQuery query,
                                  CogStructureType tableType)
Description copied from interface: SqlDialect
Returns complete Sql select statement.

Specified by:
selectSql in interface SqlDialect
Overrides:
selectSql in class GenericSqlDialect
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

public java.lang.String createTable(CogSchema schema,
                                    CogStructureType tableType)
Description copied from interface: SqlDialect
Returns complete Sql create table statement.

Specified by:
createTable in interface SqlDialect
Overrides:
createTable in class GenericSqlDialect
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.

addColumn

public java.lang.String addColumn(java.lang.String tableName,
                                  CogStructureField newField,
                                  CogType newFieldType)
Description copied from interface: SqlDialect
Returns complete Sql to add a column.

Specified by:
addColumn in interface SqlDialect
Overrides:
addColumn in class GenericSqlDialect
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.

alterColumn

public java.lang.String alterColumn(java.lang.String tableName,
                                    CogStructureField newField,
                                    CogType newFieldType)
Description copied from interface: SqlDialect
Returns complete Sql to alter a column.

Specified by:
alterColumn in interface SqlDialect
Overrides:
alterColumn in class GenericSqlDialect
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.

cogTypeToSqlType

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

Specified by:
cogTypeToSqlType in interface SqlDialect
Overrides:
cogTypeToSqlType in class GenericSqlDialect
Parameters:
type - - CogType to convert to Sql type.
Returns:
Sql flavor specific data type for the passed cog type.

dropColumn

public java.lang.String dropColumn(java.lang.String tableName,
                                   java.lang.String fieldName)
Description copied from interface: SqlDialect
Returns complete Sql to drop a column.

Specified by:
dropColumn in interface SqlDialect
Overrides:
dropColumn in class GenericSqlDialect
Parameters:
tableName - - Name of table to drop column from.
fieldName - - Name of field to drop.
Returns:
complete Sql to drop a column.