MySQL 8.0.33
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
29namespace dd {
30class Object_key;
31
32namespace tables {
33
34///////////////////////////////////////////////////////////////////////////
35
36// The Check_constraints table has one row for each check constraint.
37class Check_constraints : virtual public Object_table_impl {
38 public:
39 static const Check_constraints &instance();
40
41 static const CHARSET_INFO *name_collation();
42
51 NUMBER_OF_FIELDS // Always keep this entry at the end of the enum
52 };
53
58 };
59
61
63
65
67 Object_id schema_id, const String_type &check_cons_name);
68
69 /**
70 Check if schema contains check constraints with specified name.
71
72 @param thd Thread context.
73 @param schema_id Id of schema to be inspected.
74 @param check_cons_name Name of the check constraint.
75 @param[out] exists Set to true if check constraint
76 the the name provided exists in
77 the schema, false otherwise.
78
79 @retval false No error.
80 @retval true Error.
81 */
82
83 static bool check_constraint_exists(THD *thd, Object_id schema_id,
84 const String_type &check_cons_name,
85 bool *exists);
86};
87
88///////////////////////////////////////////////////////////////////////////
89
90} // namespace tables
91} // namespace dd
92
93#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:33
Definition: object_key.h:37
Definition: object_table_impl.h:35
Definition: check_constraints.h:37
Check_constraints()
Definition: check_constraints.cc:51
static Object_key * create_key_by_table_id(Object_id table_id)
Definition: check_constraints.cc:86
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:102
static Object_key * create_key_by_check_constraint_name(Object_id schema_id, const String_type &check_cons_name)
Definition: check_constraints.cc:93
enum_foreign_keys
Definition: check_constraints.h:60
@ FK_SCHEMA_ID
Definition: check_constraints.h:60
@ FK_TABLE_ID
Definition: check_constraints.h:60
enum_fields
Definition: check_constraints.h:43
@ FIELD_SCHEMA_ID
Definition: check_constraints.h:45
@ FIELD_NAME
Definition: check_constraints.h:47
@ FIELD_CHECK_CLAUSE
Definition: check_constraints.h:49
@ FIELD_CHECK_CLAUSE_UTF8
Definition: check_constraints.h:50
@ FIELD_TABLE_ID
Definition: check_constraints.h:46
@ FIELD_ID
Definition: check_constraints.h:44
@ NUMBER_OF_FIELDS
Definition: check_constraints.h:51
@ FIELD_ENFORCED
Definition: check_constraints.h:48
static const Check_constraints & instance()
Definition: check_constraints.cc:38
static const CHARSET_INFO * name_collation()
Definition: check_constraints.cc:45
enum_indexes
Definition: check_constraints.h:54
@ INDEX_UK_SCHEMA_ID_NAME
Definition: check_constraints.h:56
@ INDEX_PK_ID
Definition: check_constraints.h:55
@ INDEX_UK_TABLE_ID_NAME
Definition: check_constraints.h:57
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:382
unsigned int uint
Definition: uca9-dump.cc:74