CUBRID Engine  latest
transform.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  * transform.h: Definitions for the transformer shared between the client and
22  * server.
23  */
24 
25 #ifndef _TRANSFORM_H_
26 #define _TRANSFORM_H_
27 
28 #ident "$Id$"
29 
30 /*
31  * META_ATTRIBUTE, META_CLASS
32  * These are the structure definitions for the meta class information.
33  * They will be built statically and used for the generation of the
34  * catalog information for class objects.
35  */
36 
37 typedef struct tf_meta_attribute
38 {
39  const char *ma_name;
41  int ma_visible; /* unused */
42  const char *ma_domain_string; /* unused */
43  int ma_substructure; /* unused */
44  int ma_id;
45  void *ma_extended_domain; /* unused; filled in on the client side */
47 
48 typedef struct tf_meta_class
49 {
50  const char *mc_name; /* unused */
52  int mc_repid;
56 } META_CLASS;
57 
58 #if !defined(CS_MODE)
59 typedef struct tf_ct_attribute
60 {
61  const char *ca_name;
62  int ca_id;
64 } CT_ATTR;
65 
66 typedef struct tf_ct_class
67 {
68  const char *cc_name;
70  int cc_n_atts;
72 } CT_CLASS;
73 #endif /* !CS_MODE */
74 
75 /*
76  * Meta OID information
77  * The meta-objects are given special system OIDs in the catalog.
78  * These don't map to actual physical locations but are used to
79  * tag the disk representations of classes with appropriate catalog
80  * keys.
81  */
82 
83 #define META_VOLUME 256
84 
85 #define META_PAGE_CLASS 0
86 #define META_PAGE_ROOT 1
87 #define META_PAGE_REPRESENTATION 2
88 #define META_PAGE_RESOLUTION 3
89 #define META_PAGE_DOMAIN 4
90 #define META_PAGE_ATTRIBUTE 5
91 #define META_PAGE_METHARG 6
92 #define META_PAGE_METHSIG 7
93 #define META_PAGE_METHOD 8
94 #define META_PAGE_METHFILE 9
95 #define META_PAGE_REPATTRIBUTE 10
96 #define META_PAGE_QUERY_SPEC 11
97 #define META_PAGE_PARTITION 12
98 
99 /*
100  * Metaclass names
101  * Names for each of the meta classes.
102  * These can be used in query statements to query the schema.
103  */
104 
105 #define META_CLASS_NAME "sqlx_class"
106 #define META_ATTRIBUTE_NAME "sqlx_attribute"
107 #define META_DOMAIN_NAME "sqlx_domain"
108 #define META_METHARG_NAME "sqlx_method_argument"
109 #define META_METHSIG_NAME "sqlx_method_signature"
110 #define META_METHOD_NAME "sqlx_method"
111 #define META_METHFILE_NAME "sqlx_method_file"
112 #define META_RESOLUTION_NAME "sqlx_resolution"
113 #define META_REPRESENTATION_NAME "sqlx_representation"
114 #define META_REPATTRIBUTE_NAME "sqlx_repattribute"
115 #define META_QUERY_SPEC_NAME "sqlx_query_spec"
116 #define META_PARTITION_NAME "sqlx_partition"
117 
118 /* catalog classes */
119 #define CT_CLASS_NAME "_db_class"
120 #define CT_ATTRIBUTE_NAME "_db_attribute"
121 #define CT_DOMAIN_NAME "_db_domain"
122 #define CT_METHOD_NAME "_db_method"
123 #define CT_METHSIG_NAME "_db_meth_sig"
124 #define CT_METHARG_NAME "_db_meth_arg"
125 #define CT_METHFILE_NAME "_db_meth_file"
126 #define CT_QUERYSPEC_NAME "_db_query_spec"
127 #define CT_RESOLUTION_NAME "_db_resolution"
128 #define CT_INDEX_NAME "_db_index"
129 #define CT_INDEXKEY_NAME "_db_index_key"
130 #define CT_CLASSAUTH_NAME "_db_auth"
131 #define CT_DATATYPE_NAME "_db_data_type"
132 #define CT_STORED_PROC_NAME "_db_stored_procedure"
133 #define CT_STORED_PROC_ARGS_NAME "_db_stored_procedure_args"
134 #define CT_PARTITION_NAME "_db_partition"
135 #define CT_SERIAL_NAME "db_serial"
136 #define CT_HA_APPLY_INFO_NAME "db_ha_apply_info"
137 #define CT_COLLATION_NAME "_db_collation"
138 #define CT_USER_NAME "db_user"
139 #define CT_TRIGGER_NAME "db_trigger"
140 #define CT_ROOT_NAME "db_root"
141 #define CT_PASSWORD_NAME "db_password"
142 #define CT_AUTHORIZATION_NAME "db_authorization"
143 #define CT_AUTHORIZATIONS_NAME "db_authorizations"
144 #define CT_CHARSET_NAME "_db_charset"
145 #define CT_DUAL_NAME "dual"
146 
147 /* catalog vclasses */
148 #define CTV_CLASS_NAME "db_class"
149 #define CTV_SUPER_CLASS_NAME "db_direct_super_class"
150 #define CTV_VCLASS_NAME "db_vclass"
151 #define CTV_ATTRIBUTE_NAME "db_attribute"
152 #define CTV_ATTR_SD_NAME "db_attr_setdomain_elm"
153 #define CTV_METHOD_NAME "db_method"
154 #define CTV_METHARG_NAME "db_meth_arg"
155 #define CTV_METHARG_SD_NAME "db_meth_arg_setdomain_elm"
156 #define CTV_METHFILE_NAME "db_meth_file"
157 #define CTV_INDEX_NAME "db_index"
158 #define CTV_INDEXKEY_NAME "db_index_key"
159 #define CTV_AUTH_NAME "db_auth"
160 #define CTV_TRIGGER_NAME "db_trig"
161 #define CTV_STORED_PROC_NAME "db_stored_procedure"
162 #define CTV_STORED_PROC_ARGS_NAME "db_stored_procedure_args"
163 #define CTV_PARTITION_NAME "db_partition"
164 #define CTV_DB_COLLATION_NAME "db_collation"
165 #define CTV_DB_CHARSET_NAME "db_charset"
166 
167 #define CT_DBCOLL_COLL_ID_COLUMN "coll_id"
168 #define CT_DBCOLL_COLL_NAME_COLUMN "coll_name"
169 #define CT_DBCOLL_CHARSET_ID_COLUMN "charset_id"
170 #define CT_DBCOLL_BUILT_IN_COLUMN "built_in"
171 #define CT_DBCOLL_EXPANSIONS_COLUMN "expansions"
172 #define CT_DBCOLL_CONTRACTIONS_COLUMN "contractions"
173 #define CT_DBCOLL_UCA_STRENGTH "uca_strength"
174 #define CT_DBCOLL_CHECKSUM_COLUMN "checksum"
175 
176 #define SET_AUTO_INCREMENT_SERIAL_NAME(SR_NAME, CL_NAME, AT_NAME) \
177  sprintf(SR_NAME, "%s_ai_%s", CL_NAME, AT_NAME)
178 
179 #define AUTO_INCREMENT_SERIAL_NAME_EXTRA_LENGTH (4)
180 #define AUTO_INCREMENT_SERIAL_NAME_MAX_LENGTH ((DB_MAX_IDENTIFIER_LENGTH - 1) * 2 + AUTO_INCREMENT_SERIAL_NAME_EXTRA_LENGTH + 1)
181 
182 /*
183  * Metaclass definitions
184  * Static definitions of the meta classes.
185  */
186 
200 
201 #if !defined(CS_MODE)
202 extern CT_CLASS ct_Class;
203 extern CT_CLASS ct_Attribute;
204 extern CT_CLASS ct_Attrid;
205 extern CT_CLASS ct_Domain;
206 extern CT_CLASS ct_Method;
207 extern CT_CLASS ct_Methsig;
208 extern CT_CLASS ct_Metharg;
209 extern CT_CLASS ct_Methfile;
210 extern CT_CLASS ct_Resolution;
211 extern CT_CLASS ct_Queryspec;
212 extern CT_CLASS ct_Index;
213 extern CT_CLASS ct_Indexkey;
214 extern CT_CLASS ct_Partition;
215 extern CT_CLASS *ct_Classes[];
216 #endif /* !CS_MODE */
217 
218 /* This fills in misc information missing from the static definitions */
219 extern void tf_compile_meta_classes (void);
220 extern bool tf_is_catalog_class (OID * class_oid);
221 
222 /* This is available only on the server for catalog initialization */
223 
224 #if !defined(CS_MODE)
225 extern int tf_install_meta_classes (void);
226 #endif /* !CS_MODE */
227 
228 #endif /* _TRANSFORM_H_ */
bool tf_is_catalog_class(OID *class_oid)
Definition: transform.c:523
CT_CLASS ct_Metharg
Definition: transform.c:458
CT_CLASS * ct_Classes[]
Definition: transform.c:507
struct tf_ct_class CT_CLASS
CT_CLASS ct_Index
Definition: transform.c:493
DB_TYPE ma_type
Definition: transform.h:40
META_CLASS tf_Metaclass_repattribute
Definition: transform.c:162
DB_TYPE
Definition: dbtype_def.h:670
void tf_compile_meta_classes(void)
Definition: transform.c:550
META_CLASS tf_Metaclass_methsig
Definition: transform.c:115
CT_CLASS ct_Attribute
Definition: transform.c:423
struct tf_ct_attribute CT_ATTR
META_CLASS tf_Metaclass_root
Definition: transform.c:256
META_CLASS tf_Metaclass_method
Definition: transform.c:128
META_CLASS tf_Metaclass_resolution
Definition: transform.c:151
OID cc_classoid
Definition: transform.h:69
const char * cc_name
Definition: transform.h:68
CT_CLASS ct_Methfile
Definition: transform.c:465
CT_CLASS ct_Queryspec
Definition: transform.c:472
META_CLASS tf_Metaclass_representation
Definition: transform.c:176
CT_CLASS ct_Partition
Definition: transform.c:479
CT_CLASS ct_Resolution
Definition: transform.c:486
const char * mc_name
Definition: transform.h:50
META_CLASS tf_Metaclass_methfile
Definition: transform.c:139
META_CLASS tf_Metaclass_metharg
Definition: transform.c:102
void * ma_extended_domain
Definition: transform.h:45
struct tf_meta_class META_CLASS
DB_TYPE ca_type
Definition: transform.h:63
CT_CLASS ct_Attrid
Definition: transform.c:430
META_CLASS tf_Metaclass_domain
Definition: transform.c:67
CT_CLASS ct_Indexkey
Definition: transform.c:500
META_CLASS tf_Metaclass_query_spec
Definition: transform.c:230
const char * ma_domain_string
Definition: transform.h:42
struct tf_meta_attribute META_ATTRIBUTE
META_CLASS tf_Metaclass_partition
Definition: transform.c:244
CT_CLASS ct_Methsig
Definition: transform.c:451
CT_ATTR * cc_atts
Definition: transform.h:71
int cc_n_atts
Definition: transform.h:70
int mc_fixed_size
Definition: transform.h:54
META_CLASS tf_Metaclass_attribute
Definition: transform.c:91
int mc_n_variable
Definition: transform.h:53
META_CLASS tf_Metaclass_class
Definition: transform.c:221
int tf_install_meta_classes(void)
Definition: transform.c:603
const char * ma_name
Definition: transform.h:39
META_ATTRIBUTE * mc_atts
Definition: transform.h:55
CT_CLASS ct_Domain
Definition: transform.c:437
OID mc_classoid
Definition: transform.h:51
CT_CLASS ct_Class
Definition: transform.c:416
CT_CLASS ct_Method
Definition: transform.c:444
const char * ca_name
Definition: transform.h:61