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_SqliteDb * | cr_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:
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
Compiled filelists database statements
Definition at line 72 of file sqlite.h.
Compiled other database statements
Definition at line 74 of file sqlite.h.
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
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
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