tAPIColumn - The Database Update Framework

See Also: Declaring Variables, Struct 

Purpose

tAPIColumn is a structured type used for some members of the cDbUpdateFunctionLibrary class. The struct can be passed as a parameter to the e.g. ApiTableCreate function to make it easier (less code writing) to create a new table.

 

Type Declaration

Struct tAPIColumn

    String sFieldName

    Integer iType

    Integer iLength

    Integer iPrecision

    Integer iOptions

End_Struct


 

Struct Members

sFieldName

The name of the new field/column.

iType

A constant integer representing the database column type. E.g. DF_ASCII_DUF, SQL_CHAR,  SQL_VARCHAR,  SQL_FLOAT et al. These constants are defined in these packages; CLI.pkg, MSSQLDRV.pkg, DB2_DRV.pkg, ODBC_DRV.pkg or Mertech.inc. There are different constant integers to be used for each database back-end. Please see the Mapping of SQL Data Types chapter tables.

iLength

The length for the field.

iPrecision

The number of decimals (if any).

sDFType

The corresponding DataFlex data type. One of; "ASCII", "Numeric", "Date", "Text", "Binary" or "DateTime"

iOptions

C_tAPIColumn_Identity can be passed to indicate that the field/column should be set at the SQL back-end as a primary key. Only applicable for SQL drivers.

Syntax

Use cDbUpdateFunctionLibrary.pkg

:

tColumnType {variableName}

 

Declaring variables

To declare tColumnType variables, use the name of the type (tColumnType) followed by the variable name.

tAPIColumn[] APIColumnArray

See struct variables for more details of instantiating struct types.