MySQL  8.0.21
Source Code Documentation
acl_table_base.h
Go to the documentation of this file.
1 /* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
2 
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6 
7 This program is also distributed with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have included with MySQL.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 #ifndef ACL_TABLE_BASE_INCLUDED
24 #define ACL_TABLE_BASE_INCLUDED
25 
26 #include "my_base.h"
27 #include "my_dbug.h"
28 
29 class THD;
30 struct TABLE;
31 
32 namespace acl_table {
33 
34 typedef int Table_op_error_code;
35 
38 
39 /**
40  Base class to handle ACL table manipulation
41 */
42 
43 class Acl_table {
44  public:
45  /* Constructor & Destructor */
46  Acl_table(THD *thd, TABLE *table, Acl_table_operation operation)
47  : m_thd(thd), m_table(table), m_operation(operation), m_error(0) {
48  DBUG_ASSERT(m_table);
49  }
50  virtual ~Acl_table() {}
51 
52  /* Don't allow copy */
53  Acl_table(const Acl_table &) = delete;
54  const Acl_table &operator=(const Acl_table &) = delete;
55  Acl_table(const Acl_table &&) = delete;
56  const Acl_table &operator=(const Acl_table &&) = delete;
57 
58  /* Finish a reade/write operation on given table */
59  virtual Acl_table_op_status finish_operation(Table_op_error_code &error) = 0;
60  Acl_table_operation get_operation_mode() { return m_operation; }
61 
62  protected:
64  if (!m_error) return Acl_table_op_status::OP_OK;
65 
66  if (m_error == HA_ERR_KEY_NOT_FOUND || m_error == HA_ERR_END_OF_FILE)
68 
70  }
71 
72  /* Thread handle */
74  /* Table handle */
76  /* Mode - INSERT/UPDATE/DELETE/READ */
78  /* Table operation status */
79  Table_op_error_code m_error;
80 };
81 
82 } // namespace acl_table
83 
84 #endif /* ACL_TABLE_BASE_INCLUDED */
Acl_table_op_status
Definition: acl_table_base.h:36
THD * m_thd
Definition: acl_table_base.h:73
Acl_table_operation m_operation
Definition: acl_table_base.h:77
Definition: table.h:1313
This file includes constants used by all storage engines.
#define DBUG_ASSERT(A)
Definition: my_dbug.h:199
Acl_table_operation
Definition: acl_table_base.h:37
TABLE * m_table
Definition: acl_table_base.h:75
Base class to handle ACL table manipulation.
Definition: acl_table_base.h:43
#define HA_ERR_END_OF_FILE
end in next/prev/first/last
Definition: my_base.h:850
Table_op_error_code m_error
Definition: acl_table_base.h:79
Acl_table_op_status convert_table_op_error_code()
Definition: acl_table_base.h:63
Definition: acl_table_base.h:32
Acl_table(THD *thd, TABLE *table, Acl_table_operation operation)
Definition: acl_table_base.h:46
Acl_table_operation get_operation_mode()
Definition: acl_table_base.h:60
virtual ~Acl_table()
Definition: acl_table_base.h:50
int Table_op_error_code
Definition: acl_table_base.h:34
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:799
#define HA_ERR_KEY_NOT_FOUND
Didn't find key on read or update.
Definition: my_base.h:820
Log error(cerr, "ERROR")