MCPcopy Create free account
hub / github.com/DeNA/HandlerSocket-Plugin-for-MySQL / auto_mysql

Class auto_mysql

client/hstest.cpp:40–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38namespace dena {
39
40struct auto_mysql : private noncopyable {
41 auto_mysql() : db(0) {
42 reset();
43 }
44 ~auto_mysql() {
45 if (db) {
46 mysql_close(db);
47 }
48 }
49 void reset() {
50 if (db) {
51 mysql_close(db);
52 }
53 if ((db = mysql_init(0)) == 0) {
54 fatal_abort("failed to initialize mysql client");
55 }
56 }
57 operator MYSQL *() const { return db; }
58 private:
59 MYSQL *db;
60};
61
62struct auto_mysql_res : private noncopyable {
63 auto_mysql_res(MYSQL *db) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected