org.apache.torque.templates.typemapping
Class SizedForBitDataSqlType

java.lang.Object
  extended by org.apache.torque.templates.typemapping.SqlType
      extended by org.apache.torque.templates.typemapping.SizedForBitDataSqlType

public class SizedForBitDataSqlType
extends SqlType

Supports the Derby / DB2 / SQL92 standard for defining Binary data fields with either CHAR(#) FOR BIT DATA or VARCHAR(#) FOR BIT DATA. This can be used in Platform implementors initialize() methods, by using lines like:

setSchemaDomainMapping(new SizedForBitDataDomain( SchemaType.BINARY, "CHAR", "1")); setSchemaDomainMapping(new SizedForBitDataDomain( SchemaType.VARBINARY, "VARCHAR"));

This will cause the Column.getSqlString() method to produce items similar to:

CHAR(#) FOR BIT DATA VARCHAR(#)FOR BIT DATA

Where: # is the size= schema attribute or a default size specified in the constructor.

Note that this is dependent on the platform implementation correctly defining BINARY and VARBINARY as having a size attribute in the "hasSize()" method.

Author:
Greg Monroe
See Also:
Platform, org.apache.torque.templates.transformer.sql.SQLTransformer#getSqlString()

Constructor Summary
SizedForBitDataSqlType(SqlType sqlType, String size, String scale, String defaultValue)
           
SizedForBitDataSqlType(String sqlType)
           
SizedForBitDataSqlType(String sqlType, String size)
           
 
Method Summary
 SqlType getNew(String size, String scale, String defaultValue)
          Returns a new instance with the given sqlTypeName, size, scale and default value.
 String printSize(String sizeSuffix)
          Returns the size postfix for the base SQL Column type.
 
Methods inherited from class org.apache.torque.templates.typemapping.SqlType
getDefaultValue, getScale, getSize, getSqlTypeName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SizedForBitDataSqlType

public SizedForBitDataSqlType(String sqlType)
See Also:
SqlType.SqlType(String)

SizedForBitDataSqlType

public SizedForBitDataSqlType(String sqlType,
                              String size)
See Also:
SqlType.SqlType(String, String)

SizedForBitDataSqlType

public SizedForBitDataSqlType(SqlType sqlType,
                              String size,
                              String scale,
                              String defaultValue)
See Also:
SqlType#SqlType(String, String, string, String)
Method Detail

printSize

public String printSize(String sizeSuffix)
Returns the size postfix for the base SQL Column type.

Overrides:
printSize in class SqlType
Returns:
"(size) FOR BIT DATA" or just " FOR BIT DATA" if size is null.
See Also:
SqlType.database.model.Domain

getNew

public SqlType getNew(String size,
                      String scale,
                      String defaultValue)
Returns a new instance with the given sqlTypeName, size, scale and default value.

Overrides:
getNew in class SqlType
Returns:
a new instance with the given parameters.


Copyright © 2000-2013 The Apache Software Foundation. All Rights Reserved.