QDB Examples

QDB provides methods that client applications can call to query a database and step through the query results. The detailed 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 QDB client application should perform these general steps:

  1. Connect to a database by calling qdb_connect()
  2. Query the database:
    1. Execute a statement on the database by calling qdb_statement().
    2. Get the results of the statement (if any) by calling qdb_getresult().
    3. Use the results by calling qdb_cell().
    4. Free the result by calling qdb_freeresult().
    5. Repeat the preceding steps to execute statements and use the results, as required.
  3. Close the database connection with qdb_disconnect()