Return a pointer to the name of the database column from which the specified regular result column was derived.
char *dbcolsource(dbproc, colnum) DBPROCESS *dbproc; int colnum;
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 a null-terminated column name. This pointer will be NULL if the column number is out of range or if the column is the result of a SQL expression, such as max(colname).
dbcolsource 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 Chapter 1, “Introducing DB-Library” for a detailed discussion of browse mode.
dbcolsource provides an application with information it needs to update a database column, based on an ad hoc query. select statements may optionally specify header names for regular (that is, non-compute) result columns:
select author = au_lname from authors for browse
When updating a table, you must use the database column name, not the header name (in this example, “au_lname”, not “author”). You can use the dbcolsource routine to get the underlying database column name:
dbcolsource(dbproc, 1)
This call returns a pointer to the string “au_lname”.
dbcolsource is useful for ad hoc queries. If the query has been hard-coded into the program, this routine obviously is unnecessary.
The application can call dbcolsource anytime after dbresults.
The sample program example7.c contains a call to dbcolsource.
dbcolbrowse, dbqual, dbtabbrowse, dbtabcount, dbtabname, dbtabsource, dbtsnewlen, dbtsnewval, dbtsput