createrepo_c library  0.1.16
C library for metadata manipulation
 Vše Třídy Funkce Proměnné Definice typů Výčty Hodnoty výčtu Skupiny Stránky
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 
63 #define CR_DB_CACHE_DBVERSION 10
65 #define CR_DB_ERROR cr_db_error_quark()
66 GQuark cr_db_error_quark (void);
67 
68 typedef struct _DbPrimaryStatements * cr_DbPrimaryStatements;
69 typedef struct _DbFilelistsStatements * cr_DbFilelistsStatements;
70 typedef struct _DbOtherStatements * cr_DbOtherStatements;
71 
74 typedef enum {
79 
89 #define cr_db_open_primary(PATH, ERR) cr_db_open(PATH, CR_DB_PRIMARY, ERR)
90 
100 #define cr_db_open_filelists(PATH, ERR) cr_db_open(PATH, CR_DB_FILELISTS, ERR)
101 
112 #define cr_db_open_other(PATH, ERR) cr_db_open(PATH, CR_DB_OTHER, ERR)
113 
121 #define cr_db_close_primary(DB, ERR) cr_db_close(DB, CR_DB_PRIMARY, ERR)
122 
130 #define cr_db_close_filelists(DB, ERR) cr_db_close(DB, CR_DB_FILELISTS, ERR)
131 
139 #define cr_db_close_other(DB, ERR) cr_db_close(DB, CR_DB_OTHER, ERR)
140 
152 sqlite3 *cr_db_open(const char *path, cr_DatabaseType db_type, GError **err);
153 
159 cr_DbPrimaryStatements cr_db_prepare_primary_statements(sqlite3 *db,
160  GError **err);
161 
167 cr_DbFilelistsStatements cr_db_prepare_filelists_statements(sqlite3 *db,
168  GError **err);
169 
175 cr_DbOtherStatements cr_db_prepare_other_statements(sqlite3 *db, GError **err);
176 
180 void cr_db_destroy_primary_statements(cr_DbPrimaryStatements stmts);
181 
185 void cr_db_destroy_filelists_statements(cr_DbFilelistsStatements stmts);
186 
190 void cr_db_destroy_other_statements(cr_DbOtherStatements stmts);
191 
196 void cr_db_add_primary_pkg(cr_DbPrimaryStatements stmts, cr_Package *pkg);
197 
202 void cr_db_add_filelists_pkg(cr_DbFilelistsStatements stmts, cr_Package *pkg);
203 
208 void cr_db_add_other_pkg(cr_DbOtherStatements stmts, cr_Package *pkg);
209 
215 void cr_db_dbinfo_update(sqlite3 *db, const char *checksum, GError **err);
216 
225 void cr_db_close(sqlite3 *db, cr_DatabaseType db_type, GError **err);
226 
229 #ifdef __cplusplus
230 }
231 #endif
232 
233 #endif /* __C_CREATEREPOLIB_SQLITE_H__ */