createrepo_c library 0.20.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
28extern "C" {
29#endif
30
59#define CR_DB_CACHE_DBVERSION 10
63typedef enum {
69
70typedef struct _DbPrimaryStatements * cr_DbPrimaryStatements;
72typedef struct _DbFilelistsStatements * cr_DbFilelistsStatements;
74typedef struct _DbOtherStatements * cr_DbOtherStatements;
79typedef union {
84
87typedef struct {
88 sqlite3 *db;
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
141cr_SqliteDb *cr_db_open(const char *path,
142 cr_DatabaseType db_type,
143 GError **err);
144
152 cr_Package *pkg,
153 GError **err);
154
162 const char *checksum,
163 GError **err);
164
173int cr_db_close(cr_SqliteDb *sqlitedb, GError **err);
174
177#ifdef __cplusplus
178}
179#endif
180
181#endif /* __C_CREATEREPOLIB_SQLITE_H__ */
int cr_db_close(cr_SqliteDb *sqlitedb, 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:72
cr_SqliteDb * cr_db_open(const char *path, cr_DatabaseType db_type, GError **err)
struct _DbPrimaryStatements * cr_DbPrimaryStatements
Definition: sqlite.h:70
struct _DbOtherStatements * cr_DbOtherStatements
Definition: sqlite.h:74
@ CR_DB_FILELISTS
Definition: sqlite.h:65
@ CR_DB_PRIMARY
Definition: sqlite.h:64
@ CR_DB_SENTINEL
Definition: sqlite.h:67
@ CR_DB_OTHER
Definition: sqlite.h:66
cr_DatabaseType type
Definition: sqlite.h:90
cr_Statements statements
Definition: sqlite.h:92
sqlite3 * db
Definition: sqlite.h:88
cr_DbFilelistsStatements fil
Definition: sqlite.h:81
cr_DbPrimaryStatements pri
Definition: sqlite.h:80
cr_DbOtherStatements oth
Definition: sqlite.h:82