createrepo_c library  1.1.4
C library for metadata manipulation
sqlite.h
1 /* createrepo_c - Library of routines for manipulation with repodata
2  * Copyright (C) 2012 Tomas Mlcoch
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
17  * USA.
18  */
19 
20 #ifndef __C_CREATEREPOLIB_SQLITE_H__
21 #define __C_CREATEREPOLIB_SQLITE_H__
22 
23 #include <glib.h>
24 #include <sqlite3.h>
25 #include "package.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
59 #define CR_DB_CACHE_DBVERSION 10
63 typedef enum {
70 
71 typedef struct _DbPrimaryStatements * cr_DbPrimaryStatements;
73 typedef struct _DbFilelistsStatements * cr_DbFilelistsStatements;
75 typedef struct _DbOtherStatements * cr_DbOtherStatements;
80 typedef union {
85 
88 typedef struct {
89  sqlite3 *db;
95 } cr_SqliteDb;
96 
106 #define cr_db_open_primary(PATH, ERR) cr_db_open(PATH, CR_DB_PRIMARY, ERR)
107 
117 #define cr_db_open_filelists(PATH, ERR) cr_db_open(PATH, CR_DB_FILELISTS, ERR)
118 
129 #define cr_db_open_other(PATH, ERR) cr_db_open(PATH, CR_DB_OTHER, ERR)
130 
142 cr_SqliteDb *cr_db_open(const char *path,
143  cr_DatabaseType db_type,
144  GError **err);
145 
153  cr_Package *pkg,
154  GError **err);
155 
163  const char *checksum,
164  GError **err);
165 
174 int cr_db_close(cr_SqliteDb *sqlitedb, GError **err);
175 
178 #ifdef __cplusplus
179 }
180 #endif
181 
182 #endif /* __C_CREATEREPOLIB_SQLITE_H__ */
int cr_db_close(cr_SqliteDb *sqlitedb, GError **err)
cr_SqliteDb * cr_db_open(const char *path, cr_DatabaseType db_type, GError **err)
int cr_db_dbinfo_update(cr_SqliteDb *sqlitedb, const char *checksum, GError **err)
cr_DatabaseType
Definition: sqlite.h:63
int cr_db_add_pkg(cr_SqliteDb *sqlitedb, cr_Package *pkg, GError **err)
struct _DbFilelistsStatements * cr_DbFilelistsStatements
Definition: sqlite.h:73
struct _DbPrimaryStatements * cr_DbPrimaryStatements
Definition: sqlite.h:71
struct _DbOtherStatements * cr_DbOtherStatements
Definition: sqlite.h:75
@ CR_DB_FILELISTS
Definition: sqlite.h:65
@ CR_DB_PRIMARY
Definition: sqlite.h:64
@ CR_DB_SENTINEL
Definition: sqlite.h:68
@ CR_DB_FILELISTS_EXT
Definition: sqlite.h:66
@ CR_DB_OTHER
Definition: sqlite.h:67
cr_DatabaseType type
Definition: sqlite.h:91
cr_Statements statements
Definition: sqlite.h:93
sqlite3 * db
Definition: sqlite.h:89
cr_DbFilelistsStatements fil
Definition: sqlite.h:82
cr_DbPrimaryStatements pri
Definition: sqlite.h:81
cr_DbOtherStatements oth
Definition: sqlite.h:83