From: Tomas Mlcoch Date: Mon, 25 Feb 2013 15:51:02 +0000 (+0100) Subject: doc: Add example of usage of sqlite module. X-Git-Tag: upstream/0.2.1~254 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e19cabaabcefda5e8239ffb983140ea41e532287;p=services%2Fcreaterepo_c.git doc: Add example of usage of sqlite module. --- 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 * @{ */