createrepo_c library  0.1.17
C library for metadata manipulation
 Vše Třídy Funkce Proměnné Definice typů Výčty Hodnoty výčtu Skupiny Stránky
SQLite metadata API.

Definice maker

#define CR_DB_CACHE_DBVERSION   10
 
#define CR_DB_ERROR   cr_db_error_quark()
 
#define cr_db_open_primary(PATH, ERR)   cr_db_open(PATH, CR_DB_PRIMARY, ERR)
 
#define cr_db_open_filelists(PATH, ERR)   cr_db_open(PATH, CR_DB_FILELISTS, ERR)
 
#define cr_db_open_other(PATH, ERR)   cr_db_open(PATH, CR_DB_OTHER, ERR)
 
#define cr_db_close_primary(DB, ERR)   cr_db_close(DB, CR_DB_PRIMARY, ERR)
 
#define cr_db_close_filelists(DB, ERR)   cr_db_close(DB, CR_DB_FILELISTS, ERR)
 
#define cr_db_close_other(DB, ERR)   cr_db_close(DB, CR_DB_OTHER, ERR)
 

Definice typů

typedef struct
_DbPrimaryStatements * 
cr_DbPrimaryStatements
 
typedef struct
_DbFilelistsStatements * 
cr_DbFilelistsStatements
 
typedef struct _DbOtherStatements * cr_DbOtherStatements
 

Výčty

enum  cr_DatabaseType { CR_DB_PRIMARY, CR_DB_FILELISTS, CR_DB_OTHER }
 

Funkce

GQuark cr_db_error_quark (void)
 
sqlite3 * cr_db_open (const char *path, cr_DatabaseType db_type, GError **err)
 
cr_DbPrimaryStatements cr_db_prepare_primary_statements (sqlite3 *db, GError **err)
 
cr_DbFilelistsStatements cr_db_prepare_filelists_statements (sqlite3 *db, GError **err)
 
cr_DbOtherStatements cr_db_prepare_other_statements (sqlite3 *db, GError **err)
 
void cr_db_destroy_primary_statements (cr_DbPrimaryStatements stmts)
 
void cr_db_destroy_filelists_statements (cr_DbFilelistsStatements stmts)
 
void cr_db_destroy_other_statements (cr_DbOtherStatements stmts)
 
void cr_db_add_primary_pkg (cr_DbPrimaryStatements stmts, cr_Package *pkg)
 
void cr_db_add_filelists_pkg (cr_DbFilelistsStatements stmts, cr_Package *pkg)
 
void cr_db_add_other_pkg (cr_DbOtherStatements stmts, cr_Package *pkg)
 
void cr_db_dbinfo_update (sqlite3 *db, const char *checksum, GError **err)
 
void cr_db_close (sqlite3 *db, cr_DatabaseType db_type, GError **err)
 

Detailní popis

Module for writing sqlite metadata databases.

Example:

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_close_primary(primary_db, NULL);

Dokumentace k definicím maker

#define CR_DB_CACHE_DBVERSION   10

Version of DB api

Definice je uvedena na řádku 63 v souboru sqlite.h.

#define cr_db_close_filelists (   DB,
  ERR 
)    cr_db_close(DB, CR_DB_FILELISTS, ERR)

Macro over cr_db_close function. Close db.

  • creates indexes on tables
  • commits transaction
  • closes db
    Parametry
    DBopen db connection
    ERR**GError

Definice je uvedena na řádku 130 v souboru sqlite.h.

#define cr_db_close_other (   DB,
  ERR 
)    cr_db_close(DB, CR_DB_OTHER, ERR)

Macro over cr_db_close function. Close db.

  • creates indexes on tables
  • commits transaction
  • closes db
    Parametry
    DBopen db connection
    ERR**GError

Definice je uvedena na řádku 139 v souboru sqlite.h.

#define cr_db_close_primary (   DB,
  ERR 
)    cr_db_close(DB, CR_DB_PRIMARY, ERR)

Macro over cr_db_close function. Close db.

  • creates indexes on tables
  • commits transaction
  • closes db
    Parametry
    DBopen db connection
    ERR**GError

Definice je uvedena na řádku 121 v souboru sqlite.h.

#define cr_db_open_filelists (   PATH,
  ERR 
)    cr_db_open(PATH, CR_DB_FILELISTS, ERR)

