Returns a list with the schema of the specified stream, including the definition of each column, which includes the following information:
- Name
- Type
Valid data type values are defined by the dtype_en enumeration in the sqltypes_td.h header file.
- Size (in bytes)
- Character type for textual fields:
- 1 for LATIN
- 2 for UNICODE
Syntax
tdr.GetColDef( streamno, direction )
Syntax Elements
- streamno
- Parameter type: integer
The stream number.
- direction
- Parameter type: characterValid values are as follows:
- "R" (input)
- "W" (output)
Example: Get the Column Definitions of an Input Stream
stream <- 0; direction <- "R"; incols <- tdr.GetColDef(stream, direction); print(incols);
The list incols contains the following for a stream with three attributes (COL1 int, COL2 real, COL3 varchar(30)):
$COL1 $COL1$datatype [1] 9 $COL1$bytesize [1] 4 $COL2 $COL2$datatype [1] 10 $COL2$bytesize [1] 8 $COL3 $COL3$datatype [1] 2 $COL3$charset [1] 1 $COL3$size.length [1] 30
You can get the number of columns in the stream by calling the length function:
length(incols)