CUBRID Engine  latest
execute_schema.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Search Solution Corporation
3  * Copyright 2016 CUBRID Corporation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 
20 /*
21  * execute_schema.h - This file contains do_class and do_partition extern prototypes.
22  */
23 
24 #ifndef _EXECUTE_SCHEMA_H_
25 #define _EXECUTE_SCHEMA_H_
26 
27 #ident "$Id$"
28 
29 #if defined (SERVER_MODE)
30 #error Does not belong to server module
31 #endif /* SERVER_MODE */
32 
33 #include "dbi.h"
34 #include "schema_manager.h"
35 
36 #define UNIQUE_PARTITION_SAVEPOINT_GRANT "pARTITIONgRANT"
37 #define UNIQUE_PARTITION_SAVEPOINT_REVOKE "pARTITIONrEVOKE"
38 #define UNIQUE_PARTITION_SAVEPOINT_RENAME "pARTITIONrENAME"
39 #define UNIQUE_PARTITION_SAVEPOINT_DROP "pARTITIONdROP"
40 #define UNIQUE_PARTITION_SAVEPOINT_OWNER "pARTITIONoWNER"
41 #define UNIQUE_PARTITION_SAVEPOINT_INDEX "pARTITIONiNDEX"
42 #define UNIQUE_PARTITION_SAVEPOINT_ALTER "pARTITIONaLTER"
43 #define PARTITION_CATALOG_CLASS "_db_partition"
44 #define PARTITION_VARCHAR_LEN (DB_MAX_IDENTIFIER_LENGTH)
45 #define CLASS_ATT_NAME "class_name"
46 #define CLASS_IS_PARTITION "partition_of"
47 
48 #define CHECK_PARTITION_NONE 0x0000
49 #define CHECK_PARTITION_PARENT 0x0001
50 #define CHECK_PARTITION_SUBS 0x0010
51 
54 /* Class info structure used in update execution on client */
56 {
57  PT_NODE *spec; /* PT_SPEC node of the class */
58  DB_VALUE *oid; /* OID value of the current(last) tuple that is updated */
59  PT_NODE *check_where; /* check option expression or NULL */
60  SM_CLASS *smclass; /* primary class structure */
61  DB_OBJECT *class_mop; /* object associated with this class */
62  int pruning_type; /* pruning type */
63  CLIENT_UPDATE_INFO *first_assign; /* first assignment of this class */
64 };
65 
66 /* Assignment info used in update execution on client */
68 {
69  PT_NODE *upd_col_name; /* PT_NAME of attribute to be updated */
70  DB_VALUE *db_val; /* value to be assigned */
71  bool is_const; /* true if value to be assigned is constant (at compilation) */
72  DB_ATTDESC *attr_desc; /* description of attribute to be updated */
73  CLIENT_UPDATE_CLASS_INFO *cls_info; /* attribute owner class info */
74  CLIENT_UPDATE_INFO *next; /* next assignment from the same class */
75 };
76 
77 extern int do_drop_partitioned_class (MOP class_, int drop_sub_flag, bool is_cascade_constraints);
78 extern int do_is_partitioned_subclass (int *is_partitioned, const char *classname, char *keyattr);
79 extern int do_get_partition_parent (DB_OBJECT * const classop, MOP * const parentop);
80 extern int do_rename_partition (MOP old_class, const char *newname);
81 extern int do_check_partitioned_class (DB_OBJECT * classop, int check_map, char *keyattr);
82 extern int do_get_partition_keycol (char *keycol, MOP class_);
83 extern int do_get_partition_size (MOP class_);
84 extern int do_drop_partition_list (MOP class_, PT_NODE * name_list, DB_CTMPL * tmpl);
85 
86 extern int do_add_queries (PARSER_CONTEXT * parser, DB_CTMPL * ctemplate, const PT_NODE * queries);
87 extern int do_add_attributes (PARSER_CONTEXT * parser, DB_CTMPL * ctemplate, PT_NODE * atts, PT_NODE * constraints,
88  DB_QUERY_TYPE * create_select_columns);
89 extern int do_add_constraints (DB_CTMPL * ctemplate, PT_NODE * constraints);
90 extern int do_check_fk_constraints (DB_CTMPL * ctemplate, PT_NODE * constraints);
91 extern int do_add_methods (PARSER_CONTEXT * parser, DB_CTMPL * ctemplate, PT_NODE * methods);
92 extern int do_add_method_files (const PARSER_CONTEXT * parser, DB_CTMPL * ctemplate, PT_NODE * method_files);
93 extern int do_add_resolutions (const PARSER_CONTEXT * parser, DB_CTMPL * ctemplate, const PT_NODE * resolution);
94 extern int do_add_supers (const PARSER_CONTEXT * parser, DB_CTMPL * ctemplate, const PT_NODE * supers);
95 extern int do_set_object_id (const PARSER_CONTEXT * parser, DB_CTMPL * ctemplate, PT_NODE * object_id_list);
96 extern int do_create_local (PARSER_CONTEXT * parser, DB_CTMPL * ctemplate, PT_NODE * pt_node,
97  DB_QUERY_TYPE * create_select_columns);
98 extern int do_create_entity (PARSER_CONTEXT * parser, PT_NODE * node);
99 extern int do_check_rows_for_null (MOP class_mop, const char *att_name, bool * has_nulls);
100 
102  SM_FUNCTION_INFO * func_index_info, PT_NODE * alter, const char *src_cls_name,
103  const char *new_cls_name);
105  PT_NODE * alter, const char *src_cls_name, const char *new_cls_name);
106 
107 #endif /* _EXECUTE_SCHEMA_H_ */
int do_check_rows_for_null(MOP class_mop, const char *att_name, bool *has_nulls)
int do_is_partitioned_subclass(int *is_partitioned, const char *classname, char *keyattr)
int do_drop_partitioned_class(MOP class_, int drop_sub_flag, bool is_cascade_constraints)
int do_add_methods(PARSER_CONTEXT *parser, DB_CTMPL *ctemplate, PT_NODE *methods)
int do_add_queries(PARSER_CONTEXT *parser, DB_CTMPL *ctemplate, const PT_NODE *queries)
PT_NODE * upd_col_name
int do_get_partition_size(MOP class_)
int do_add_constraints(DB_CTMPL *ctemplate, PT_NODE *constraints)
int do_check_fk_constraints(DB_CTMPL *ctemplate, PT_NODE *constraints)
int do_add_supers(const PARSER_CONTEXT *parser, DB_CTMPL *ctemplate, const PT_NODE *supers)
CLIENT_UPDATE_CLASS_INFO * cls_info
int do_drop_partition_list(MOP class_, PT_NODE *name_list, DB_CTMPL *tmpl)
int do_get_partition_keycol(char *keycol, MOP class_)
CLIENT_UPDATE_INFO * first_assign
int do_add_resolutions(const PARSER_CONTEXT *parser, DB_CTMPL *ctemplate, const PT_NODE *resolution)
int do_rename_partition(MOP old_class, const char *newname)
SP_PARSER_CTX * parser
int do_create_entity(PARSER_CONTEXT *parser, PT_NODE *node)
int do_check_partitioned_class(DB_OBJECT *classop, int check_map, char *keyattr)
int do_set_object_id(const PARSER_CONTEXT *parser, DB_CTMPL *ctemplate, PT_NODE *object_id_list)
int do_create_local(PARSER_CONTEXT *parser, DB_CTMPL *ctemplate, PT_NODE *pt_node, DB_QUERY_TYPE *create_select_columns)
int do_get_partition_parent(DB_OBJECT *const classop, MOP *const parentop)
int do_recreate_filter_index_constr(PARSER_CONTEXT *parser, SM_PREDICATE_INFO *filter_index_info, PT_NODE *alter, const char *src_cls_name, const char *new_cls_name)
int do_add_method_files(const PARSER_CONTEXT *parser, DB_CTMPL *ctemplate, PT_NODE *method_files)
int do_add_attributes(PARSER_CONTEXT *parser, DB_CTMPL *ctemplate, PT_NODE *atts, PT_NODE *constraints, DB_QUERY_TYPE *create_select_columns)
CLIENT_UPDATE_INFO * next
int do_recreate_func_index_constr(PARSER_CONTEXT *parser, SM_CONSTRAINT_INFO *constr, SM_FUNCTION_INFO *func_index_info, PT_NODE *alter, const char *src_cls_name, const char *new_cls_name)
DB_ATTDESC * attr_desc