]> git.proxmox.com Git - mirror_frr.git/blob - lib/db.h
Merge pull request #13278 from FRRouting/mergify/bp/stable/8.5/pr-13269
[mirror_frr.git] / lib / db.h
1 /*
2 * Copyright (c) 2018 Rafael Zalamena <rzalamena@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation; either version 2 of the License, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; see the file COPYING; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 /*
20 * Copyright (c) 2016 Rafael Zalamena <rzalamena@gmail.com>
21 *
22 * Permission to use, copy, modify, and/or distribute this software for any
23 * purpose with or without fee is hereby granted, provided that the above
24 * copyright notice and this permission notice appear in all copies.
25 *
26 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
27 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
28 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
29 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
30 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
31 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
32 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
33 */
34
35 #ifndef _FRR_DB_H_
36 #define _FRR_DB_H_
37 #ifdef HAVE_SQLITE3
38
39 #include "compiler.h"
40 #include <sqlite3.h>
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45
46 extern int db_init(const char *path_fmt, ...) PRINTFRR(1, 2);
47 extern int db_close(void);
48 /* WARNING: sqlite format string! not printf compatible! */
49 extern int db_bindf(struct sqlite3_stmt *ss, const char *fmt, ...);
50 extern struct sqlite3_stmt *db_prepare_len(const char *stmt, int stmtlen);
51 extern struct sqlite3_stmt *db_prepare(const char *stmt);
52 extern int db_run(struct sqlite3_stmt *ss);
53 /* WARNING: sqlite format string! not scanf compatible! */
54 extern int db_loadf(struct sqlite3_stmt *ss, const char *fmt, ...);
55 extern void db_finalize(struct sqlite3_stmt **ss);
56 extern int db_execute(const char *stmt_fmt, ...) PRINTFRR(1, 2);
57
58 #ifdef __cplusplus
59 }
60 #endif
61
62 #endif /* HAVE_SQLITE3 */
63 #endif /* _FRR_DB_H_ */