mirror of
https://github.com/kvorschk/Magisk.git
synced 2026-12-04 19:10:47 -05:00
Use argument binding for query
This commit is contained in:
@@ -17,27 +17,24 @@ extern int (*sqlite3_open_v2)(const char *filename, sqlite3 **ppDb, int flags, c
|
||||
extern int (*sqlite3_close)(sqlite3 *db);
|
||||
extern const char *(*sqlite3_errstr)(int);
|
||||
|
||||
// Transparent wrapper of sqlite3_stmt
|
||||
// Transparent wrappers of sqlite3_stmt
|
||||
struct DbValues {
|
||||
const char *get_text(int index);
|
||||
int get_int(int index);
|
||||
~DbValues() = delete;
|
||||
};
|
||||
|
||||
struct DbStatement {
|
||||
int bind_text(int index, const char *val);
|
||||
int bind_text(int index, rust::Str val);
|
||||
int bind_int64(int index, int64_t val);
|
||||
~DbStatement() = delete;
|
||||
};
|
||||
|
||||
using StringSlice = rust::Slice<rust::String>;
|
||||
using sql_bind_callback = void(*)(void*, int, DbStatement&);
|
||||
using sql_bind_callback = int(*)(void*, int, DbStatement&);
|
||||
using sql_exec_callback = void(*)(void*, StringSlice, DbValues&);
|
||||
|
||||
#define fn_run_ret(fn, ...) if (int rc = fn(__VA_ARGS__); rc != SQLITE_OK) return rc
|
||||
|
||||
bool load_sqlite();
|
||||
sqlite3 *open_and_init_db();
|
||||
int sql_exec(sqlite3 *db, rust::Str zSql,
|
||||
sql_bind_callback bind_cb, void *bind_cookie,
|
||||
sql_exec_callback exec_cb, void *exec_cookie);
|
||||
sql_bind_callback bind_cb = nullptr, void *bind_cookie = nullptr,
|
||||
sql_exec_callback exec_cb = nullptr, void *exec_cookie = nullptr);
|
||||
|
||||
Reference in New Issue
Block a user