Module for writing sqlite metadata databases.
Example:
int cr_db_close(cr_SqliteDb *sqlitedb, GError **err)
int cr_db_dbinfo_update(cr_SqliteDb *sqlitedb, const char *checksum, GError **err)
int cr_db_add_pkg(cr_SqliteDb *sqlitedb, cr_Package *pkg, GError **err)
#define cr_db_open_primary(PATH, ERR)
◆ CR_DB_CACHE_DBVERSION
#define CR_DB_CACHE_DBVERSION 10 |
Version of DB api
Definition at line 59 of file sqlite.h.
◆ cr_db_open_filelists
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.
◆ cr_db_open_other
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.
◆ cr_db_open_primary
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.
◆ cr_DbFilelistsStatements
Compiled filelists database statements
Definition at line 72 of file sqlite.h.
◆ cr_DbOtherStatements
Compiled other database statements
Definition at line 74 of file sqlite.h.
◆ cr_DbPrimaryStatements
Compiled primary database statements
Definition at line 70 of file sqlite.h.
◆ cr_DatabaseType
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.
◆ cr_db_add_pkg()
Add package into the database.
- Parameters
-
sqlitedb | open db connection |
pkg | package object |
err | **GError |
- Returns
- cr_Error code
◆ cr_db_close()
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
◆ cr_db_dbinfo_update()
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_db_open()
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