Return the name and number of the table from which a particular result column was derived.
char *dbtabsource(dbproc, colnum, tabnum) DBPROCESS *dbproc; int colnum; int *tabnum;
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 the result column of interest. Column numbers start at 1.
A pointer to an integer, which will be filled in with the table’s number. Many DB-Library routines that deal with browse mode accept either a table name or a table number. If dbtabsource returns NULL (see the “Returns” section below), *tabnum will be set to -1.
A pointer to the name of the table from which this result column was derived. A NULL return value can mean a few different things:
The DBPROCESS is dead or not enabled. This is an error that will cause an application’s error handler to be invoked.
The column number is out of range.
The column is the result of an expression, such as max(colname).
dbtabsource 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.
dbtabsource allows an application to determine which tables provided the columns in the current set of result rows. This information is valuable when using dbqual to construct where clauses for update and delete statements based on ad hoc queries. If the query has been hard-coded into the program, this routine obviously is unnecessary.
The application can call dbtabsource anytime after dbresults.
The sample program example7.c contains a call to dbtabsource.
dbcolbrowse, dbcolsource, dbqual, dbtabbrowse, dbtabcount, dbtabname, dbtsnewlen, dbtsnewval