SQLite metadata API.

Data Structures

union  cr_Statements
struct  cr_SqliteDb

Defines

#define CR_DB_CACHE_DBVERSION   10
#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)

Typedefs

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

Enumerations

enum  cr_DatabaseType { CR_DB_PRIMARY, CR_DB_FILELISTS, CR_DB_OTHER, CR_DB_SENTINEL }

Functions

cr_SqliteDbcr_db_open (const char *path, cr_DatabaseType db_type, GError **err)
int cr_db_add_pkg (cr_SqliteDb *sqlitedb, cr_Package *pkg, GError **err)
int cr_db_dbinfo_update (cr_SqliteDb *sqlitedb, const char *checksum, GError **err)
int cr_db_close (cr_SqliteDb *sqlitedb, GError **err)

Detailed Description

Module for writing sqlite metadata databases.

Example:

 cr_Package *pkg;
 cr_SqliteDb *primary_db;

 // Load pkg (See parsepkg or parsehdr module)

 // Create primary sqlite database
 primary_db = cr_db_open_primary("/foo/bar/repodata/primary.sqlite", NULL);

 // Add all packages here
 cr_db_add_pkg(primary_db, pkg, NULL);

 // Add checksum of XML version of file (primary in this case)
 cr_db_dbinfo_update(primary_db, "foochecksum", NULL);

 // Cleanup
 cr_db_close(primary_db, NULL);

Define Documentation

#define CR_DB_CACHE_DBVERSION   10

Version of DB api

Definition at line 59 of file 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
    Parameters:
    PATH Path to the db file.
    ERR **GError
    Returns:
    Opened db or NULL on error

Definition at line 116 of file 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
    Parameters:
    PATH Path to the db file.
    ERR **GError
    Returns:
    Opened db or NULL on error

Definition at line 128 of file 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
    Parameters:
    PATH Path to the db file.
    ERR **GError
    Returns:
    Opened db or NULL on error

Definition at line 105 of file sqlite.h.


Typedef Documentation

typedef struct _DbFilelistsStatements* cr_DbFilelistsStatements

Compiled filelists database statements

Definition at line 72 of file sqlite.h.

typedef struct _DbOtherStatements* cr_DbOtherStatements

Compiled other database statements

Definition at line 74 of file sqlite.h.

typedef struct _DbPrimaryStatements* cr_DbPrimaryStatements

Compiled primary database statements

Definition at line 70 of file sqlite.h.


Enumeration Type Documentation

Database type.

Enumerator:
CR_DB_PRIMARY 

primary

CR_DB_FILELISTS 

filelists

CR_DB_OTHER 

other

CR_DB_SENTINEL 

sentinel of the list

Definition at line 63 of file sqlite.h.


Function Documentation

int cr_db_add_pkg ( cr_SqliteDb sqlitedb,
cr_Package pkg,
GError **  err 
)

Add package into the database.

Parameters:
sqlitedb open db connection
pkg package object
err **GError
Returns:
cr_Error code
int cr_db_close ( cr_SqliteDb sqlitedb,
GError **  err 
)

Close db.

  • creates indexes on tables
  • commits transaction
  • closes db
    Parameters:
    sqlitedb open db connection
    err **GError
    Returns:
    cr_Error code
int cr_db_dbinfo_update ( cr_SqliteDb sqlitedb,
const char *  checksum,
GError **  err 
)

Insert record into the updateinfo table

Parameters:
sqlitedb open db connection
checksum compressed xml file checksum
err **GError
Returns:
cr_Error code
cr_SqliteDb* 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
    Parameters:
    path Path to the db file.
    db_type Type of database (primary, filelists, other)
    err **GError
    Returns:
    Opened db or NULL on error

Generated on 22 Oct 2014 for createrepo_c library by  doxygen 1.6.1