createrepo_c library  0.9.1
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 {
69 
70 typedef struct _DbPrimaryStatements * cr_DbPrimaryStatements;
72 typedef struct _DbFilelistsStatements * cr_DbFilelistsStatements;
74 typedef struct _DbOtherStatements * cr_DbOtherStatements;
79 typedef union {
84 
87 typedef struct {
88  sqlite3 *db;
94 } cr_SqliteDb;
95 
105 #define cr_db_open_primary(PATH, ERR) cr_db_open(PATH, CR_DB_PRIMARY, ERR)
106 
116 #define cr_db_open_filelists(PATH, ERR) cr_db_open(PATH, CR_DB_FILELISTS, ERR)
117 
128 #define cr_db_open_other(PATH, ERR) cr_db_open(PATH, CR_DB_OTHER, ERR)
129 
141 cr_SqliteDb *cr_db_open(const char *path,
142  cr_DatabaseType db_type,
143  GError **err);
144 
151 int cr_db_add_pkg(cr_SqliteDb *sqlitedb,
152  cr_Package *pkg,
153  GError **err);
154 
161 int cr_db_dbinfo_update(cr_SqliteDb *sqlitedb,
162  const char *checksum,
163  GError **err);
164 
173 int cr_db_close(cr_SqliteDb *sqlitedb, GError **err);
174 
177 #ifdef __cplusplus
178 }
179 #endif
180 
181 #endif /* __C_CREATEREPOLIB_SQLITE_H__ */
cr_DbFilelistsStatements fil
Definition: sqlite.h:81
cr_DbOtherStatements oth
Definition: sqlite.h:82
cr_DbPrimaryStatements pri
Definition: sqlite.h:80
struct _DbFilelistsStatements * cr_DbFilelistsStatements
Definition: sqlite.h:72
cr_Statements statements
Definition: sqlite.h:92
struct _DbPrimaryStatements * cr_DbPrimaryStatements
Definition: sqlite.h:70
cr_DatabaseType
Definition: sqlite.h:63
int cr_db_add_pkg(cr_SqliteDb *sqlitedb, cr_Package *pkg, GError **err)
struct _DbOtherStatements * cr_DbOtherStatements
Definition: sqlite.h:74
int cr_db_close(cr_SqliteDb *sqlitedb, GError **err)
int cr_db_dbinfo_update(cr_SqliteDb *sqlitedb, const char *checksum, GError **err)
cr_SqliteDb * cr_db_open(const char *path, cr_DatabaseType db_type, GError **err)
sqlite3 * db
Definition: sqlite.h:88
cr_DatabaseType type
Definition: sqlite.h:90