1 #ifndef _MYSQL_WRAPPER_H_
2 #define _MYSQL_WRAPPER_H_
5 #include <mysql/mysql.h>
7 #include "abstract_db.h"
10 class mysql_wrapper : public abstract_db {
11 friend class mysql_ordered_index;
13 mysql_wrapper(const std::string &dir, const std::string &db);
16 virtual void thread_init(bool loader);
17 virtual void thread_end();
19 virtual void *new_txn(
24 virtual bool commit_txn(void *txn);
25 virtual void abort_txn(void *txn);
27 virtual abstract_ordered_index *
28 open_index(const std::string &name,
29 size_t value_size_hint,
33 close_index(abstract_ordered_index *idx);
37 MYSQL *new_connection(const std::string &db);
38 static __thread MYSQL *tl_conn;
41 class mysql_ordered_index : public abstract_ordered_index {
43 mysql_ordered_index(const std::string &name) : name(name) {}
47 const std::string &key,
49 size_t max_bytes_read);
51 virtual const char * put(
53 const std::string &key,
54 const std::string &value);
56 virtual const char * insert(
58 const std::string &key,
59 const std::string &value);
63 const std::string &key,
64 const std::string *value,
65 scan_callback &callback,
68 NDB_UNIMPLEMENTED("scan");
73 const std::string &start_key,
74 const std::string *end_key,
75 scan_callback &callback,
78 NDB_UNIMPLEMENTED("rscan");
84 NDB_UNIMPLEMENTED("size");
87 virtual std::map<std::string, uint64_t>
90 NDB_UNIMPLEMENTED("clear");
97 #endif /* _MYSQL_WRAPPER_H_ */