createrepo_c library
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 
34 #define CR_SQLITE_CACHE_DBVERSION 10
36 #define CR_DB_ERROR cr_db_error_quark()
37 GQuark cr_db_error_quark (void);
38 
39 typedef struct _DbPrimaryStatements * cr_DbPrimaryStatements;
40 typedef struct _DbFilelistsStatements * cr_DbFilelistsStatements;
41 typedef struct _DbOtherStatements * cr_DbOtherStatements;
42 
46 typedef enum {
51 
62 #define cr_open_primary_db(PATH, ERR) cr_open_db(PATH, CR_DB_PRIMARY, ERR)
63 
74 #define cr_open_filelists_db(PATH, ERR) cr_open_db(PATH, CR_DB_FILELISTS, ERR)
75 
87 #define cr_open_other_db(PATH, ERR) cr_open_db(PATH, CR_DB_OTHER, ERR)
88 
97 #define cr_close_primary_db(DB, ERR) cr_close_db(DB, CR_DB_PRIMARY, ERR)
98 
107 #define cr_close_filelists_db(DB, ERR) cr_close_db(DB, CR_DB_FILELISTS, ERR)
108 
117 #define cr_close_other_db(DB, ERR) cr_close_db(DB, CR_DB_OTHER, ERR)
118 
131 sqlite3 *cr_open_db(const char *path, cr_DatabaseType db_type, GError **err);
132 
139 cr_DbPrimaryStatements cr_prepare_primary_db_statements(sqlite3 *db,
140  GError **err);
141 
148 cr_DbFilelistsStatements cr_prepare_filelists_db_statements(sqlite3 *db,
149  GError **err);
150 
157 cr_DbOtherStatements cr_prepare_other_db_statements(sqlite3 *db, GError **err);
158 
163 void cr_destroy_primary_db_statements(cr_DbPrimaryStatements stmts);
164 
169 void cr_destroy_filelists_db_statements(cr_DbFilelistsStatements stmts);
170 
175 void cr_destroy_other_db_statements(cr_DbOtherStatements stmts);
176 
182 void cr_add_primary_pkg_db(cr_DbPrimaryStatements stmts, cr_Package *pkg);
183 
189 void cr_add_filelists_pkg_db(cr_DbFilelistsStatements stmts, cr_Package *pkg);
190 
196 void cr_add_other_pkg_db(cr_DbOtherStatements stmts, cr_Package *pkg);
197 
204 void cr_dbinfo_update(sqlite3 *db, const char *checksum, GError **err);
205 
215 void cr_close_db(sqlite3 *db, cr_DatabaseType db_type, GError **err);
216 
217 #ifdef __cplusplus
218 }
219 #endif
220 
221 #endif /* __C_CREATEREPOLIB_SQLITE_H__ */