CUBRID Engine  latest
object_domain.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  * object_domain.h: data type definitions
22  */
23 
24 #ifndef _OBJECT_DOMAIN_H_
25 #define _OBJECT_DOMAIN_H_
26 
27 #ident "$Id$"
28 
29 #include "config.h"
30 #include "dbtype_def.h"
31 
32 #include <stdio.h>
33 
34 #if defined (__cplusplus)
35 class JSON_VALIDATOR;
36 #endif
37 
38 #define DOM_GET_ENUMERATION(dom) \
39  ((dom)->enumeration)
40 #define DOM_GET_ENUM_ELEMENTS(dom) \
41  ((dom)->enumeration.elements)
42 #define DOM_GET_ENUM_ELEMS_COUNT(dom) \
43  ((dom)->enumeration.count)
44 #define DOM_GET_ENUM_ELEM(dom, idx) \
45  ((dom)->enumeration.elements[idx - 1])
46 
47 #define DOM_SET_ENUM_ELEMENTS(dom, elems) \
48  ((dom)->enumeration.elements = (elems))
49 #define DOM_SET_ENUM_ELEMS_COUNT(dom, cnt) \
50  ((dom)->enumeration.count = (cnt))
51 #define DOM_SET_ENUM(dom, elems, cnt) \
52  do{\
53  (dom)->enumeration.count = (cnt); \
54  (dom)->enumeration.elements = (elems); \
55  } while(0)
56 /*
57  * TP_DOMAIN_SELF_REF is used as an argument
58  * to tp_domain_construct so that the self_ref flag can be set
59  */
60 #define TP_DOMAIN_SELF_REF -1
61 
62 typedef enum
63 {
64  /* normal mode, collation applies as other domain parameters */
66  /* only collation applies, the type and precision are not changed */
68  /* type and precision are applied, collation is leaved intact */
71 
72 typedef struct tp_domain
73 {
74  struct tp_domain *next; /* next in the same domain list */
75  struct tp_domain *next_list; /* next domain list */
76  struct pr_type *type;
77 
78  int precision;
79  int scale;
80 
81  struct db_object *class_mop; /* swizzled class oid if on client */
82  struct tp_domain *setdomain; /* hierarchical domain for sets */
83 
84  DB_ENUMERATION enumeration; /* enumeration values */
85 
86  OID class_oid; /* Class OID if type is tp_Object */
87 
88  /* built-in reference number */
90 
91  unsigned char codeset; /* codeset if char */
92  int collation_id; /* collation identifier */
93 
95 
96  unsigned self_ref:1; /* object self reference */
97  /*
98  * merge this with self_ref when we get a chance to rebuild the whole
99  * system
100  */
101  unsigned is_cached:1; /* set when the domain has been cached */
102 
103  /* non-zero if this type can be parameterized */
104  unsigned is_parameterized:1;
105 
106  unsigned is_desc:1; /* desc order for index key_type */
107 
108  /* run-time flag used during domain comparison */
109  unsigned is_visited:1;
110 
111  JSON_VALIDATOR *json_validator; /* schema validator if type is json */
112 } TP_DOMAIN;
113 
114  /*
115  * We probably should make this 0 rather than -1 so that we can more easily
116  * represent precisions with unsigned integers. Zero is not a valid
117  * precision.
118  */
119 #define TP_FLOATING_PRECISION_VALUE -1
120 
121 /*
122  * TP_ALLOC_CONTEXT
123  * This structure is used in places where the storage allocation of
124  * certain structures must be controlled.
125  *
126  */
127 
128 typedef struct tp_alloc_context
129 {
130  void *(*alloc_func) (int size, ...); /* optional second argument */
131  void *alloc_args;
132  void (*free_func) (void *mem, ...); /* optional second argument */
133  void *free_args;
135 
136 #define TP_ALLOC(con, size) \
137  (*(con)->alloc_func)(size, (con)->alloc_args)
138 
139 #define TP_FREE(con, mem) \
140  (*(con)->free_func)(mem, (con)->free_args)
141 
142 /*
143  * BUILT IN DOMAINS
144  */
145 
152 extern TP_DOMAIN tp_Set_domain;
155 extern TP_DOMAIN tp_Elo_domain;
168 extern TP_DOMAIN tp_Oid_domain;
173 extern TP_DOMAIN tp_Bit_domain;
178 
179 /*
180  * TP_DOMAIN_STATUS
181  * This is used to defined a set of possible return codes
182  * for the domain comparison and checking functions.
183  * These don't set errors but rather rely on the higher level
184  * modules to set a more appropriate error.
185  */
186 
187 typedef enum tp_domain_status
188 {
189  DOMAIN_COMPATIBLE = 0, /* success */
190  DOMAIN_INCOMPATIBLE, /* can't be coerced */
191  DOMAIN_OVERFLOW, /* value out of range */
192  DOMAIN_ERROR /* an error has been set */
194 
195 /*
196  * TP_MATCH
197  * This is used to describe the amount of "tolerance" to be exhibited by
198  * domain matching functions when looking for compatible domains.
199  */
200 typedef enum tp_match
201 {
202  TP_ANY_MATCH, /* Any coercible domain matches. */
203  TP_EXACT_MATCH, /* Domain must match exactly. */
204  TP_STR_MATCH, /* "String" domains match subject to length constraints and fixed/varying types, i.e.,
205  * a varying domain with precision n "matches" a fixed domain with precision m if n >=
206  * m. Only used in very special circumstances where we're trying to avoid copying
207  * strings. */
208 
210 } TP_MATCH;
211 
212 /*
213  * TP_IS_SET_TYPE
214  * Macros for detecting the set types, saves a function call.
215  */
216 /*
217  * !!! DB_TYPE_VOBJ probably should be added to this macro as this
218  * is now the behavior of pr_is_set_type() which we should try to
219  * phase out in favor of the faster inline macro. Unfortunately, there
220  * are a number of usages of both TP_IS_SET_TYPE that may break if
221  * we change the semantics. Will have to think carefully about this
222  */
223 
224 #define TP_IS_SET_TYPE(typenum) \
225  ((((typenum) == DB_TYPE_SET) || ((typenum) == DB_TYPE_MULTISET) || \
226  ((typenum) == DB_TYPE_SEQUENCE)) ? true : false)
227 
228 /*
229  * TP_IS_BIT_TYPE
230  * Tests to see if the type id is one of the binary string types.
231  */
232 
233 #define TP_IS_BIT_TYPE(typeid) \
234  (((typeid) == DB_TYPE_VARBIT) || ((typeid) == DB_TYPE_BIT))
235 
236 /*
237  * TP_IS_CHAR_TYPE
238  * Tests to see if a type is any one of the character types.
239  */
240 
241 #define TP_IS_CHAR_TYPE(typeid) \
242  (((typeid) == DB_TYPE_VARCHAR) || ((typeid) == DB_TYPE_CHAR) || \
243  ((typeid) == DB_TYPE_VARNCHAR) || ((typeid) == DB_TYPE_NCHAR))
244 
245 #define TP_IS_FIXED_LEN_CHAR_TYPE(typeid) \
246  (((typeid) == DB_TYPE_CHAR) || ((typeid) == DB_TYPE_NCHAR))
247 
248 #define TP_IS_VAR_LEN_CHAR_TYPE(typeid) \
249  (((typeid) == DB_TYPE_VARCHAR) || ((typeid) == DB_TYPE_VARNCHAR))
250 
251 /*
252  * TP_IS_CHAR_BIT_TYPE
253  * Tests to see if a type is one of the character or bit types.
254  */
255 
256 #define TP_IS_CHAR_BIT_TYPE(typeid) (TP_IS_CHAR_TYPE(typeid) \
257  || TP_IS_BIT_TYPE(typeid))
258 
259 #define TP_IS_STRING_TYPE(typeid) TP_IS_CHAR_BIT_TYPE((typeid))
260 
261 #define TP_IS_NUMERIC_TYPE(typeid) \
262  (((typeid) == DB_TYPE_INTEGER) || ((typeid) == DB_TYPE_FLOAT) \
263  || ((typeid) == DB_TYPE_DOUBLE) || ((typeid) == DB_TYPE_SMALLINT) \
264  || ((typeid) == DB_TYPE_NUMERIC) || ((typeid) == DB_TYPE_MONETARY) \
265  || ((typeid) == DB_TYPE_BIGINT))
266 
267 #define TP_IS_DOUBLE_ALIGN_TYPE(typeid) \
268  ((typeid) == DB_TYPE_DOUBLE || (typeid) == DB_TYPE_BIGINT)
269 
270 #define TP_IS_DATE_WITH_TZ_TYPE(typeid) \
271  (((typeid) == DB_TYPE_DATETIMELTZ) || ((typeid) == DB_TYPE_DATETIMETZ) \
272  || ((typeid) == DB_TYPE_TIMESTAMPLTZ) \
273  || ((typeid) == DB_TYPE_TIMESTAMPTZ))
274 
275 #define TP_IS_DATE_TYPE(typeid) \
276  (((typeid) == DB_TYPE_DATE) || ((typeid) == DB_TYPE_DATETIME) \
277  || ((typeid) == DB_TYPE_TIMESTAMP) || TP_IS_DATE_WITH_TZ_TYPE (typeid))
278 
279 #define TP_IS_DATE_OR_TIME_TYPE(typeid) \
280  (((typeid) == DB_TYPE_TIME) || TP_IS_DATE_TYPE(typeid))
281 
282 #define TP_IS_FLOATING_NUMBER_TYPE(typeid) \
283  (((typeid) == DB_TYPE_FLOAT) || ((typeid) == DB_TYPE_DOUBLE) \
284  || ((typeid) == DB_TYPE_NUMERIC) || ((typeid) == DB_TYPE_MONETARY))
285 
286 /*
287  * Precision for non-parameterized predefined types
288  *
289  * SQL-3 says time and timestamp types should be parameterized.
290  * Should Cubrid implement the standard then the corresponding time/timestamp
291  * macros found here would be removed and placed in dbtype.h similar to
292  * the numeric macros (DB_MAX_NUMERIC_PRECISION).
293  */
294 
295 #define TP_DOUBLE_MANTISA_BINARY_PRECISION 53
296 #define TP_DOUBLE_EXPONENT_BINARY_PRECISION 11
297 #define TP_DOUBLE_BINARY_PRECISION TP_DOUBLE_MANTISA_BINARY_PRECISION
298 
299 #define TP_DOUBLE_MANTISA_DECIMAL_PRECISION 16 /* 15.955 */
300 #define TP_DOUBLE_EXPONENT_DECIMAL_PRECISION 3 /* 3.311 */
301 #define TP_DOUBLE_DECIMAL_PRECISION TP_DOUBLE_MANTISA_DECIMAL_PRECISION
302 
303 /* add 4 for exponent and mantisa sign, decimal point and the exponent
304  * introducer 'e' in a floating-point literal */
305 #define TP_DOUBLE_AS_CHAR_LENGTH \
306  (4 + TP_DOUBLE_MANTISA_DECIMAL_PRECISION + \
307  TP_DOUBLE_EXPONENT_DECIMAL_PRECISION)
308 
309 #define TP_MONETARY_MANTISA_PRECISION TP_DOUBLE_MANTISA_DECIMAL_PRECISION
310 #define TP_MONETARY_EXPONENT_PRECISION TP_DOUBLE_EXPONENT_DECIMAL_PRECISION
311 #define TP_MONETARY_PRECISION TP_DOUBLE_DECIMAL_PRECISION
312 #define TP_MONETARY_AS_CHAR_LENGTH TP_DOUBLE_AS_CHAR_LENGTH
313 
314 #define TP_FLOAT_MANTISA_BINARY_PRECISION 24
315 #define TP_FLOAT_EXPONENT_BINARY_PRECISION 8
316 #define TP_FLOAT_BINARY_PRECISION TP_FLOAT_MANTISA_BINARY_PRECISION
317 
318 #define TP_FLOAT_MANTISA_DECIMAL_PRECISION 7 /* 7.225 */
319 #define TP_FLOAT_EXPONENT_DECIMAL_PRECISION 2 /* 2.408 */
320 #define TP_FLOAT_DECIMAL_PRECISION TP_FLOAT_MANTISA_DECIMAL_PRECISION
321 #define TP_FLOAT_AS_CHAR_LENGTH \
322  (4 + TP_FLOAT_MANTISA_DECIMAL_PRECISION + \
323  TP_FLOAT_EXPONENT_DECIMAL_PRECISION)
324 
325 #define TP_BIGINT_PRECISION 19
326 #define TP_BIGINT_SCALE 0
327 #define TP_BIGINT_AS_CHAR_LENGTH 20
328 
329 #define TP_INTEGER_PRECISION 10
330 #define TP_INTEGER_AS_CHAR_LENGTH 11
331 
332 #define TP_SMALLINT_PRECISION 5
333 #define TP_SMALLINT_AS_CHAR_LENGTH 6
334 
335 #define TP_TIME_PRECISION 6
336 #define TP_TIME_AS_CHAR_LENGTH 11
337 
338 #define TP_DATE_PRECISION 8
339 #define TP_DATE_AS_CHAR_LENGTH 10
340 
341 #define TP_TIMESTAMP_PRECISION 14
342 #define TP_TIMESTAMP_AS_CHAR_LENGTH 22
343 #define TP_TIMESTAMPTZ_AS_CHAR_LENGTH 64
344 
345 #define TP_DATETIME_PRECISION 17
346 #define TP_DATETIME_AS_CHAR_LENGTH 26
347 #define TP_DATETIMETZ_AS_CHAR_LENGTH 64
348 
349 /* CHAR type and VARCHAR type are compatible with each other */
350 /* NCHAR type and VARNCHAR type are compatible with each other */
351 /* BIT type and VARBIT type are compatible with each other */
352 /* OID type and OBJECT type are compatible with each other */
353 /* Keys can come in with a type of DB_TYPE_OID, but the B+tree domain
354  itself will always be a DB_TYPE_OBJECT. The comparison routines
355  can handle OID and OBJECT as compatible type with each other . */
356 #define TP_ARE_COMPARABLE_KEY_TYPES(key1_type, key2_type) \
357  (((key1_type) == (key2_type)) || \
358  (((key1_type) == DB_TYPE_CHAR || (key1_type) == DB_TYPE_VARCHAR) && \
359  ((key2_type) == DB_TYPE_CHAR || (key2_type) == DB_TYPE_VARCHAR)) || \
360  (((key1_type) == DB_TYPE_NCHAR || (key1_type) == DB_TYPE_VARNCHAR) && \
361  ((key2_type) == DB_TYPE_NCHAR || (key2_type) == DB_TYPE_VARNCHAR)) || \
362  (((key1_type) == DB_TYPE_BIT || (key1_type) == DB_TYPE_VARBIT) && \
363  ((key2_type) == DB_TYPE_BIT || (key2_type) == DB_TYPE_VARBIT)) || \
364  (((key1_type) == DB_TYPE_OID || (key1_type) == DB_TYPE_OBJECT) && \
365  ((key2_type) == DB_TYPE_OID || (key2_type) == DB_TYPE_OBJECT)))
366 
367 #define TP_DOMAIN_TYPE(dom) \
368  ((dom) ? (dom)->type->id : DB_TYPE_NULL)
369 
370 #define TP_TYPE_HAS_COLLATION(typeid) \
371  (TP_IS_CHAR_TYPE(typeid) || (typeid) == DB_TYPE_ENUMERATION)
372 
373 #define TP_DOMAIN_CODESET(dom) (((dom) ? (INTL_CODESET)(dom)->codeset : LANG_SYS_CODESET))
374 #define TP_DOMAIN_COLLATION(dom) \
375  ((dom) ? (dom)->collation_id : LANG_SYS_COLLATION)
376 #define TP_DOMAIN_COLLATION_FLAG(dom) \
377  ((dom) ? (dom)->collation_flag: TP_DOMAIN_COLL_NORMAL)
378 
379 #define TP_TYPE_NOT_SUPPORT_COVERING(typeid) \
380  ((typeid) == DB_TYPE_TIMESTAMPTZ || (typeid) == DB_TYPE_DATETIMETZ)
381 
382 
383 /*
384  * FUNCTIONS
385  */
386 #ifdef __cplusplus
387 extern "C"
388 {
389 #endif
390 
391 /* called during workspace initialization */
392 
393  extern void tp_area_init (void);
394 
395 /* Domain support functions */
396 
397  extern int tp_init (void);
398  extern void tp_apply_sys_charset (void);
399  extern void tp_final (void);
400  extern TP_DOMAIN *tp_domain_resolve (DB_TYPE domain_type, DB_OBJECT * class_obj, int precision, int scale,
401  TP_DOMAIN * setdomain, int collation);
403  extern TP_DOMAIN *tp_domain_resolve_default_w_coll (DB_TYPE type, int coll_id, TP_DOMAIN_COLL_ACTION coll_flag);
404 
405  extern void tp_domain_init (TP_DOMAIN * domain, DB_TYPE type_id);
406  extern void tp_domain_free (TP_DOMAIN * dom);
407  extern TP_DOMAIN *tp_domain_new (DB_TYPE type);
408  extern int tp_domain_copy_enumeration (DB_ENUMERATION * dest, const DB_ENUMERATION * src);
409  extern TP_DOMAIN *tp_domain_copy (const TP_DOMAIN * dom, bool check_cache);
410  extern TP_DOMAIN *tp_domain_construct (DB_TYPE domain_type, DB_OBJECT * class_obj, int precision, int scale,
411  TP_DOMAIN * setdomain);
412 
413  extern void tp_init_value_domain (TP_DOMAIN * domain, DB_VALUE * value);
414 
415  extern TP_DOMAIN *tp_domain_cache (TP_DOMAIN * domain);
416 
417  extern int tp_domain_add (TP_DOMAIN ** dlist, TP_DOMAIN * domain);
418 
419  extern int tp_domain_drop (TP_DOMAIN ** dlist, TP_DOMAIN * domain);
420 
421  extern int tp_domain_filter_list (TP_DOMAIN * dlist, int *list_changes);
422 
423  extern int tp_domain_size (const TP_DOMAIN * domain);
424 
425  extern int tp_setdomain_size (const TP_DOMAIN * domain);
426 
427  extern int tp_domain_match (const TP_DOMAIN * dom1, const TP_DOMAIN * dom2, TP_MATCH exact);
428  extern int tp_domain_match_ignore_order (const TP_DOMAIN * dom1, const TP_DOMAIN * dom2, TP_MATCH exact);
429  extern int tp_domain_compatible (const TP_DOMAIN * dom1, const TP_DOMAIN * dom2);
430 
431  extern TP_DOMAIN *tp_domain_select (const TP_DOMAIN * domain_list, const DB_VALUE * value, int allow_coercion,
432  TP_MATCH exact_match);
433 
434 #if !defined (SERVER_MODE)
435  extern TP_DOMAIN *tp_domain_select_type (const TP_DOMAIN * domain_list, DB_TYPE type, DB_OBJECT * class_mop,
436  int allow_coercion);
437 #endif
438 
439  extern TP_DOMAIN_STATUS tp_domain_check (const TP_DOMAIN * domain, const DB_VALUE * value, TP_MATCH exact_match);
441  TP_DOMAIN *tp_domain_find_numeric (DB_TYPE type, int precision, int scale, bool is_desc);
443  int precision, bool is_desc);
444  TP_DOMAIN *tp_domain_find_object (DB_TYPE type, OID * class_oid, struct db_object *class_, bool is_desc);
445  TP_DOMAIN *tp_domain_find_set (DB_TYPE type, TP_DOMAIN * setdomain, bool is_desc);
447  TP_DOMAIN *tp_domain_resolve_value (const DB_VALUE * val, TP_DOMAIN * dbuf);
448 #if defined(ENABLE_UNUSED_FUNCTION)
449  TP_DOMAIN *tp_create_domain_resolve_value (DB_VALUE * val, TP_DOMAIN * domain);
450 #endif /* ENABLE_UNUSED_FUNCTION */
451  int tp_can_steal_string (const DB_VALUE * val, const DB_DOMAIN * desired_domain);
452  bool tp_domain_references_objects (const TP_DOMAIN * dom);
453 
454  int tp_get_fixed_precision (DB_TYPE domain_type);
455 
456 /* value functions */
457 
458  extern TP_DOMAIN_STATUS tp_value_coerce (const DB_VALUE * src, DB_VALUE * dest, const TP_DOMAIN * desired_domain);
459  extern int tp_value_coerce_strict (const DB_VALUE * src, DB_VALUE * dest, const TP_DOMAIN * desired_domain);
460 
461  extern TP_DOMAIN_STATUS tp_value_cast (const DB_VALUE * src, DB_VALUE * dest, const TP_DOMAIN * desired_domain,
462  bool implicit_coercion);
463 
464  extern TP_DOMAIN_STATUS tp_value_cast_force (const DB_VALUE * src, DB_VALUE * dest,
465  const TP_DOMAIN * desired_domain, bool implicit_coercion);
466 
468  const TP_DOMAIN * desired_domain, bool implicit_coercion,
469  bool preserve_domain);
470 
472  const TP_DOMAIN * desired_domain, bool implicit_coercion);
473  TP_DOMAIN_STATUS tp_value_change_coll_and_codeset (DB_VALUE * src, DB_VALUE * dest, int coll_id, int codeset);
474 
475  extern int tp_value_equal (const DB_VALUE * value1, const DB_VALUE * value2, int allow_coercion);
476 
477  extern int tp_more_general_type (const DB_TYPE type1, const DB_TYPE type2);
478 
479  extern DB_VALUE_COMPARE_RESULT tp_value_compare (const DB_VALUE * value1, const DB_VALUE * value2, int allow_coercion,
480  int total_order);
481 
482  extern DB_VALUE_COMPARE_RESULT tp_value_compare_with_error (const DB_VALUE * value1, const DB_VALUE * value2,
483  int allow_coercion, int total_order, bool * can_compare);
484 
485  extern DB_VALUE_COMPARE_RESULT tp_set_compare (const DB_VALUE * value1, const DB_VALUE * value2, int allow_coercion,
486  int total_order);
487 
488 /* printed representations */
489 
490  extern int tp_domain_name (const TP_DOMAIN * domain, char *buffer, int maxlen);
491  extern int tp_value_domain_name (const DB_VALUE * value, char *buffer, int maxlen);
492 
493 /* misc info */
494 
495  extern int tp_domain_disk_size (TP_DOMAIN * domain);
496  extern int tp_domain_memory_size (TP_DOMAIN * domain);
497  extern TP_DOMAIN_STATUS tp_check_value_size (TP_DOMAIN * domain, DB_VALUE * value);
498 
499  extern int tp_valid_indextype (DB_TYPE type);
500 #if defined(CUBRID_DEBUG)
501  extern void tp_dump_domain (TP_DOMAIN * domain);
502  extern void tp_domain_print (TP_DOMAIN * domain);
503  extern void tp_domain_fprint (FILE * fp, TP_DOMAIN * domain);
504 #endif
505  extern int tp_domain_attach (TP_DOMAIN ** dlist, TP_DOMAIN * domain);
506 
507  extern TP_DOMAIN_STATUS tp_value_auto_cast (const DB_VALUE * src, DB_VALUE * dest, const TP_DOMAIN * desired_domain);
508  extern int tp_value_str_auto_cast_to_number (DB_VALUE * src, DB_VALUE * dest, DB_TYPE * val_type);
509  extern TP_DOMAIN *tp_infer_common_domain (TP_DOMAIN * arg1, TP_DOMAIN * arg2);
510  extern int tp_value_string_to_double (const DB_VALUE * value, DB_VALUE * result);
511  extern void tp_domain_clear_enumeration (DB_ENUMERATION * enumeration);
512  extern int tp_enumeration_to_varchar (const DB_VALUE * src, DB_VALUE * result);
513  extern int tp_domain_status_er_set (TP_DOMAIN_STATUS status, const char *file_name, const int line_no,
514  const DB_VALUE * src, const TP_DOMAIN * domain);
515 #ifdef __cplusplus
516 }
517 #endif
518 #endif /* _OBJECT_DOMAIN_H_ */
void tp_domain_init(TP_DOMAIN *domain, DB_TYPE type_id)
TP_DOMAIN * tp_domain_find_charbit(DB_TYPE type, int codeset, int collation_id, unsigned char collation_flag, int precision, bool is_desc)
int built_in_index
Definition: object_domain.h:89
TP_DOMAIN tp_Float_domain
void tp_init_value_domain(TP_DOMAIN *domain, DB_VALUE *value)
TP_DOMAIN * tp_domain_resolve(DB_TYPE domain_type, DB_OBJECT *class_obj, int precision, int scale, TP_DOMAIN *setdomain, int collation)
int tp_more_general_type(const DB_TYPE type1, const DB_TYPE type2)
TP_DOMAIN_STATUS tp_value_change_coll_and_codeset(DB_VALUE *src, DB_VALUE *dest, int coll_id, int codeset)
unsigned self_ref
Definition: object_domain.h:96
unsigned char codeset
Definition: object_domain.h:91
int tp_setdomain_size(const TP_DOMAIN *domain)
TP_DOMAIN_STATUS tp_value_cast(const DB_VALUE *src, DB_VALUE *dest, const TP_DOMAIN *desired_domain, bool implicit_coercion)
struct tp_domain * next_list
Definition: object_domain.h:75
TP_DOMAIN * tp_domain_cache(TP_DOMAIN *domain)
void tp_area_init(void)
DB_TYPE
Definition: dbtype_def.h:670
int tp_value_domain_name(const DB_VALUE *value, char *buffer, int maxlen)
struct tp_domain TP_DOMAIN
struct tp_domain * setdomain
Definition: object_domain.h:82
int tp_domain_filter_list(TP_DOMAIN *dlist, int *list_changes)
TP_DOMAIN_STATUS tp_value_cast_no_domain_select(const DB_VALUE *src, DB_VALUE *dest, const TP_DOMAIN *desired_domain, bool implicit_coercion)
TP_DOMAIN tp_Enumeration_domain
TP_DOMAIN tp_Midxkey_domain
int tp_enumeration_to_varchar(const DB_VALUE *src, DB_VALUE *result)
unsigned is_cached
TP_DOMAIN_STATUS tp_check_value_size(TP_DOMAIN *domain, DB_VALUE *value)
TP_DOMAIN tp_Numeric_domain
struct tp_alloc_context TP_ALLOC_CONTEXT
int tp_value_string_to_double(const DB_VALUE *value, DB_VALUE *result)
TP_DOMAIN tp_Set_domain
TP_DOMAIN tp_Blob_domain
int tp_domain_copy_enumeration(DB_ENUMERATION *dest, const DB_ENUMERATION *src)
int tp_value_coerce_strict(const DB_VALUE *src, DB_VALUE *dest, const TP_DOMAIN *desired_domain)
TP_DOMAIN_STATUS tp_domain_check(const TP_DOMAIN *domain, const DB_VALUE *value, TP_MATCH exact_match)
int tp_domain_drop(TP_DOMAIN **dlist, TP_DOMAIN *domain)
enum tp_domain_status TP_DOMAIN_STATUS
TP_DOMAIN * tp_domain_resolve_default_w_coll(DB_TYPE type, int coll_id, TP_DOMAIN_COLL_ACTION coll_flag)
int tp_get_fixed_precision(DB_TYPE domain_type)
tp_match
int tp_domain_size(const TP_DOMAIN *domain)
TP_DOMAIN * tp_domain_find_set(DB_TYPE type, TP_DOMAIN *setdomain, bool is_desc)
int tp_domain_match(const TP_DOMAIN *dom1, const TP_DOMAIN *dom2, TP_MATCH exact)
TP_DOMAIN tp_Vobj_domain
TP_DOMAIN tp_Monetary_domain
void tp_domain_free(TP_DOMAIN *dom)
TP_DOMAIN tp_Object_domain
TP_DOMAIN * tp_domain_resolve_value(const DB_VALUE *val, TP_DOMAIN *dbuf)
DB_VALUE_COMPARE_RESULT tp_set_compare(const DB_VALUE *value1, const DB_VALUE *value2, int allow_coercion, int total_order)
unsigned is_parameterized
int tp_domain_memory_size(TP_DOMAIN *domain)
TP_DOMAIN * tp_infer_common_domain(TP_DOMAIN *arg1, TP_DOMAIN *arg2)
int tp_domain_name(const TP_DOMAIN *domain, char *buffer, int maxlen)
int tp_value_str_auto_cast_to_number(DB_VALUE *src, DB_VALUE *dest, DB_TYPE *val_type)
TP_DOMAIN tp_Utime_domain
TP_DOMAIN_COLL_ACTION
Definition: object_domain.h:62
TP_DOMAIN * tp_domain_construct(DB_TYPE domain_type, DB_OBJECT *class_obj, int precision, int scale, TP_DOMAIN *setdomain)
TP_DOMAIN tp_Date_domain
unsigned is_desc
int tp_domain_attach(TP_DOMAIN **dlist, TP_DOMAIN *domain)
TP_DOMAIN tp_Pointer_domain
int tp_domain_status_er_set(TP_DOMAIN_STATUS status, const char *file_name, const int line_no, const DB_VALUE *src, const TP_DOMAIN *domain)
TP_DOMAIN tp_Integer_domain
TP_DOMAIN tp_VarNChar_domain
int tp_init(void)
TP_DOMAIN_STATUS tp_value_cast_force(const DB_VALUE *src, DB_VALUE *dest, const TP_DOMAIN *desired_domain, bool implicit_coercion)
int tp_value_equal(const DB_VALUE *value1, const DB_VALUE *value2, int allow_coercion)
TP_DOMAIN tp_Json_domain
TP_DOMAIN tp_Multiset_domain
struct pr_type * type
Definition: object_domain.h:76
TP_DOMAIN * tp_domain_find_numeric(DB_TYPE type, int precision, int scale, bool is_desc)
TP_DOMAIN * tp_domain_find_object(DB_TYPE type, OID *class_oid, struct db_object *class_, bool is_desc)
void tp_apply_sys_charset(void)
TP_DOMAIN tp_Bit_domain
TP_DOMAIN * tp_domain_copy(const TP_DOMAIN *dom, bool check_cache)
TP_DOMAIN tp_Error_domain
DB_VALUE_COMPARE_RESULT tp_value_compare(const DB_VALUE *value1, const DB_VALUE *value2, int allow_coercion, int total_order)
enum tp_match TP_MATCH
int tp_domain_add(TP_DOMAIN **dlist, TP_DOMAIN *domain)
TP_DOMAIN tp_Clob_domain
DB_ENUMERATION enumeration
Definition: object_domain.h:84
TP_DOMAIN_COLL_ACTION collation_flag
Definition: object_domain.h:94
TP_DOMAIN tp_Short_domain
unsigned is_visited
TP_DOMAIN tp_Oid_domain
TP_DOMAIN * tp_domain_select(const TP_DOMAIN *domain_list, const DB_VALUE *value, int allow_coercion, TP_MATCH exact_match)
int tp_valid_indextype(DB_TYPE type)
TP_DOMAIN * tp_domain_new(DB_TYPE type)
int tp_can_steal_string(const DB_VALUE *val, const DB_DOMAIN *desired_domain)
TP_DOMAIN tp_Elo_domain
void tp_final(void)
int tp_domain_compatible(const TP_DOMAIN *dom1, const TP_DOMAIN *dom2)
TP_DOMAIN * tp_domain_select_type(const TP_DOMAIN *domain_list, DB_TYPE type, DB_OBJECT *class_mop, int allow_coercion)
TP_DOMAIN_STATUS tp_value_cast_preserve_domain(const DB_VALUE *src, DB_VALUE *dest, const TP_DOMAIN *desired_domain, bool implicit_coercion, bool preserve_domain)
TP_DOMAIN * tp_domain_find_enumeration(const DB_ENUMERATION *enumeration, bool is_desc)
JSON_VALIDATOR * json_validator
int tp_domain_disk_size(TP_DOMAIN *domain)
TP_DOMAIN tp_Sequence_domain
TP_DOMAIN tp_NChar_domain
struct tp_domain * next
Definition: object_domain.h:74
void tp_domain_clear_enumeration(DB_ENUMERATION *enumeration)
struct db_object * class_mop
Definition: object_domain.h:81
TP_DOMAIN tp_Null_domain
tp_domain_status
int collation_id
Definition: object_domain.h:92
TP_DOMAIN tp_Substructure_domain
DB_VALUE_COMPARE_RESULT
Definition: dbtype_def.h:199
TP_DOMAIN tp_Char_domain
TP_DOMAIN tp_VarBit_domain
int tp_domain_match_ignore_order(const TP_DOMAIN *dom1, const TP_DOMAIN *dom2, TP_MATCH exact)
TP_DOMAIN tp_Variable_domain
TP_DOMAIN tp_Double_domain
TP_DOMAIN_STATUS tp_value_auto_cast(const DB_VALUE *src, DB_VALUE *dest, const TP_DOMAIN *desired_domain)
TP_DOMAIN tp_String_domain
TP_DOMAIN * tp_domain_find_noparam(DB_TYPE type, bool is_desc)
TP_DOMAIN tp_Time_domain
bool tp_domain_references_objects(const TP_DOMAIN *dom)
TP_DOMAIN_STATUS tp_value_coerce(const DB_VALUE *src, DB_VALUE *dest, const TP_DOMAIN *desired_domain)
TP_DOMAIN * tp_domain_resolve_default(DB_TYPE type)
DB_VALUE_COMPARE_RESULT tp_value_compare_with_error(const DB_VALUE *value1, const DB_VALUE *value2, int allow_coercion, int total_order, bool *can_compare)