QDB Application Example

QDB provides methods for client applications to query a database and step through the query results. The sample program shown here provides a walkthrough of the sequence of QDB method calls necessary to connect to a QDB database, issue a query, read the data in the result set, and disconnect from the database.

Your client application should perform these general steps:
  1. Connect to a database by calling qdb_connect().
  2. Query the database and examine the results:
    1. Execute an SQL statement on the database by calling qdb_statement().
    2. Get the result set for the statement by calling qdb_getresult().
    3. Read a data cell from the result set by calling qdb_cell() and then use the data as needed.
    4. Free the result set by calling qdb_freeresult().
    5. Repeat these steps to execute statements and use their results as many times as required.
  3. Close the database connection with qdb_disconnect().