dbcolumns()
Description: returns the list
of column information related to f
Syntax: dbcolumns(f)
Parameters:
-
f: ODBC file previously opened
with open()
The return type is a list of records with
the following fields:
-
"catalog": catalog name
-
"schema": schema name
-
"tablename": table name
-
"colname": column name
-
"datatype": SQL data type
-
"typename": data source-dependent
data type name
-
"colsize": if datatype is SQL_CHAR
or SQL_VARCHAR this columns contains the maximum length in characters of
the column
-
"buflen": length in bytes of data
transferred on a fetch operation
-
"decdigits": the total number of
significant digits to the right of the decimal point
-
"numprecradix": for numeric data
types either 10 or 2. If it is 10, the vaules in "columnsize" and "decimaldigits"
give the number of decimal digits allowed for the column. If it is 2, the
values in columnsize and decimal digits give the number of bits allowed
in the column
-
"nullable": 0 if the column could
not include NULL values; 1 if the columns accept NULL values; 2 if it is
not known whether the column accepts NULL values.
-
"remarks": a description of the
column
Code Example
procedure main()
f:=open("mysql","O","test","federico","") # open table
colinfo:=dbcolumns(f) # get columns information
write("column info\n")
every i:=(1 to *colinfo) do { # for each column
writes("col #",i,": ")
# write column's information
every j:=(1 to *colinfo[i]) do
writes("[",colinfo[i][j],"]")
write()
}
write()
close(f) # close table and connection to the database
end