summaryrefslogtreecommitdiff
path: root/hippo-sqlite-utils.h (plain)
blob: ac6b26b129660173fa49f4fcde41dfafa964659f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
/* Utility functions for convenient use of sqlite
 * Copyright (C) 2007, 2008 Red Hat Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */
#ifndef __HIPPO_SQLITE_UTILS_H__
#define __HIPPO_SQLITE_UTILS_H__

#include <glib.h>
#include <sqlite3.h>

/* LOCAL CHANGE: Re-namespace to avoid any conflict if the same functions
 *   are present in the application we are LD_PRELOADED in.
 */
#define hippo_sqlite_bind_sql_parameters       _gcdh_hippo_sqlite_bind_sql_parameters
#define hippo_sqlite_get_row_datav             _gcdh_hippo_sqlite_get_row_datav
#define hippo_sqlite_get_row_data              _gcdh_hippo_sqlite_get_row_data
#define hippo_sqlite_prepare_sqlv              _gcdh_hippo_sqlite_prepare_sqlv
#define hippo_sqlite_prepare_sql               _gcdh_hippo_sqlite_prepare_sql
#define hippo_sqlite_execute_sql               _gcdh_hippo_sqlite_execute_sql
#define hippo_sqlite_execute_sql_single_result _gcdh_hippo_sqlite_execute_sql_single_result

G_BEGIN_DECLS

gboolean
hippo_sqlite_bind_sql_parameters(sqlite3        *db,
                                 sqlite3_stmt   *stmt,
                                 va_list        *vap);

gboolean
hippo_sqlite_get_row_datav(sqlite3_stmt *stmt,
                           va_list      *vap);

gboolean
hippo_sqlite_get_row_data(sqlite3_stmt *stmt,
                          ...);

sqlite3_stmt *
hippo_sqlite_prepare_sqlv(sqlite3          *db,
                          const char     *sql,
                          va_list          *vap);

sqlite3_stmt *
hippo_sqlite_prepare_sql(sqlite3         *db,
                         const char     *sql,
                         ...);

gboolean
hippo_sqlite_execute_sql(sqlite3          *db,
                         const char     *sql,
                         ...);

gboolean
hippo_sqlite_execute_sql_single_result(sqlite3         *db,
                                       const char     *sql,
                                       ...);

G_END_DECLS

#endif /* __HIPPO_SQLITE_UTILS_H__ */