Getting Result Data

DB Library for C

DB Library for C

Getting Result Data

The simplest way to get result data is to bind result columns to program variables with dbbind and dbaltbind. Then, when a result row is accessed, DB-Library automatically places copies of the columns' data into the program variables to which they are bound.

You also can access a result column's data directly with dbdata and dbadata, which return pointers to the data. These functions are frequently used with dbdatlen and dbadlen, which return the length of the data. The dbdata and dbadata functions have the advantage of providing access to the actual data, not a copy of the data.

Binding of columns to variables must take place after the call to dbresults but before the first call to dbnextrow. No such preliminary step is needed when results will be directly accessed with dbdata or dbadata.