]>
Commit | Line | Data |
---|---|---|
47a3a827 | 1 | // SPDX-License-Identifier: ISC AND GPL-2.0-or-later |
1c2facd1 RW |
2 | /* |
3 | * Copyright (c) 2018 Rafael Zalamena <rzalamena@gmail.com> | |
1c2facd1 RW |
4 | */ |
5 | ||
6 | /* | |
7 | * Copyright (c) 2016 Rafael Zalamena <rzalamena@gmail.com> | |
1c2facd1 RW |
8 | */ |
9 | ||
10 | #ifndef _FRR_DB_H_ | |
11 | #define _FRR_DB_H_ | |
12 | #ifdef HAVE_SQLITE3 | |
13 | ||
c695bdbe | 14 | #include "compiler.h" |
1c2facd1 RW |
15 | #include <sqlite3.h> |
16 | ||
5e244469 RW |
17 | #ifdef __cplusplus |
18 | extern "C" { | |
19 | #endif | |
20 | ||
c695bdbe | 21 | extern int db_init(const char *path_fmt, ...) PRINTFRR(1, 2); |
1c2facd1 | 22 | extern int db_close(void); |
c695bdbe | 23 | /* WARNING: sqlite format string! not printf compatible! */ |
1c2facd1 RW |
24 | extern int db_bindf(struct sqlite3_stmt *ss, const char *fmt, ...); |
25 | extern struct sqlite3_stmt *db_prepare_len(const char *stmt, int stmtlen); | |
26 | extern struct sqlite3_stmt *db_prepare(const char *stmt); | |
27 | extern int db_run(struct sqlite3_stmt *ss); | |
c695bdbe | 28 | /* WARNING: sqlite format string! not scanf compatible! */ |
1c2facd1 RW |
29 | extern int db_loadf(struct sqlite3_stmt *ss, const char *fmt, ...); |
30 | extern void db_finalize(struct sqlite3_stmt **ss); | |
c695bdbe | 31 | extern int db_execute(const char *stmt_fmt, ...) PRINTFRR(1, 2); |
1c2facd1 | 32 | |
5e244469 RW |
33 | #ifdef __cplusplus |
34 | } | |
35 | #endif | |
36 | ||
1c2facd1 RW |
37 | #endif /* HAVE_SQLITE3 */ |
38 | #endif /* _FRR_DB_H_ */ |