Copyright 2009,2010, Lapetus Systems Ltd. (All rights reserved)

com.lapetus_ltd.api.db.xml.types
Class TLptsDBCreateStatementColumnSizeType

java.lang.Object
  extended by com.lapetus_ltd._2009.xml.types.XLptsDBCreateStatementColumnSizeType
      extended by com.lapetus_ltd.api.db.xml.types.TLptsDBCreateStatementColumnSizeType

public class TLptsDBCreateStatementColumnSizeType
extends XLptsDBCreateStatementColumnSizeType

Class Description : Initialisation class for the Column size of a CREATE Statement.

This is required for specifying the size of a field, during creation.
Some columns require two size values, therefore this class contains both setSize1 and setSize2 (and get too).

$LastChangedRevision: 1109 $
$LastChangedDate:: 2010-09-11 07:00:06#$


Field Summary
 
Fields inherited from class com.lapetus_ltd._2009.xml.types.XLptsDBCreateStatementColumnSizeType
size1, size2
 
Constructor Summary
TLptsDBCreateStatementColumnSizeType(TLptsDBCreateStatementColumnType col)
           This constructor initiates the Column Size Type.
TLptsDBCreateStatementColumnSizeType(XLptsDBCreateStatementColumnSizeType ccs)
           This constructor copies the Column Sizes from an existing XLptsDBCreateStatementColumnSize1Type.
 
Method Summary
 TLptsDBCreateStatementColumnType getColumn()
          Gets the TLptsDBCreateStatementColumnType related to this column size.
 
Methods inherited from class com.lapetus_ltd._2009.xml.types.XLptsDBCreateStatementColumnSizeType
getSize1, getSize2, setSize1, setSize2
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TLptsDBCreateStatementColumnSizeType

public TLptsDBCreateStatementColumnSizeType(TLptsDBCreateStatementColumnType col)

This constructor initiates the Column Size Type.

Thread Safe : Yes

Spawns its own Thread : No

May Return NULL : Never.

Notes :
Default Constructor initiates the size1 and size2 to empty strings.
It also stores the column information for convenient programming getColumn().

Example :


    //Create the statement and set the Type of Statement to Update.
    TLptsStatement createStatement = new TLptsStatement(connection,XLptsDBTypeOfStatementType.CREATE);
    ...
    //Create the columns
    //--Column idColumn
    TLptsDBCreateStatementColumnType idColumn = new TLptsDBCreateStatementColumnType();
    //Set the column name
    idColumn.setColumn("id");
    ...
    //Some types like varchar have size. Also some types like decimal has two sizes.
   // The first is the number of digits and the second is the number of decimal places.
    TLptsDBCreateStatementColumnSizeType size = new TLptsDBCreateStatementColumnSizeType(idColumn);
    size.setSize1("10");
    size.setSize2("2");
    idColumn.setSizes(size);
    ...
 

Parameters:
col - the column to set as the TLptsDBCreateStatementColumnType of this column size

TLptsDBCreateStatementColumnSizeType

public TLptsDBCreateStatementColumnSizeType(XLptsDBCreateStatementColumnSizeType ccs)

This constructor copies the Column Sizes from an existing XLptsDBCreateStatementColumnSize1Type.

Thread Safe : Yes

Spawns its own Thread : No

May Return NULL : Never.

Notes : Use this function every time you need to copy or instantiate a type XLptsDBCreateStatementColumnSize1Type class.

Example :


 public void example(XLptsDBCreateStatementColumnSize1Type ccs)
 {
   TLptsCreateColumnSize1 columnSize1 = new TLptsCreateColumnSize1(ccs);
 }
 

Parameters:
ccs - the class object to copy.
Method Detail

getColumn

public TLptsDBCreateStatementColumnType getColumn()
Gets the TLptsDBCreateStatementColumnType related to this column size.

Thread Safe : Yes

Spawns its own Thread : No

May Return NULL : Never.

Notes :

Example :

 ...
 //Set the column size by its SQL type
 private void setColumnSizeByType(TLptsDBCreateStatementColumnSizeType value)
 {
  if(value.getColumn().getSqlType().getSqlType()==java.sql.Types.VARCHAR)
     value.setSize1(50);
  else
   if(value.getColumn().getSqlType().getSqlType()==java.sql.Types.DECIMAL)
     value.setSize1(10);
 }
 

Returns:
the TLptsDBCreateStatementColumnType related to this column size.


Copyright 2009,2010, Lapetus Systems Ltd. (All rights reserved)