Macro over cr_db_open function. Open (create new) filelists sqlite sqlite db.

  • creates db file
  • creates filelists tables
  • creates info table
  • tweak some db params
    Parametry
    PATHPath to the db file.
    ERR**GError
    Návratová hodnota
    open db pointer

Definice je uvedena na řádku 100 v souboru sqlite.h.

#define cr_db_open_other (   PATH,
  ERR 
)    cr_db_open(PATH, CR_DB_OTHER, ERR)

Macro over cr_db_open function. Open (create new) other sqlite sqlite db.

  • creates db file
  • opens transaction
  • creates other tables
  • creates info table
  • tweak some db params
    Parametry
    PATHPath to the db file.
    ERR**GError
    Návratová hodnota
    open db connection

Definice je uvedena na řádku 112 v souboru sqlite.h.

#define cr_db_open_primary (   PATH,
  ERR 
)    cr_db_open(PATH, CR_DB_PRIMARY, ERR)

Macro over cr_db_open function. Open (create new) primary sqlite sqlite db.

  • creates db file
  • creates primary tables
  • creates info table
  • tweak some db params
    Parametry
    PATHPath to the db file.
    ERR**GError
    Návratová hodnota
    open db pointer

Definice je uvedena na řádku 89 v souboru sqlite.h.

Dokumentace výčtových typů

Database type.

Hodnoty výčtu
CR_DB_PRIMARY 

primary

CR_DB_FILELISTS 

filelists

CR_DB_OTHER 

other

Definice je uvedena na řádku 74 v souboru sqlite.h.

Dokumentace funkcí

void cr_db_add_filelists_pkg ( cr_DbFilelistsStatements  stmts,
cr_Package pkg 
)

Add package into the database.

Parametry
stmtsobject with compiled statements
pkgpackage object
void cr_db_add_other_pkg ( cr_DbOtherStatements  stmts,
cr_Package pkg 
)

Add package into the database.

Parametry
stmtsobject with compiled statements
pkgpackage object
void cr_db_add_primary_pkg ( cr_DbPrimaryStatements  stmts,
cr_Package pkg 
)

Add package into the database.

Parametry
stmtsobject with compiled statements
pkgpackage object
void cr_db_close ( sqlite3 *  db,
cr_DatabaseType  db_type,
GError **  err 
)

Close db.

  • creates indexes on tables
  • commits transaction
  • closes db
    Parametry
    dbopen db connection
    db_typeType of database (primary, filelists, other)
    err**GError
void cr_db_dbinfo_update ( sqlite3 *  db,
const char *  checksum,
GError **  err 
)

Insert record into the updateinfo table

Parametry
dbopen db connection
checksumcompressed xml file checksum
err**GError
void cr_db_destroy_filelists_statements ( cr_DbFilelistsStatements  stmts)

Frees cr_DbFilelistsStatements object.

Parametry
stmtsstatements object
void cr_db_destroy_other_statements ( cr_DbOtherStatements  stmts)

Frees cr_DbOtherStatements object.

Parametry
stmtsstatements object
void cr_db_destroy_primary_statements ( cr_DbPrimaryStatements  stmts)

Frees cr_DbPrimaryStatements object.

Parametry
stmtsstatements object
sqlite3* cr_db_open ( const char *  path,
cr_DatabaseType  db_type,
GError **  err 
)

Open (create new) other sqlite sqlite db.

  • creates db file
  • opens transaction
  • creates other tables
  • creates info table
  • tweak some db params
    Parametry
    pathPath to the db file.
    db_typeType of database (primary, filelists, other)
    err**GError
    Návratová hodnota
    open db connection
cr_DbFilelistsStatements cr_db_prepare_filelists_statements ( sqlite3 *  db,
GError **  err 
)

Prepare compiled statements for use in the cr_db_add_filelists_pkg function.

Parametry
dbOpen db connection
err**GError
Návratová hodnota
cr_DbFilelistsStatements object
cr_DbOtherStatements cr_db_prepare_other_statements ( sqlite3 *  db,
GError **  err 
)

Prepare compiled statements for use in the cr_db_add_other_pkg function.

Parametry
dbOpen db connection
err**GError
Návratová hodnota
cr_DbOtherStatements object
cr_DbPrimaryStatements cr_db_prepare_primary_statements ( sqlite3 *  db,
GError **  err 
)

Prepare compiled statements for use in the cr_db_add_primary_pkg function.

Parametry
dbOpen db connection
err**GError
Návratová hodnota
cr_DbPrimaryStatements object