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