QDB 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, query, and disconnect from a QDB 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 result:
    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().