MySQL 8.3.0
Source Code Documentation
check_constraints.h
Go to the documentation of this file.
1/* Copyright (c) 2019, 2023, Oracle and/or its affiliates.
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 DD_TABLES__CHECK_CONSTRAINTS_INCLUDED
24#define DD_TABLES__CHECK_CONSTRAINTS_INCLUDED
25
26#include "sql/dd/impl/types/object_table_impl.h" // dd::Object_table_impl
27#include "sql/dd/object_id.h" // dd::Object_id
28
29struct CHARSET_INFO;
30
31namespace dd {
32class Object_key;
33
34namespace tables {
35
36///////////////////////////////////////////////////////////////////////////
37
38// The Check_constraints table has one row for each check constraint.
39class Check_constraints : virtual public Object_table_impl {
40 public:
41 static const Check_constraints &instance();
42
43 static const CHARSET_INFO *name_collation();
44
53 NUMBER_OF_FIELDS // Always keep this entry at the end of the enum
54 };
55
57 INDEX_PK_ID = static_cast<uint>(Common_index::PK_ID),
60 };
61
63
65
67
69 Object_id schema_id, const String_type &check_cons_name);
70
71 /**
72 Check if schema contains check constraints with specified name.
73
74 @param thd Thread context.
75 @param schema_id Id of schema to be inspected.
76 @param check_cons_name Name of the check constraint.
77 @param[out] exists Set to true if check constraint
78 the the name provided exists in
79 the schema, false otherwise.
80
81 @retval false No error.
82 @retval true Error.
83 */
84
85 static bool check_constraint_exists(THD *thd, Object_id schema_id,
86 const String_type &check_cons_name,
87 bool *exists);
88};
89
90///////////////////////////////////////////////////////////////////////////
91
92} // namespace tables
93} // namespace dd
94
95#endif // DD_TABLES__CHECK_CONSTRAINTS_INCLUDED
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:35
Definition: object_key.h:37
Definition: object_table_impl.h:35
Definition: check_constraints.h:39
Check_constraints()
Definition: check_constraints.cc:53
static Object_key * create_key_by_table_id(Object_id table_id)
Definition: check_constraints.cc:88
static bool check_constraint_exists(THD *thd, Object_id schema_id, const String_type &check_cons_name, bool *exists)
Check if schema contains check constraints with specified name.
Definition: check_constraints.cc:104
static Object_key * create_key_by_check_constraint_name(Object_id schema_id, const String_type &check_cons_name)
Definition: check_constraints.cc:95
enum_foreign_keys
Definition: check_constraints.h:62
@ FK_SCHEMA_ID
Definition: check_constraints.h:62
@ FK_TABLE_ID
Definition: check_constraints.h:62
enum_fields
Definition: check_constraints.h:45
@ FIELD_SCHEMA_ID
Definition: check_constraints.h:47
@ FIELD_NAME
Definition: check_constraints.h:49
@ FIELD_CHECK_CLAUSE
Definition: check_constraints.h:51
@ FIELD_CHECK_CLAUSE_UTF8
Definition: check_constraints.h:52
@ FIELD_TABLE_ID
Definition: check_constraints.h:48
@ FIELD_ID
Definition: check_constraints.h:46
@ NUMBER_OF_FIELDS
Definition: check_constraints.h:53
@ FIELD_ENFORCED
Definition: check_constraints.h:50
static const Check_constraints & instance()
Definition: check_constraints.cc:40
static const CHARSET_INFO * name_collation()
Definition: check_constraints.cc:47
enum_indexes
Definition: check_constraints.h:56
@ INDEX_UK_SCHEMA_ID_NAME
Definition: check_constraints.h:58
@ INDEX_PK_ID
Definition: check_constraints.h:57
@ INDEX_UK_TABLE_ID_NAME
Definition: check_constraints.h:59
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:42
unsigned long long Object_id
Definition: object_id.h:30
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:50
static int exists(node_address *name, node_list const *nodes, u_int with_uid)
Definition: node_list.cc:105
Definition: m_ctype.h:422