DungeonCrawl
Loading...
Searching...
No Matches
database.h
Go to the documentation of this file.
1
5#ifndef DATABASE_H
6#define DATABASE_H
7
8#include "../../include/sqlite3.h"
9
10#define DB_OPEN_STATUS_SUCCESS 0
11#define DB_OPEN_STATUS_FAILURE 1
12
13
14#define DB_BUILD_DIR_PATH(database) #database
15#define DB_RESOURCE_PATH(dir, database) "resources/database/" #dir "/" #database
16#define DB_RESOURCE_PATH_UP(dir, database) "../" DB_RESOURCE_PATH(dir, database)
17
18
22typedef struct {
23 sqlite3* db;
24 char* err_msg;
26
27
28typedef enum db_type_t {
29 DB_GAME,
30 DB_LOCAL
31} db_type_t;
32
33
41int db_open(db_connection_t* db_connection, const char* db_name);
42
48void db_close(db_connection_t* db_connection);
49
56int db_is_open(const db_connection_t* db_connection);
64int db_open_multiple_access(db_connection_t* db_connection, db_type_t type);
65
66#endif//DATABASE_H
int db_is_open(const db_connection_t *db_connection)
This function is to check if the database is open.
Definition database.c:27
int db_open(db_connection_t *db_connection, const char *db_name)
This function is for the opening of the database.
Definition database.c:12
int db_open_multiple_access(db_connection_t *db_connection, db_type_t type)
This function is for the opening of the database with multiple access.
Definition database.c:34
void db_close(db_connection_t *db_connection)
This function is for the closing of the database.
Definition database.c:22
This struct is used for the database connection in SQLite.
Definition database.h:22