SQLTMPL() Function - Get SQL Result Template
Syntax
SQLTMPL(sqlchan{,IND=1}{,ERR=lineref})
Description
For BBj-specific information, see the SQLTMPL()
Function - BBj.
The SQLTMPL() function returns the template used to access the data returned
in an SQLFETCH() operation. The template returned is dependent on the
SQL command given by the SQLPREP verb. Therefore, the template returned
may vary if different tables are accessed with the SQLPREP verb.
The optional IND=1 parameter returns the number of rows that have been
modified with the SQL DELETE or UPDATE command and should not be used
with queries.
Examples
0010 LET DB$=SQLLIST(1)
0020 PRINT "Defined Databases in the SQL.INI
0020:file:",$0D0A$,DB$
0030 LET FIRST_DB$=DB$(1,POS($0A$=DB$)-1)
0040 PRINT "Database to query:",$0D0A$,FIRST_DB$,$0D0A$
0050 SQLOPEN (1)FIRST_DB$
0060 LET TABLES$=SQLTABLES(1)
0070 PRINT "Defined Tables in ",FIRST_DB$,":",
0070:$0D0A$,TABLES$
0080 LET FIRST_TABLE$=TABLES$(1,POS($0A$=TABLES$)-1)
0090 PRINT "Table to select on:",$0D0A$,
0090:FIRST_TABLE$,$0D0A$
0100 SQLPREP (1)"select * from "+FIRST_TABLE$
0110 DIM TEMPLATE$:SQLTMPL(1)
0120 PRINT "Template fetched:",$0D0A$,FATTR(TEMPLATE$)
run
Defined Databases in the SQL.INI file:
Chile Company
Class Reunion
Call Log System
Database to query:
Chile Company
Defined Tables in Chile Company:
CATEGORY
CUSTOMER
INVOICE
ITEM
ORDER_HEADER
ORDER_LINE
QUANTITY
SALESREP
WAREHOUSE
Table to select on:
CATEGORY
Template fetched:
PROD_CAT:C(2),DESC:C(30),COST_METHOD:C(5),COST_ACCOUNT:C(8),
SALE_ACCOUNT:C(8),INV_ACCOUNT:C(8)