From e19cabaabcefda5e8239ffb983140ea41e532287 Mon Sep 17 00:00:00 2001 From: Tomas Mlcoch Date: Mon, 25 Feb 2013 16:51:02 +0100 Subject: [PATCH] doc: Add example of usage of sqlite module. --- src/sqlite.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/sqlite.h b/src/sqlite.h index 036b755..3fcfd56 100644 --- a/src/sqlite.h +++ b/src/sqlite.h @@ -29,6 +29,33 @@ extern "C" { #endif /** \defgroup sqlite SQLite metadata API. + * + * Module for writing sqlite metadata databases. + * + * Example: + * \code + * cr_Package *pkg; + * sqlite3 *primary_db; + * cr_DbPrimary_Statements primary_statements; + * + * // Load pkg (See parsepkg or parsehdr module) + * + * // Create primary sqlite database + * primary_db = cr_db_open_primary("/foo/bar/repodata/primary.sqlite"); + * // Compile statements (to avoid SQL parsing overhead) + * primary_statements = cr_db_prepare_primary_statements(primary_db, NULL); + * + * // Add all packages here + * cr_db_add_primary_pkg(primary_statements, pkg); + * + * // Add checksum of XML version of file (primary in this case) + * cr_db_dbinfo_update(primary_db, "foochecksum", NULL); + * + * // Cleanup + * cr_db_destroy_primary_statements(primary_db); + * cr_db_close_primary(primary_db, NULL); + * \endcode + * * \addtogroup sqlite * @{ */ -- 2.7.4