CUBRID Engine  latest
transform.c
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  * transform.c: Definition of the meta-class information for class storage
21  * and catalog entries.
22  */
23 
24 #ident "$Id$"
25 
26 #include "config.h"
27 
28 #include <stdlib.h>
29 #include "error_manager.h"
30 #include "object_representation.h"
31 #include "object_domain.h"
32 #include "object_primitive.h"
33 #include "transform.h"
34 
35 /* server side only */
36 #if !defined(CS_MODE)
37 #include "intl_support.h"
38 #include "language_support.h"
39 #include "system_catalog.h"
40 #endif /* !CS_MODE */
41 
42 /*
43  * These define the structure of the meta class objects
44  *
45  * IMPORTANT
46  * If you modify either the META_ATTRIBUTE or META_CLASS definitions
47  * here, make sure you adjust the associated ORC_ constants in or.h.
48  * Of particular importance are ORC_CLASS_VAR_ATT_COUNT and
49  * ORC_ATT_VAR_ATT_COUNT.
50  * If you don't know what these are, you shouldn't be making this change.
51  *
52  */
53 /* DOMAIN */
55  {"type", DB_TYPE_INTEGER, 1, NULL, 0, 0, NULL},
56  {"precision", DB_TYPE_INTEGER, 1, NULL, 0, 0, NULL},
57  {"scale", DB_TYPE_INTEGER, 1, NULL, 0, 0, NULL},
58  {"codeset", DB_TYPE_INTEGER, 1, NULL, 0, 0, NULL},
59  {"collation_id", DB_TYPE_INTEGER, 1, NULL, 0, 0, NULL},
60  {"class", DB_TYPE_OBJECT, 1, META_CLASS_NAME, 0, 0, NULL},
61  {"enumeration", DB_TYPE_SET, 1, NULL, 0, 0, NULL},
62  {"set_domain", DB_TYPE_SET, 1, META_DOMAIN_NAME, 1, 0, NULL},
63  {"json_schema", DB_TYPE_STRING, 1, NULL, 0, 0, NULL},
64  {NULL, (DB_TYPE) 0, 0, NULL, 0, 0, NULL}
65 };
66 
68 &domain_atts[0]
69 };
70 
71 /* ATTRIBUTE */
73  {"id", DB_TYPE_INTEGER, 0, NULL, 0, 0, NULL},
74  {"type", DB_TYPE_INTEGER, 1, NULL, 0, 0, NULL},
75  {"offset", DB_TYPE_INTEGER, 0, NULL, 0, 0, NULL},
76  {"order", DB_TYPE_INTEGER, 1, NULL, 0, 0, NULL},
77  {"class", DB_TYPE_OBJECT, 1, META_CLASS_NAME, 0, 0, NULL},
78  {"flags", DB_TYPE_INTEGER, 0, NULL, 0, 0, NULL},
79  {"index_fileid", DB_TYPE_INTEGER, 0, NULL, 0, 0, NULL},
80  {"index_root_pageid", DB_TYPE_INTEGER, 0, NULL, 0, 0, NULL},
81  {"index_volid_key", DB_TYPE_INTEGER, 0, NULL, 0, 0, NULL},
82  {"name", DB_TYPE_STRING, 1, NULL, 0, 0, NULL},
83  {"value", DB_TYPE_VARIABLE, 1, NULL, 0, 0, NULL},
84  {"original_value", DB_TYPE_VARIABLE, 0, NULL, 0, 0, NULL},
85  {"domain", DB_TYPE_SET, 1, META_DOMAIN_NAME, 0, 0, NULL},
86  {"triggers", DB_TYPE_SET, 1, "object", 0, 0, NULL},
87  {"properties", DB_TYPE_SET, 0, NULL, 0, 0, NULL},
88  {"comment", DB_TYPE_STRING, 1, NULL, 0, 0, NULL},
89  {NULL, (DB_TYPE) 0, 0, NULL, 0, 0, NULL}
90 };
92 &att_atts[0]
93 };
94 
95 /* METHOD ARGUMENT */
97  {"type", DB_TYPE_INTEGER, 1, NULL, 0, 0, NULL},
98  {"index", DB_TYPE_INTEGER, 1, NULL, 0, 0, NULL},
99  {"domain", DB_TYPE_SET, 1, META_DOMAIN_NAME, 1, 0, NULL},
100  {NULL, (DB_TYPE) 0, 0, NULL, 0, 0, NULL}
101 };
103 &metharg_atts[0]
104 };
105 
106 /* METHOD SIGNATURE */
108  {"arg_count", DB_TYPE_INTEGER, 1, NULL, 0, 0, NULL},
109  {"function_name", DB_TYPE_STRING, 1, NULL, 0, 0, NULL},
110  {"string_def", DB_TYPE_STRING, 0, NULL, 0, 0, NULL},
111  {"return_value", DB_TYPE_SET, 1, META_METHARG_NAME, 1, 0, NULL},
112  {"arguments", DB_TYPE_SET, 1, META_METHARG_NAME, 1, 0, NULL},
113  {NULL, (DB_TYPE) 0, 0, NULL, 0, 0, NULL}
114 };
116 &methsig_atts[0]
117 };
118 
119 /* METHOD */
121  {"class", DB_TYPE_OBJECT, 1, META_CLASS_NAME, 0, 0, NULL},
122  {"id", DB_TYPE_INTEGER, 0, NULL, 0, 0, NULL},
123  {"name", DB_TYPE_STRING, 1, NULL, 0, 0, NULL},
124  {"signatures", DB_TYPE_SET, 1, META_METHSIG_NAME, 1, 0, NULL},
125  {"properties", DB_TYPE_SET, 0, NULL, 0, 0, NULL},
126  {NULL, (DB_TYPE) 0, 0, NULL, 0, 0, NULL}
127 };
129 &meth_atts[0]
130 };
131 
132 /* METHOD FILE */
134  {"class", DB_TYPE_OBJECT, 1, META_CLASS_NAME, 0, 0, NULL},
135  {"name", DB_TYPE_STRING, 1, NULL, 0, 0, NULL},
136  {"properties", DB_TYPE_SET, 0, NULL, 0, 0, NULL},
137  {NULL, (DB_TYPE) 0, 0, NULL, 0, 0, NULL}
138 };
140 &methfile_atts[0]
141 };
142 
143 /* RESOLUTION */
145  {"class", DB_TYPE_OBJECT, 1, META_CLASS_NAME, 0, 0, NULL},
146  {"type", DB_TYPE_INTEGER, 1, NULL, 0, 0, NULL},
147  {"name", DB_TYPE_STRING, 1, NULL, 0, 0, NULL},
148  {"alias", DB_TYPE_STRING, 1, NULL, 0, 0, NULL},
149  {NULL, (DB_TYPE) 0, 0, NULL, 0, 0, NULL}
150 };
152 &res_atts[0]
153 };
154 
155 /* REPATTRIBUTE */
157  {"id", DB_TYPE_INTEGER, 0, NULL, 0, 0, NULL},
158  {"type", DB_TYPE_INTEGER, 0, NULL, 0, 0, NULL},
159  {"domain", DB_TYPE_SET, 1, META_DOMAIN_NAME, 0, 0, NULL},
160  {NULL, (DB_TYPE) 0, 0, NULL, 0, 0, NULL}
161 };
163 &repatt_atts[0]
164 };
165 
166 /* REPRESENTATION */
168  {"id", DB_TYPE_INTEGER, 0, NULL, 0, 0, NULL},
169  {"fixed_count", DB_TYPE_INTEGER, 0, NULL, 0, 0, NULL},
170  {"variable_count", DB_TYPE_INTEGER, 0, NULL, 0, 0, NULL},
171  {"fixed_size", DB_TYPE_INTEGER, 0, NULL, 0, 0, NULL},
172  {"attributes", DB_TYPE_SET, 0, META_REPATTRIBUTE_NAME, 1, 0, NULL},
173  {"properties", DB_TYPE_SET, 0, NULL, 0, 0, NULL},
174  {NULL, (DB_TYPE) 0, 0, NULL, 0, 0, NULL}
175 };
177 0, 0, &rep_atts[0]
178 };
179 
180 /* CLASS */
182  {"attid_counter", DB_TYPE_INTEGER, 0, NULL, 0, 0, NULL},
183  {"methid_counter", DB_TYPE_INTEGER, 0, NULL, 0, 0, NULL},
184  {"representation_directory", DB_TYPE_OBJECT, 0, "object", 0, 0, NULL},
185  {"heap_fileid", DB_TYPE_INTEGER, 0, NULL, 0, 0, NULL},
186  {"heap_volid", DB_TYPE_INTEGER, 0, NULL, 0, 0, NULL},
187  {"heap_pageid", DB_TYPE_INTEGER, 0, NULL, 0, 0, NULL},
188  {"fixed_count", DB_TYPE_INTEGER, 0, NULL, 0, 0, NULL},
189  {"variable_count", DB_TYPE_INTEGER, 0, NULL, 0, 0, NULL},
190  {"fixed_size", DB_TYPE_INTEGER, 0, NULL, 0, 0, NULL},
191  {"attribute_count", DB_TYPE_INTEGER, 1, NULL, 0, 0, NULL},
192  {"object_size", DB_TYPE_INTEGER, 0, NULL, 0, 0, NULL},
193  {"shared_count", DB_TYPE_INTEGER, 1, NULL, 0, 0, NULL},
194  {"method_count", DB_TYPE_INTEGER, 1, NULL, 0, 0, NULL},
195  {"class_method_count", DB_TYPE_INTEGER, 1, NULL, 0, 0, NULL},
196  {"class_att_count", DB_TYPE_INTEGER, 1, NULL, 0, 0, NULL},
197  {"flags", DB_TYPE_INTEGER, 1, NULL, 0, 0, NULL},
198  {"class_type", DB_TYPE_INTEGER, 1, NULL, 0, 0, NULL},
199  {"owner", DB_TYPE_OBJECT, 1, "object", 0, 0, NULL},
200  {"collation_id", DB_TYPE_INTEGER, 1, NULL, 0, 0, NULL},
201  {"tde_encryption_algorithm", DB_TYPE_INTEGER, 1, NULL, 0, 0, NULL},
202  {"name", DB_TYPE_STRING, 1, NULL, 0, 0, NULL},
203  {"loader_commands", DB_TYPE_STRING, 1, NULL, 0, 0, NULL},
204  {"representations", DB_TYPE_SET, 0, META_REPRESENTATION_NAME, 1, 0, NULL},
205  {"sub_classes", DB_TYPE_SET, 1, META_CLASS_NAME, 0, 0, NULL},
206  {"super_classes", DB_TYPE_SET, 1, META_CLASS_NAME, 0, 0, NULL},
207  {"attributes", DB_TYPE_SET, 1, META_ATTRIBUTE_NAME, 1, 0, NULL},
208  {"shared_attributes", DB_TYPE_SET, 1, META_ATTRIBUTE_NAME, 1, 0, NULL},
209  {"class_attributes", DB_TYPE_SET, 1, META_ATTRIBUTE_NAME, 1, 0, NULL},
210  {"methods", DB_TYPE_SET, 1, META_METHOD_NAME, 1, 0, NULL},
211  {"class_methods", DB_TYPE_SET, 1, META_METHOD_NAME, 1, 0, NULL},
212  {"method_files", DB_TYPE_SET, 1, META_METHFILE_NAME, 1, 0, NULL},
213  {"resolutions", DB_TYPE_SET, 1, META_RESOLUTION_NAME, 1, 0, NULL},
214  {"query_spec", DB_TYPE_SET, 1, META_QUERY_SPEC_NAME, 1, 0, NULL},
215  {"triggers", DB_TYPE_SET, 1, "object", 0, 0, NULL},
216  {"properties", DB_TYPE_SET, 0, NULL, 0, 0, NULL},
217  {"comment", DB_TYPE_STRING, 1, NULL, 0, 0, NULL},
218  {"partition", DB_TYPE_SET, 1, META_PARTITION_NAME, 1, 0, NULL},
219  {NULL, (DB_TYPE) 0, 0, NULL, 0, 0, NULL}
220 };
222 &class_atts[0]
223 };
224 
225 /* QUERY_SPEC */
227  {"specification", DB_TYPE_STRING, 1, NULL, 0, 0, NULL},
228  {NULL, (DB_TYPE) 0, 0, NULL, 0, 0, NULL}
229 };
231 &query_spec_atts[0]
232 };
233 
234 /* PARTITION */
236  {"ptype", DB_TYPE_INTEGER, 1, NULL, 0, 0, NULL},
237  {"pname", DB_TYPE_STRING, 1, NULL, 0, 0, NULL},
238  {"pexpr", DB_TYPE_STRING, 1, NULL, 0, 0, NULL},
239  {"pvalues", DB_TYPE_SEQUENCE, 0, NULL, 0, 0, NULL},
240  {"comment", DB_TYPE_STRING, 1, NULL, 0, 0, NULL},
241  {NULL, (DB_TYPE) 0, 0, NULL, 0, 0, NULL}
242 };
243 
245 &partition_atts[0]
246 };
247 
248 /* ROOT */
250  {"heap_fileid", DB_TYPE_INTEGER, 0, NULL, 0, 0, NULL},
251  {"heap_volid", DB_TYPE_INTEGER, 0, NULL, 0, 0, NULL},
252  {"heap_pageid", DB_TYPE_INTEGER, 0, NULL, 0, 0, NULL},
253  {"name", DB_TYPE_STRING, 0, NULL, 0, 0, NULL},
254  {NULL, (DB_TYPE) 0, 0, NULL, 0, 0, NULL}
255 };
256 META_CLASS tf_Metaclass_root = { "rootclass", {META_PAGE_ROOT, 0, META_VOLUME}, 0, 0, 0, &root_atts[0] };
257 
258 /*
259  * Meta_classes
260  * An array of pointers to each meta class. This is used to reference
261  * the class structures after they have been compiled.
262  */
277  NULL
278 };
279 
280 #if !defined(CS_MODE)
281 
282 static CT_ATTR ct_class_atts[] = {
283  {"class_of", NULL_ATTRID, DB_TYPE_OBJECT},
284  {"inst_attr_count", NULL_ATTRID, DB_TYPE_INTEGER},
285  {"shared_attr_count", NULL_ATTRID, DB_TYPE_INTEGER},
286  {"inst_meth_count", NULL_ATTRID, DB_TYPE_INTEGER},
287  {"class_meth_count", NULL_ATTRID, DB_TYPE_INTEGER},
288  {"class_attr_count", NULL_ATTRID, DB_TYPE_INTEGER},
289  {"is_system_class", NULL_ATTRID, DB_TYPE_INTEGER},
290  {"class_type", NULL_ATTRID, DB_TYPE_INTEGER},
291  {"owner", NULL_ATTRID, DB_TYPE_OBJECT},
292  {"collation_id", NULL_ATTRID, DB_TYPE_INTEGER},
293  {"tde_algorithm", NULL_ATTRID, DB_TYPE_INTEGER},
294  {"class_name", NULL_ATTRID, DB_TYPE_VARCHAR},
295  {"sub_classes", NULL_ATTRID, DB_TYPE_SEQUENCE},
296  {"super_classes", NULL_ATTRID, DB_TYPE_SEQUENCE},
297  {"inst_attrs", NULL_ATTRID, DB_TYPE_SEQUENCE},
298  {"shared_attrs", NULL_ATTRID, DB_TYPE_SEQUENCE},
299  {"class_attrs", NULL_ATTRID, DB_TYPE_SEQUENCE},
300  {"inst_meths", NULL_ATTRID, DB_TYPE_SEQUENCE},
301  {"class_meths", NULL_ATTRID, DB_TYPE_SEQUENCE},
302  {"meth_files", NULL_ATTRID, DB_TYPE_SEQUENCE},
303  {"query_specs", NULL_ATTRID, DB_TYPE_SEQUENCE},
304  {"indexes", NULL_ATTRID, DB_TYPE_SEQUENCE},
305  {"comment", NULL_ATTRID, DB_TYPE_VARCHAR},
306  {"partition", NULL_ATTRID, DB_TYPE_SEQUENCE}
307 };
308 
310  {"class_of", NULL_ATTRID, DB_TYPE_OBJECT},
311  {"attr_name", NULL_ATTRID, DB_TYPE_VARCHAR},
312  {"attr_type", NULL_ATTRID, DB_TYPE_INTEGER},
313  {"from_attr_name", NULL_ATTRID, DB_TYPE_VARCHAR},
314  {"data_type", NULL_ATTRID, DB_TYPE_INTEGER},
315  {"def_order", NULL_ATTRID, DB_TYPE_INTEGER},
316  {"from_class_of", NULL_ATTRID, DB_TYPE_OBJECT},
317  {"is_nullable", NULL_ATTRID, DB_TYPE_INTEGER},
318  {"default_value", NULL_ATTRID, DB_TYPE_VARCHAR},
319  {"domains", NULL_ATTRID, DB_TYPE_SEQUENCE},
320  {"comment", NULL_ATTRID, DB_TYPE_VARCHAR}
321 };
322 
324  {"id", NULL_ATTRID, DB_TYPE_INTEGER},
325  {"name", NULL_ATTRID, DB_TYPE_VARCHAR}
326 };
327 
329  {"object_of", NULL_ATTRID, DB_TYPE_OBJECT},
330  {"data_type", NULL_ATTRID, DB_TYPE_INTEGER},
331  {"prec", NULL_ATTRID, DB_TYPE_INTEGER},
332  {"scale", NULL_ATTRID, DB_TYPE_INTEGER},
333  {"code_set", NULL_ATTRID, DB_TYPE_INTEGER},
334  {"collation_id", NULL_ATTRID, DB_TYPE_INTEGER},
335  {"class_of", NULL_ATTRID, DB_TYPE_OBJECT},
336  {"enumeration", NULL_ATTRID, DB_TYPE_SEQUENCE},
337  {"set_domains", NULL_ATTRID, DB_TYPE_SEQUENCE},
338  {"json_schema", NULL_ATTRID, DB_TYPE_STRING}
339 };
340 
342  {"class_of", NULL_ATTRID, DB_TYPE_OBJECT},
343  {"meth_name", NULL_ATTRID, DB_TYPE_VARCHAR},
344  {"meth_type", NULL_ATTRID, DB_TYPE_INTEGER},
345  {"from_meth_name", NULL_ATTRID, DB_TYPE_VARCHAR},
346  {"from_class_of", NULL_ATTRID, DB_TYPE_OBJECT},
347  {"signatures", NULL_ATTRID, DB_TYPE_SEQUENCE}
348 };
349 
351  {"meth_of", NULL_ATTRID, DB_TYPE_OBJECT},
352  {"arg_count", NULL_ATTRID, DB_TYPE_INTEGER},
353  {"func_name", NULL_ATTRID, DB_TYPE_VARCHAR},
354  {"return_value", NULL_ATTRID, DB_TYPE_SEQUENCE},
355  {"arguments", NULL_ATTRID, DB_TYPE_SEQUENCE}
356 };
357 
359  {"meth_sig_of", NULL_ATTRID, DB_TYPE_OBJECT},
360  {"data_type", NULL_ATTRID, DB_TYPE_INTEGER},
361  {"index_of", NULL_ATTRID, DB_TYPE_INTEGER},
362  {"domains", NULL_ATTRID, DB_TYPE_SEQUENCE}
363 };
364 
366  {"class_of", NULL_ATTRID, DB_TYPE_OBJECT},
367  {"from_class_of", NULL_ATTRID, DB_TYPE_OBJECT},
368  {"path_name", NULL_ATTRID, DB_TYPE_VARCHAR}
369 };
370 
372  {"class_of", NULL_ATTRID, DB_TYPE_OBJECT},
373  {"spec", NULL_ATTRID, DB_TYPE_VARCHAR}
374 };
375 
377  {"class_of", NULL_ATTRID, DB_TYPE_OBJECT},
378  {"alias", NULL_ATTRID, DB_TYPE_VARCHAR},
379  {"namespace", NULL_ATTRID, DB_TYPE_INTEGER},
380  {"res_name", NULL_ATTRID, DB_TYPE_VARCHAR}
381 };
382 
383 static CT_ATTR ct_index_atts[] = {
384  {"class_of", NULL_ATTRID, DB_TYPE_OBJECT},
385  {"index_name", NULL_ATTRID, DB_TYPE_VARCHAR},
386  {"is_unique", NULL_ATTRID, DB_TYPE_INTEGER},
387  {"key_count", NULL_ATTRID, DB_TYPE_INTEGER},
388  {"key_attrs", NULL_ATTRID, DB_TYPE_SEQUENCE},
389  {"is_reverse", NULL_ATTRID, DB_TYPE_INTEGER},
390  {"is_primary_key", NULL_ATTRID, DB_TYPE_INTEGER},
391  {"is_foreign_key", NULL_ATTRID, DB_TYPE_INTEGER},
392  {"filter_expression", NULL_ATTRID, DB_TYPE_VARCHAR},
393  {"have_function", NULL_ATTRID, DB_TYPE_INTEGER},
394  {"comment", NULL_ATTRID, DB_TYPE_VARCHAR},
395  {"status", NULL_ATTRID, DB_TYPE_INTEGER}
396 };
397 
399  {"index_of", NULL_ATTRID, DB_TYPE_OBJECT},
400  {"key_attr_name", NULL_ATTRID, DB_TYPE_VARCHAR},
401  {"key_order", NULL_ATTRID, DB_TYPE_INTEGER},
402  {"asc_desc", NULL_ATTRID, DB_TYPE_INTEGER},
403  {"key_prefix_length", NULL_ATTRID, DB_TYPE_INTEGER},
404  {"func", NULL_ATTRID, DB_TYPE_VARCHAR}
405 };
406 
408  {"index_of", NULL_ATTRID, DB_TYPE_OBJECT},
409  {"ptype", NULL_ATTRID, DB_TYPE_INTEGER},
410  {"pname", NULL_ATTRID, DB_TYPE_VARCHAR},
411  {"pexpr", NULL_ATTRID, DB_TYPE_VARCHAR},
412  {"pvalues", NULL_ATTRID, DB_TYPE_SEQUENCE},
413  {"comment", NULL_ATTRID, DB_TYPE_VARCHAR}
414 };
415 
419  (sizeof (ct_class_atts) / sizeof (ct_class_atts[0])),
420  ct_class_atts
421 };
422 
426  (sizeof (ct_attribute_atts) / sizeof (ct_attribute_atts[0])),
427  ct_attribute_atts
428 };
429 
431  NULL,
433  (sizeof (ct_attrid_atts) / sizeof (ct_attrid_atts[0])),
434  ct_attrid_atts
435 };
436 
440  (sizeof (ct_domain_atts) / sizeof (ct_domain_atts[0])),
441  ct_domain_atts
442 };
443 
447  (sizeof (ct_method_atts) / sizeof (ct_method_atts[0])),
448  ct_method_atts
449 };
450 
454  (sizeof (ct_methsig_atts) / sizeof (ct_methsig_atts[0])),
455  ct_methsig_atts
456 };
457 
461  (sizeof (ct_metharg_atts) / sizeof (ct_metharg_atts[0])),
462  ct_metharg_atts
463 };
464 
468  (sizeof (ct_methfile_atts) / sizeof (ct_methfile_atts[0])),
469  ct_methfile_atts
470 };
471 
475  (sizeof (ct_queryspec_atts) / sizeof (ct_queryspec_atts[0])),
476  ct_queryspec_atts
477 };
478 
482  (sizeof (ct_partition_atts) / sizeof (ct_partition_atts[0])),
483  ct_partition_atts
484 };
485 
487  NULL,
489  (sizeof (ct_resolution_atts) / sizeof (ct_resolution_atts[0])),
490  ct_resolution_atts
491 };
492 
496  (sizeof (ct_index_atts) / sizeof (ct_index_atts[0])),
497  ct_index_atts
498 };
499 
503  (sizeof (ct_indexkey_atts) / sizeof (ct_indexkey_atts[0])),
504  ct_indexkey_atts
505 };
506 
508  &ct_Class,
509  &ct_Attribute,
510  &ct_Domain,
511  &ct_Method,
512  &ct_Methsig,
513  &ct_Metharg,
514  &ct_Methfile,
515  &ct_Queryspec,
516  &ct_Index,
517  &ct_Indexkey,
518  &ct_Partition,
519  NULL
520 };
521 
522 bool
524 {
525  int c;
526 
527  for (c = 0; ct_Classes[c] != NULL; c++)
528  {
529  if (OID_EQ (&ct_Classes[c]->cc_classoid, class_oid))
530  {
531  return true;
532  }
533  }
534 
535  return false;
536 }
537 
538 #endif /* !CS_MODE */
539 /*
540  * tf_compile_meta_classes - passes over the static meta class definitions
541  * and fills in the missing fields that are too error prone to keep
542  * calculating by hand.
543  * return: void
544  * Note:
545  * Once this becomes reasonably static, this could be statically coded again.
546  * This is only used on the client but it won't hurt anything to have it on
547  * the server as well.
548  */
549 void
551 {
552  META_CLASS *class_;
553  META_ATTRIBUTE *att;
554  TP_DOMAIN *domain;
555  int c, i;
556 
557  for (c = 0; Meta_classes[c] != NULL; c++)
558  {
559  class_ = Meta_classes[c];
560 
561  class_->mc_n_variable = class_->mc_fixed_size = 0;
562 
563  for (i = 0; class_->mc_atts[i].ma_name != NULL; i++)
564  {
565  att = &class_->mc_atts[i];
566  att->ma_id = i;
567 
568  if (pr_is_variable_type (att->ma_type))
569  {
570  class_->mc_n_variable++;
571  }
572  else if (class_->mc_n_variable)
573  {
574  /*
575  * can't have fixed width attributes AFTER variable width
576  * attributes
577  */
579  }
580  else
581  {
582  /*
583  * need a domain for size calculations, since we don't use
584  * any parameterized types this isn't necessary but we still must
585  * have it to call tp_domain_isk_size().
586  */
587  domain = tp_domain_resolve_default (att->ma_type);
588  class_->mc_fixed_size += tp_domain_disk_size (domain);
589  }
590  }
591  }
592 }
593 
594 #if !defined(CS_MODE)
595 /*
596  * tf_install_meta_classes - dummy function
597  * return: NO_ERROR
598  * Note:
599  * This is called during database formatting and generates the catalog
600  * entries for all the meta classes.
601  */
602 int
604 {
605  /*
606  * no longer making catalog entries, eventually build the meta-class object
607  * here
608  */
609  return NO_ERROR;
610 }
611 #endif /* CS_MODE */
static CT_ATTR ct_metharg_atts[]
Definition: transform.c:358
#define CT_ATTRIBUTE_NAME
Definition: transform.h:120
#define OID_INITIALIZER
Definition: oid.h:36
META_CLASS tf_Metaclass_methsig
Definition: transform.c:115
int tp_domain_disk_size(TP_DOMAIN *domain)
static META_ATTRIBUTE domain_atts[]
Definition: transform.c:54
#define NO_ERROR
Definition: error_code.h:46
#define META_VOLUME
Definition: transform.h:83
META_CLASS tf_Metaclass_method
Definition: transform.c:128
static CT_ATTR ct_attribute_atts[]
Definition: transform.c:309
static CT_ATTR ct_method_atts[]
Definition: transform.c:341
#define META_PAGE_QUERY_SPEC
Definition: transform.h:96
#define META_PAGE_ATTRIBUTE
Definition: transform.h:90
META_CLASS tf_Metaclass_repattribute
Definition: transform.c:162
META_CLASS tf_Metaclass_domain
Definition: transform.c:67
#define META_METHSIG_NAME
Definition: transform.h:109
static META_ATTRIBUTE root_atts[]
Definition: transform.c:249
META_CLASS tf_Metaclass_class
Definition: transform.c:221
#define CT_METHOD_NAME
Definition: transform.h:122
DB_TYPE ma_type
Definition: transform.h:40
int tf_install_meta_classes()
Definition: transform.c:603
DB_TYPE
Definition: dbtype_def.h:670
static CT_ATTR ct_attrid_atts[]
Definition: transform.c:323
#define META_PARTITION_NAME
Definition: transform.h:116
CT_CLASS ct_Index
Definition: transform.c:493
#define META_CLASS_NAME
Definition: transform.h:105
static META_ATTRIBUTE methsig_atts[]
Definition: transform.c:107
int pr_is_variable_type(DB_TYPE id)
#define CT_DOMAIN_NAME
Definition: transform.h:121
#define CT_METHSIG_NAME
Definition: transform.h:123
META_CLASS tf_Metaclass_representation
Definition: transform.c:176
META_CLASS tf_Metaclass_root
Definition: transform.c:256
#define META_DOMAIN_NAME
Definition: transform.h:107
#define META_PAGE_METHOD
Definition: transform.h:93
#define META_METHFILE_NAME
Definition: transform.h:111
CT_CLASS ct_Queryspec
Definition: transform.c:472
CT_CLASS ct_Metharg
Definition: transform.c:458
static CT_ATTR ct_queryspec_atts[]
Definition: transform.c:371
#define CT_METHFILE_NAME
Definition: transform.h:125
#define CT_CLASS_NAME
Definition: transform.h:119
#define CT_PARTITION_NAME
Definition: transform.h:134
#define META_PAGE_REPRESENTATION
Definition: transform.h:87
static META_ATTRIBUTE rep_atts[]
Definition: transform.c:167
static CT_ATTR ct_indexkey_atts[]
Definition: transform.c:398
#define META_PAGE_DOMAIN
Definition: transform.h:89
static CT_ATTR ct_partition_atts[]
Definition: transform.c:407
CT_CLASS ct_Methsig
Definition: transform.c:451
#define META_PAGE_ROOT
Definition: transform.h:86
TP_DOMAIN * tp_domain_resolve_default(DB_TYPE type)
void er_set(int severity, const char *file_name, const int line_no, int err_id, int num_args,...)
#define META_PAGE_METHFILE
Definition: transform.h:94
static CT_ATTR ct_class_atts[]
Definition: transform.c:282
CT_CLASS ct_Partition
Definition: transform.c:479
#define META_RESOLUTION_NAME
Definition: transform.h:112
META_CLASS tf_Metaclass_resolution
Definition: transform.c:151
META_CLASS tf_Metaclass_attribute
Definition: transform.c:91
static META_ATTRIBUTE methfile_atts[]
Definition: transform.c:133
static CT_ATTR ct_methfile_atts[]
Definition: transform.c:365
META_CLASS tf_Metaclass_query_spec
Definition: transform.c:230
#define META_PAGE_METHARG
Definition: transform.h:91
CT_CLASS ct_Class
Definition: transform.c:416
#define OID_EQ(oidp1, oidp2)
Definition: oid.h:92
CT_CLASS ct_Method
Definition: transform.c:444
#define META_PAGE_RESOLUTION
Definition: transform.h:88
#define CT_INDEX_NAME
Definition: transform.h:128
#define NULL
Definition: freelistheap.h:34
static META_ATTRIBUTE meth_atts[]
Definition: transform.c:120
#define META_ATTRIBUTE_NAME
Definition: transform.h:106
#define META_METHOD_NAME
Definition: transform.h:110
#define CT_METHARG_NAME
Definition: transform.h:124
static META_ATTRIBUTE metharg_atts[]
Definition: transform.c:96
#define ER_TF_INVALID_METACLASS
Definition: error_code.h:389
#define CT_QUERYSPEC_NAME
Definition: transform.h:126
#define META_REPRESENTATION_NAME
Definition: transform.h:113
static CT_ATTR ct_index_atts[]
Definition: transform.c:383
static META_ATTRIBUTE partition_atts[]
Definition: transform.c:235
#define META_PAGE_METHSIG
Definition: transform.h:92
void tf_compile_meta_classes()
Definition: transform.c:550
static META_ATTRIBUTE res_atts[]
Definition: transform.c:144
static CT_ATTR ct_domain_atts[]
Definition: transform.c:328
#define META_QUERY_SPEC_NAME
Definition: transform.h:115
CT_CLASS * ct_Classes[]
Definition: transform.c:507
CT_CLASS ct_Domain
Definition: transform.c:437
#define ARG_FILE_LINE
Definition: error_manager.h:44
static META_ATTRIBUTE repatt_atts[]
Definition: transform.c:156
#define META_PAGE_PARTITION
Definition: transform.h:97
#define CT_INDEXKEY_NAME
Definition: transform.h:129
#define META_METHARG_NAME
Definition: transform.h:108
CT_CLASS ct_Attrid
Definition: transform.c:430
META_CLASS tf_Metaclass_metharg
Definition: transform.c:102
META_CLASS tf_Metaclass_partition
Definition: transform.c:244
int i
Definition: dynamic_load.c:954
#define META_PAGE_CLASS
Definition: transform.h:85
static META_ATTRIBUTE query_spec_atts[]
Definition: transform.c:226
#define META_PAGE_REPATTRIBUTE
Definition: transform.h:95
#define NULL_ATTRID
#define META_REPATTRIBUTE_NAME
Definition: transform.h:114
static META_ATTRIBUTE att_atts[]
Definition: transform.c:72
int mc_fixed_size
Definition: transform.h:54
static META_CLASS * Meta_classes[]
Definition: transform.c:263
int mc_n_variable
Definition: transform.h:53
CT_CLASS ct_Resolution
Definition: transform.c:486
const char * ma_name
Definition: transform.h:39
META_ATTRIBUTE * mc_atts
Definition: transform.h:55
CT_CLASS ct_Indexkey
Definition: transform.c:500
CT_CLASS ct_Attribute
Definition: transform.c:423
CT_CLASS ct_Methfile
Definition: transform.c:465
static CT_ATTR ct_resolution_atts[]
Definition: transform.c:376
static META_ATTRIBUTE class_atts[]
Definition: transform.c:181
META_CLASS tf_Metaclass_methfile
Definition: transform.c:139
static CT_ATTR ct_methsig_atts[]
Definition: transform.c:350
bool tf_is_catalog_class(OID *class_oid)
Definition: transform.c:523