putdd() - adds a new field to an existing DD.


int putdd
    DD *dd,
    char *name,
    char *type,
    int n,
    int nonull


DD *dd

The DD to add the field to.
char *name

Name of the field being declared.
char *type

Type of this variable.
int n

Max or number of elements depending on var prefix.
int nonull

Is this a non null field.

Add a field to the data definition structure dd. The field will be called name and have the named type. If the field type is not variable then n specifies the number of elements that can be stored in the field. If it is variable then n specifies a default amount of storage to allocate. This will be increased as needed. Nonnull should be 1 if null values are not allowed. (Note: currently Texis does not allow NULL values at all, and this flag will be silently ignored).

The available types are listed in table here. The columns have the following meanings.

The name to use in putdd.
What this type represents.
The constant used to refer to this type.
How to access the type in Texis through SQL.

Name Description Constant Texis
byte Raw binary data FTN_BYTE BYTE
char Character string FTN_CHAR CHAR
double Double precision floating point FTN_DOUBLE DOUBLE
date Unix date stored as time_t FTN_DATE DATE
float Single precision floating point FTN_FLOAT FLOAT
int 32-bit signed integer FTN_INT --
integer 32-bit signed integer FTN_INTEGER --
long 32-bit signed integer FTN_LONG INTEGER
short 16-bit signed integer FTN_SHORT --
smallint 16-bit signed integer FTN_SMALLINT SMALLINT
word 16-bit unsigned integer FTN_WORD UNSIGNED SMALLINT
ind Pointer to external file FTN_INDIRECT INDIRECT
dword 32-bit unsigned integer FTN_DWORD UNSIGNED INTEGER
int64 64-bit signed integer FTN_INT64 INT64
uint64 64-bit unsigned integer FTN_UINT64 UINT64
counter Unique serial number FTN_COUNTER COUNTER
strlst A list of strings FTN_STRLST STRLST
recid A record ID FTN_RECID --

Table: Data types

All the type names can take an optional prefix of var which indicates that there will be a variable number of items. The ones directly supported by Texis are varchar and varbyte.

The types which almost always will have a var prefix are ind and strlst. If you do not specify var for these types you must make sure there is enough space to hold the longest filename and string list respectively. Both of these have an element size of one.

Returns 0 on error and 1 on success.

opendd(), createdbtbl()

Copyright © Thunderstone Software     Last updated: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.