1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
3 #ifndef MYSQLINTERFACE_H
4 #define MYSQLINTERFACE_H
6 #include "mysql_shim/mysql_shim_export.h"
15 MysqlInterface(const MysqlInterface&) = delete;
16 MysqlInterface& operator=(MysqlInterface&) = delete;
18 virtual void Destroy() = 0;
20 virtual my_ulonglong affected_rows(MYSQL *mysql) const = 0;
21 virtual void close(MYSQL *sock) const = 0;
22 virtual const char *error(MYSQL *mysql) const = 0;
23 virtual MYSQL_FIELD *fetch_field(MYSQL_RES *result) const = 0;
24 virtual unsigned long *fetch_lengths(MYSQL_RES *result) const = 0;
25 virtual MYSQL_ROW fetch_row(MYSQL_RES *result) const = 0;
26 virtual unsigned int field_count(MYSQL *mysql) const = 0;
27 virtual MYSQL_FIELD_OFFSET field_seek(MYSQL_RES *result,
28 MYSQL_FIELD_OFFSET offset) const = 0;
29 virtual void free_result(MYSQL_RES *result) const = 0;
30 virtual MYSQL *init(MYSQL *mysql) const = 0;
31 virtual my_ulonglong insert_id(MYSQL *mysql) const = 0;
32 virtual int next_result(MYSQL *mysql) const = 0;
33 virtual int ping(MYSQL *mysql) const = 0;
34 virtual int query(MYSQL *mysql, const char *q) const = 0;
35 virtual MYSQL *real_connect(MYSQL *mysql, const char *host, const char *user, const char *passwd,
36 const char *db, unsigned int port, const char *unix_socket, unsigned long clientflag) const = 0;
37 virtual unsigned long real_escape_string(MYSQL *mysql, char *to, const char *from, unsigned long length) const = 0;
38 virtual my_bool ssl_set(MYSQL *mysql, const char *key, const char *cert, const char *ca, const char *capath, const char *cipher) const = 0;
39 virtual MYSQL_RES *store_result(MYSQL *mysql) const = 0;
40 virtual unsigned int thread_safe() const = 0;
43 MysqlInterface() = default;
44 ~MysqlInterface() = default;
47 struct MysqlInterfaceDeleter
49 void operator()(MysqlInterface *ifc) const
59 MYSQL_SHIM_EXPORT icinga::MysqlInterface *create_mysql_shim();
62 typedef icinga::MysqlInterface *(*create_mysql_shim_ptr)();
64 #endif /* MYSQLINTERFACE_H */