Return the number of tables involved in the current select query.
int dbtabcount(dbproc) DBPROCESS *dbproc;
A pointer to the DBPROCESS structure that provides the connection for a particular front-end/server process. It contains all the information that DB-Library uses to manage communications and data between the front end and server.
The number of tables, including server work tables, involved in the current set of row results.
dbtabcount will return -1 in case of error.
dbtabcount is one of the DB-Library browse-mode routines. It is usable only with results from a browse-mode select (that is, a select containing the key words for browse). See “Browse mode” for a detailed discussion of browse mode.
A select query can generate a set of result rows whose columns are derived from several database tables. To perform browse-mode updates of columns in a query’s select list, the application must know how many tables were involved in the query, because each table requires a separate update statement. dbtabcount can provide this information for ad hoc queries. If the query has been hard-coded into the program, this routine is obviously unnecessary.
The count returned by this routine includes any server “work tables” used in processing the query. The server sometimes creates temporary, internal work tables to process a query. It deletes these work tables by the time it finishes processing the statement. Work tables are not updatable and are not available to the application. Therefore, before using a table number, the application must make sure that it does not belong to a work table. dbtabname can be used to determine whether a particular table number refers to a work table.
The application can call dbtabcount anytime after dbresults.
The sample program example7.c contains a call to dbtabcount.
dbcolbrowse, dbcolsource, dbqual, dbtabbrowse, dbtabname, dbtabsource, dbtsnewlen, dbtsnewval, dbtsput