summaryrefslogtreecommitdiffstats
path: root/ts3db.h
blob: da052d9b4456e125662b4f8a7d0aad43f2ed0923 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef TS3DB_H
#define TS3DB_H

typedef enum {
        LOG_CRITICAL = 0,
        LOG_ERROR = 1,
        LOG_WARNING = 2,
        LOG_DEBUG = 3,
        LOG_INFO = 4,
        LOG_DEVELOP = 5
} loglevel;

// common/log/log.cpp:73:
// void Log::logging(const std::string&, LogLevel, const std::string&, uint64)
// Assertion `lvl >= LogLevel_CRITICAL && lvl <= LogLevel_DEVEL' failed.
typedef int(*log_callback) (const char *msg, loglevel level);

typedef void(*field_callback) (unsigned int res_nr, char* fieldname, void *context);
typedef void(*value_callback) (unsigned int index, char *value, void* context);
typedef void(*row_callback) (void* context);

char *ts3dbplugin_version();

char *ts3dbplugin_name();

int ts3dbplugin_disconnect();

void ts3dbplugin_shutdown();

int ts3dbplugin_init(log_callback log, char *parameter);

int ts3dbplugin_connect(unsigned int *connection_nr);

char *ts3dbplugin_getlasterror(unsigned int connection_nr);

unsigned int ts3dbplugin_tableexists(unsigned int connection_nr, const char* table_name);

unsigned long long ts3dbplugin_getmodifiedrowcount(unsigned int connection_nr);

unsigned long long ts3dbplugin_getlastinsertid(unsigned int connection_nr);

unsigned int ts3dbplugin_open(unsigned int connection_nr, const char* query,
                              field_callback new_field, value_callback new_value,
                              row_callback new_row, void *context);

unsigned int ts3dbplugin_exec(unsigned int connection_nr, const char* query);

#endif