session_event.h 1.2 KB
Newer Older
羽飞's avatar
羽飞 已提交
1
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
羽飞's avatar
羽飞 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
         http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details. */

//
// Created by Longda on 2021/4/13.
//

羽飞's avatar
羽飞 已提交
15
#pragma once
羽飞's avatar
羽飞 已提交
16 17 18 19 20

#include <string.h>
#include <string>

#include "common/seda/stage_event.h"
羽飞's avatar
羽飞 已提交
21
#include "sql/executor/sql_result.h"
羽飞's avatar
羽飞 已提交
22

W
wangyunlai.wyl 已提交
23
class Session;
羽飞's avatar
羽飞 已提交
24
class Communicator;
W
wangyunlai.wyl 已提交
25

羽飞's avatar
羽飞 已提交
26 27
class SessionEvent : public common::StageEvent 
{
羽飞's avatar
羽飞 已提交
28
public:
羽飞's avatar
羽飞 已提交
29
  SessionEvent(Communicator *client);
羽飞's avatar
羽飞 已提交
30 31
  virtual ~SessionEvent();

羽飞's avatar
羽飞 已提交
32
  Communicator *get_communicator() const;
W
wangyunlai.wyl 已提交
33
  Session *session() const;
羽飞's avatar
羽飞 已提交
34

L
Longda Feng 已提交
35 36 37 38
  void set_query(const std::string &query)
  {
    query_ = query;
  }
羽飞's avatar
羽飞 已提交
39

L
Longda Feng 已提交
40 41 42 43
  const std::string &query() const
  {
    return query_;
  }
羽飞's avatar
羽飞 已提交
44
  SqlResult *sql_result()
L
Longda Feng 已提交
45
  {
羽飞's avatar
羽飞 已提交
46
    return &sql_result_;
L
Longda Feng 已提交
47
  }
羽飞's avatar
羽飞 已提交
48

羽飞's avatar
羽飞 已提交
49
private:
羽飞's avatar
羽飞 已提交
50
  Communicator *communicator_ = nullptr;
羽飞's avatar
羽飞 已提交
51
  SqlResult     sql_result_;
羽飞's avatar
羽飞 已提交
52

羽飞's avatar
羽飞 已提交
53
  std::string   query_;
羽飞's avatar
羽飞 已提交
54
};