MySQL 8.3.0
Source Code Documentation
mock_session.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2019, 2023, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is also distributed with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have included with MySQL.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23*/
24
25#ifndef MYSQLD_MOCK_MOCK_SESSION_INCLUDED
26#define MYSQLD_MOCK_MOCK_SESSION_INCLUDED
27
30#include "statement_reader.h"
31
32namespace server_mock {
33
35 public:
37 std::unique_ptr<StatementReaderBase> statement_processor,
38 const bool debug_mode)
39 : json_reader_{std::move(statement_processor)}, debug_mode_{debug_mode} {}
40
41 virtual ~MySQLServerMockSession() = default;
42
43 virtual void run() = 0;
44
45 virtual void cancel() = 0;
46
47 bool debug_mode() const { return debug_mode_; }
48
49 void disconnector(std::function<void()> func) {
50 disconnector_ = std::move(func);
51 }
52
53 void disconnect() {
55 }
56
57 protected:
58 std::unique_ptr<StatementReaderBase> json_reader_;
59
60 private:
62
63 std::function<void()> disconnector_;
64};
65
66} // namespace server_mock
67
68#endif // MYSQLD_MOCK_MOCK_SESSION_INCLUDED
Definition: mock_session.h:34
void disconnect()
Definition: mock_session.h:53
void disconnector(std::function< void()> func)
Definition: mock_session.h:49
virtual ~MySQLServerMockSession()=default
bool debug_mode() const
Definition: mock_session.h:47
std::function< void()> disconnector_
Definition: mock_session.h:63
MySQLServerMockSession(std::unique_ptr< StatementReaderBase > statement_processor, const bool debug_mode)
Definition: mock_session.h:36
std::unique_ptr< StatementReaderBase > json_reader_
Definition: mock_session.h:58
bool debug_mode_
Definition: mock_session.h:61
Definition: mock_server_component.h:35
Definition: varlen_sort.h:174