-
Notifications
You must be signed in to change notification settings - Fork 40
/
worker.hpp
67 lines (57 loc) · 1.48 KB
/
worker.hpp
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//
// M A R I A D B + +
//
// Copyright Sylvain Rochette Langlois 2013,
// Frantisek Boranek 2015,
// The ViaDuck Project 2016 - 2018.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef _MARIADB_WORKER_HPP_
#define _MARIADB_WORKER_HPP_
#include <mariadb++/connection.hpp>
#include <mariadb++/concurrency.hpp>
namespace mariadb {
using namespace concurrency;
namespace command {
enum type { execute, insert, query };
}
//
// Worker entity used by concurrency namespace
//
class worker {
public:
//
// Constructor
//
worker();
worker(account_ref &account, handle hnd, bool keep_handle, command::type command, const std::string &query);
worker(account_ref &account, handle hnd, bool keep_handle, command::type command, statement_ref &statement);
//
// Get informations
//
status::type status() const;
handle get_handle() const;
bool keep_handle() const;
//
// Get result / result_set
//
u64 result() const;
result_set_ref result_set() const;
//
// Do the actual job
//
void execute();
private:
bool m_keep_handle;
handle m_handle;
status::type m_status;
command::type m_command;
u64 m_result;
std::string m_query;
account_ref m_account;
result_set_ref m_result_set;
statement_ref m_statement;
};
} // namespace mariadb
#endif