Go to the documentation of this file.
21 #ifndef STATS_DB_H
22 #define STATS_DB_H
24 #include <sqlite3.h>
30 #define STATS_DB_STEP_RESET(s) \
31  err = sqlite3_step(s);\
32  if (err && err != SQLITE_DONE) return err;\
33  err = sqlite3_reset(s);\
34  if (err) return err;
40 #define STATS_DB_FINALIZE(s) \
41  err = sqlite3_finalize(s);\
42  if (err) return err;
44 extern bool stats_db_open(void);
45 extern bool stats_db_close(void);
46 extern int stats_db_exec(char *sql_str);
47 extern int stats_db_stmt_prep(sqlite3_stmt **sql_stmt, char *sql_str);
48 extern int stats_db_bind_ints(sqlite3_stmt *sql_stmt, int num_cols,
49  int offset, ...);
50 extern int stats_db_bind_rv(sqlite3_stmt *sql_stmt, int col,
51  random_value rv);
53 #endif /* STATS_DB_H */
bool stats_db_close(void)
Call stats_close_db to close the database connection and free module variables.
Definition: db.c:94
bool stats_db_open(void)
Interface functions
Definition: db.c:59
int stats_db_bind_ints(sqlite3_stmt *sql_stmt, int num_cols, int offset,...)
Utility function for binding many ints at once.
Definition: db.c:138
A struct representing a strategy for making a dice roll.
Definition: z-rand.h:40
int stats_db_bind_rv(sqlite3_stmt *sql_stmt, int col, random_value rv)
Utility function for binding a random_value to a parameter as TEXT.
Definition: db.c:161
int stats_db_stmt_prep(sqlite3_stmt **sql_stmt, char *sql_str)
Prepare a sqlite3 SQL statement for evaluation.
Definition: db.c:124
int stats_db_exec(char *sql_str)
Evaluate a sqlite3 SQL statement on the previously opened database.
Definition: db.c:110