CUBRID Engine  latest
object_primitive.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_primitive.h: Definitions related to primitive types.
22  *
23  * Basic operations with primitive types supported by database - numerics, strings, time, sets, json, so on
24  *
25  * It includes compare functions for various representations (db_value, in-memory, disk data and index) and
26  * conversions between db_value and other representations.
27  */
28 
29 #ifndef _OBJECT_PRIMITIVE_H_
30 #define _OBJECT_PRIMITIVE_H_
31 
32 #ident "$Id$"
33 
34 #include "dbtype_def.h"
35 
36 #include <cassert>
37 #include <cstdio>
38 #include <vector>
39 
40 // forward definitions
41 class string_buffer;
42 struct tp_domain;
43 struct or_buf;
44 
45 /*
46  * PR_TYPE
47  * This structure defines the information and operations available
48  * for primitive types.
49  */
50 // *INDENT-OFF*
51 typedef struct pr_type
52 {
53  public:
54  typedef void (*initmem_function_type) (void *memptr, struct tp_domain * domain);
55  typedef void (*initval_function_type) (DB_VALUE * value, int precision, int scale);
56  typedef int (*setmem_function_type) (void *memptr, struct tp_domain * domain, DB_VALUE * value);
57  typedef int (*getmem_function_type) (void *memptr, struct tp_domain * domain, DB_VALUE * value, bool copy);
58  typedef int (*setval_function_type) (DB_VALUE * dest, const DB_VALUE * src, bool copy);
59  typedef int (*data_lengthmem_function_type) (void *memptr, struct tp_domain * domain, int disk);
60  typedef int (*data_lengthval_function_type) (DB_VALUE * value, int disk);
61  typedef void (*data_writemem_function_type) (struct or_buf * buf, void *memptr, struct tp_domain * domain);
62  typedef void (*data_readmem_function_type) (struct or_buf * buf, void *memptr, struct tp_domain * domain, int size);
63  typedef int (*data_writeval_function_type) (struct or_buf * buf, DB_VALUE * value);
64  typedef int (*data_readval_function_type) (struct or_buf * buf, DB_VALUE * value, struct tp_domain * domain,
65  int size, bool copy, char *copy_buf, int copy_buf_len);
66  typedef int (*index_lengthmem_function_type) (void *memptr, struct tp_domain * domain);
67  typedef int (*index_lengthval_function_type) (DB_VALUE * value);
68  typedef int (*index_writeval_function_type) (struct or_buf * buf, DB_VALUE * value);
69  typedef int (*index_readval_function_type) (struct or_buf * buf, DB_VALUE * value, struct tp_domain * domain,
70  int size, bool copy, char *copy_buf, int copy_buf_len);
71  typedef DB_VALUE_COMPARE_RESULT (*index_cmpdisk_function_type) (void *memptr1, void *memptr2,
72  struct tp_domain * domain, int do_coercion,
73  int total_order, int *start_colp);
74  typedef void (*freemem_function_type) (void *memptr);
75  typedef DB_VALUE_COMPARE_RESULT (*data_cmpdisk_function_type) (void *memptr1, void *memptr2, tp_domain * domain,
76  int do_coercion, int total_order, int *start_colp);
77  typedef DB_VALUE_COMPARE_RESULT (*cmpval_function_type) (DB_VALUE * value, DB_VALUE * value2, int do_coercion,
78  int total_order, int *start_colp, int collation);
79 
80  // all member variables:
81  public:
82  /* internal identifier name */
83  const char *name;
86  int size;
87  int disksize;
88  int alignment;
89 
90  protected:
110 
111  public:
112  pr_type () = delete;
113  pr_type (const char *name_arg, DB_TYPE id_arg, int varp_arg, int size_arg, int disksize_arg, int align_arg,
114  initmem_function_type initmem_f_arg, initval_function_type initval_f_arg,
115  setmem_function_type setmem_f_arg, getmem_function_type getmem_f_arg, setval_function_type setval_f_arg,
116  data_lengthmem_function_type data_lengthmem_f_arg, data_lengthval_function_type data_lengthval_f_arg,
117  data_writemem_function_type data_writemem_f_arg, data_readmem_function_type data_readmem_f_arg,
118  data_writeval_function_type data_writeval_f_arg, data_readval_function_type data_readval_f_arg,
119  index_lengthmem_function_type index_lengthmem_f_arg, index_lengthval_function_type index_lengthval_f_arg,
120  index_writeval_function_type index_writeval_f_arg, index_readval_function_type index_readval_f_arg,
121  index_cmpdisk_function_type index_cmpdisk_f_arg, freemem_function_type freemem_f_arg,
122  data_cmpdisk_function_type data_cmpdisk_f_arg, cmpval_function_type cmpval_f_arg);
123 
124  // todo - remove all the const stripping code from function implementation; signatures for all internal functions
125  // (prefixed by f_) and their various implementations inside object_primitive.c should be updated.
126  // postponed for a better days and better design
127 
128  // setters/getters
129  inline const char *get_name () const;
130  inline DB_TYPE get_id () const;
131  inline size_t get_alignment () const;
132 
135 
136  void set_cmpval_function (cmpval_function_type cmpval_arg);
138 
139  // is fixed/variable
140  inline bool is_always_variable () const;
141  inline bool is_size_computed () const;
142 
143  // size functions
144  inline int get_mem_size_of_mem (const void *mem, const tp_domain * domain = NULL) const;
145  inline int get_disk_size_of_mem (const void *mem, const tp_domain * domain = NULL) const;
146  inline int get_index_size_of_mem (const void *memptr, const tp_domain * domain) const;
147  inline int get_mem_size_of_value (const DB_VALUE * value) const;
148  inline int get_disk_size_of_value (const DB_VALUE * value) const;
149  inline int get_index_size_of_value (const DB_VALUE * value) const;
150 
151  // operations for in-memory representations
152  inline void initmem (void *memptr, const tp_domain * domain) const;
153  inline int setmem (void *memptr, const tp_domain * domain, const DB_VALUE * value) const;
154  inline int getmem (void *memptr, const tp_domain * domain, DB_VALUE * value, bool copy = true) const;
155  inline void freemem (void *memptr) const;
156 
157  // operations for db_value's
158  inline void initval (DB_VALUE * value, int precision, int scale) const;
159  inline int setval (DB_VALUE * dest, const DB_VALUE * src, bool copy) const;
160  inline DB_VALUE_COMPARE_RESULT cmpval (const DB_VALUE * value, const DB_VALUE * value2, int do_coercion,
161  int total_order, int *start_colp, int collation) const;
162 
163  // operations for disk representation (as usually stored in heap files and list files)
164  inline void data_writemem (struct or_buf * buf, const void *memptr, const tp_domain * domain) const;
165  inline void data_readmem (struct or_buf * buf, void *memptr, const tp_domain * domain, int size) const;
166  inline int data_writeval (struct or_buf * buf, const DB_VALUE * value) const;
167  inline int data_readval (struct or_buf * buf, DB_VALUE * value, const tp_domain * domain, int size, bool copy,
168  char *copy_buf, int copy_buf_len) const;
169  inline DB_VALUE_COMPARE_RESULT data_cmpdisk (const void *memptr1, const void *memptr2, const tp_domain * domain,
170  int do_coercion, int total_order, int *start_colp) const;
171 
172  // operations for index representations (ordered)
173  inline int index_writeval (struct or_buf * buf, const DB_VALUE * value) const;
174  inline int index_readval (struct or_buf * buf, DB_VALUE * value, const tp_domain * domain, int size, bool copy,
175  char *copy_buf, int copy_buf_len) const;
176  inline DB_VALUE_COMPARE_RESULT index_cmpdisk (const void *memptr1, const void *memptr2, const tp_domain * domain,
177  int do_coercion, int total_order, int *start_colp) const;
178 } PR_TYPE, *PRIM;
179 // *INDENT-ON*
180 
181 /*
182  * PRIMITIVE TYPE STRUCTURES
183  */
184 
185 extern PR_TYPE tp_Null;
186 extern PR_TYPE tp_Integer;
187 extern PR_TYPE tp_Short;
188 extern PR_TYPE tp_Float;
189 extern PR_TYPE tp_Double;
190 extern PR_TYPE tp_String;
191 extern PR_TYPE tp_Set;
192 extern PR_TYPE tp_Multiset;
193 extern PR_TYPE tp_Sequence;
194 extern PR_TYPE tp_Object;
195 extern PR_TYPE tp_Midxkey;
196 extern PR_TYPE tp_Time;
197 extern PR_TYPE tp_Utime;
198 extern PR_TYPE tp_Date;
199 extern PR_TYPE tp_Datetime;
200 extern PR_TYPE tp_Monetary;
201 extern PR_TYPE tp_Elo;
202 extern PR_TYPE tp_Blob;
203 extern PR_TYPE tp_Clob;
204 extern PR_TYPE tp_Variable;
205 extern PR_TYPE tp_Substructure;
206 extern PR_TYPE tp_Pointer;
207 extern PR_TYPE tp_Error;
208 extern PR_TYPE tp_Vobj;
209 extern PR_TYPE tp_Oid;
210 extern PR_TYPE tp_Numeric;
211 extern PR_TYPE tp_Bit;
212 extern PR_TYPE tp_VarBit;
213 extern PR_TYPE tp_Char;
214 extern PR_TYPE tp_NChar;
215 extern PR_TYPE tp_VarNChar;
216 extern PR_TYPE tp_ResultSet;
217 extern PR_TYPE tp_Bigint;
218 extern PR_TYPE tp_Enumeration;
219 extern PR_TYPE tp_Timestamptz;
220 extern PR_TYPE tp_Timestampltz;
221 extern PR_TYPE tp_Datetimetz;
222 extern PR_TYPE tp_Datetimeltz;
223 extern PR_TYPE tp_Timetz;
224 extern PR_TYPE tp_Timeltz;
225 extern PR_TYPE tp_Json;
226 
227 extern PR_TYPE *tp_Type_null;
228 extern PR_TYPE *tp_Type_integer;
229 extern PR_TYPE *tp_Type_short;
230 extern PR_TYPE *tp_Type_float;
231 extern PR_TYPE *tp_Type_double;
232 extern PR_TYPE *tp_Type_string;
233 extern PR_TYPE *tp_Type_error;
234 extern PR_TYPE *tp_Type_pointer;
235 extern PR_TYPE *tp_Type_oid;
236 extern PR_TYPE *tp_Type_set;
237 extern PR_TYPE *tp_Type_multiset;
238 extern PR_TYPE *tp_Type_sequence;
239 extern PR_TYPE *tp_Type_object;
240 extern PR_TYPE *tp_Type_time;
241 extern PR_TYPE *tp_Type_utime;
242 extern PR_TYPE *tp_Type_date;
243 extern PR_TYPE *tp_Type_monetary;
244 extern PR_TYPE *tp_Type_elo;
245 extern PR_TYPE *tp_Type_blob;
246 extern PR_TYPE *tp_Type_clob;
247 extern PR_TYPE *tp_Type_variable;
249 extern PR_TYPE *tp_Type_vobj;
250 extern PR_TYPE *tp_Type_numeric;
251 extern PR_TYPE *tp_Type_bit;
252 extern PR_TYPE *tp_Type_varbit;
253 extern PR_TYPE *tp_Type_char;
254 extern PR_TYPE *tp_Type_nchar;
255 extern PR_TYPE *tp_Type_varnchar;
256 extern PR_TYPE *tp_Type_resultset;
257 extern PR_TYPE *tp_Type_midxkey;
258 extern PR_TYPE *tp_Type_bigint;
259 extern PR_TYPE *tp_Type_datetime;
260 extern PR_TYPE *tp_Type_json;
261 
262 extern PR_TYPE *tp_Type_id_map[];
263 
264 /*
265  * EXTERNAL FUNCTIONS
266  */
267 
268 inline void
270 {
271  value->domain.general_info.is_null = 1;
272  value->need_clear = false;
273 }
274 
275 /* Type structure accessors */
276 extern PR_TYPE *pr_type_from_id (DB_TYPE id);
277 extern PR_TYPE *pr_find_type (const char *name);
278 extern const char *pr_type_name (DB_TYPE id);
279 
280 extern bool pr_is_set_type (DB_TYPE type);
281 extern int pr_is_string_type (DB_TYPE type);
282 extern int pr_is_prefix_key_type (DB_TYPE type);
283 extern int pr_is_variable_type (DB_TYPE type);
284 
285 /* Size calculators */
286 
287 extern int pr_mem_size (const PR_TYPE * type);
288 extern int pr_value_mem_size (const DB_VALUE * value);
289 
290 /* DB_VALUE constructors */
291 
292 extern DB_VALUE *pr_make_value (void);
293 extern DB_VALUE *pr_copy_value (DB_VALUE * var);
294 extern int pr_clone_value (const DB_VALUE * src, DB_VALUE * dest);
295 extern int pr_clear_value (DB_VALUE * var);
296 /* *INDENT-OFF* */
297 void pr_clear_value_vector (std::vector<DB_VALUE> &value_vector);
298 /* *INDENT-ON* */
299 
300 extern int pr_free_value (DB_VALUE * var);
301 extern DB_VALUE *pr_make_ext_value (void);
302 extern int pr_free_ext_value (DB_VALUE * value);
303 
304 /* Special transformation functions */
305 
306 extern DB_VALUE_COMPARE_RESULT pr_midxkey_compare (DB_MIDXKEY * mul1, DB_MIDXKEY * mul2, int do_coercion,
307  int total_order, int num_index_term, int *start_colp,
308  int *result_size1, int *result_size2, int *diff_column,
309  bool * dom_is_desc, bool * next_dom_is_desc);
310 extern int pr_midxkey_element_disk_size (char *mem, DB_DOMAIN * domain);
311 extern int pr_midxkey_get_element_nocopy (const DB_MIDXKEY * midxkey, int index, DB_VALUE * value, int *prev_indexp,
312  char **prev_ptrp);
313 extern int pr_midxkey_add_elements (DB_VALUE * keyval, DB_VALUE * dbvals, int num_dbvals,
314  struct tp_domain *dbvals_domain_list);
315 extern int pr_midxkey_init_boundbits (char *bufptr, int n_atts);
316 extern int pr_index_writeval_disk_size (DB_VALUE * value);
317 extern int pr_data_writeval_disk_size (DB_VALUE * value);
318 extern void pr_data_writeval (struct or_buf *buf, DB_VALUE * value);
319 extern int pr_midxkey_unique_prefix (const DB_VALUE * db_midxkey1, const DB_VALUE * db_midxkey2, DB_VALUE * db_result);
320 extern int pr_midxkey_get_element_offset (const DB_MIDXKEY * midxkey, int index);
321 extern int pr_midxkey_add_prefix (DB_VALUE * result, DB_VALUE * prefix, DB_VALUE * postfix, int n_prefix);
322 extern int pr_midxkey_remove_prefix (DB_VALUE * key, int prefix);
323 extern int pr_midxkey_common_prefix (DB_VALUE * key1, DB_VALUE * key2);
324 
325 extern int pr_Inhibit_oid_promotion;
326 
327 /* Helper function for DB_VALUE printing; caller must free_and_init result. */
328 extern char *pr_valstring (const DB_VALUE *);
329 
330 /* area init */
331 extern int pr_area_init (void);
332 extern void pr_area_final (void);
333 
334 extern int pr_complete_enum_value (DB_VALUE * value, struct tp_domain *domain);
335 extern int pr_get_compression_length (const char *string, int str_length);
336 extern int pr_get_compressed_data_from_buffer (struct or_buf *buf, char *data, int compressed_size,
337  int expected_decompressed_size);
338 extern int pr_get_size_and_write_string_to_buffer (struct or_buf *buf, char *val_p, DB_VALUE * value, int *val_size,
339  int align);
340 
341 extern int pr_data_compress_string (const char *string, int str_length, char *compressed_string,
342  int compress_buffer_size, int *compressed_length);
343 
344 extern int pr_clear_compressed_string (DB_VALUE * value);
345 extern int pr_do_db_value_string_compression (DB_VALUE * value);
346 
347 #define PRIM_TEMPORARY_DISK_SIZE 256
348 #define PRIM_COMPRESSION_LENGTH_OFFSET 4
349 
351 
352 /* 1 size byte, 4 bytes the compressed size, 4 bytes the decompressed size, length and the max alignment */
353 #define PRIM_STRING_MAXIMUM_DISK_SIZE(length) (OR_BYTE_SIZE + OR_INT_SIZE + OR_INT_SIZE + (length) + MAX_ALIGNMENT)
354 
356 // Inline/template implementation
358 // *INDENT-OFF*
359 const char *
361 {
362  return name;
363 }
364 
365 DB_TYPE
367 {
368  return id;
369 }
370 
371 size_t
373 {
374  return (size_t) alignment;
375 }
376 
377 bool
379 {
380  // NOTE - this is not reliable to determine if a type is always fixed size or not. Numeric type is not variable, but
381  // it has size computing functions!
382  return variable_p != 0;
383 }
384 
385 bool
387 {
389  return f_data_lengthmem != NULL && f_data_lengthval != NULL;
390 }
391 
392 int
393 pr_type::get_disk_size_of_mem (const void *mem, const tp_domain * domain) const
394 {
395  if (f_data_lengthmem != NULL)
396  {
397  return (*f_data_lengthmem) (const_cast<void *> (mem), const_cast<tp_domain *> (domain), 1);
398  }
399  else
400  {
401  assert (disksize != 0 || id == DB_TYPE_NULL);
402  return disksize;
403  }
404 }
405 
406 int
407 pr_type::get_mem_size_of_mem (const void *mem, const tp_domain * domain) const
408 {
409  if (f_data_lengthmem != NULL)
410  {
411  return (*f_data_lengthmem) (const_cast<void *> (mem), const_cast<tp_domain *> (domain), 0);
412  }
413  else
414  {
415  assert (size != 0 || id == DB_TYPE_NULL);
416  return size;
417  }
418 }
419 
420 int
422 {
423  if (f_data_lengthval != NULL)
424  {
425  return (*f_data_lengthval) (const_cast<DB_VALUE *> (value), 0);
426  }
427  else
428  {
429  assert (size != 0 || id == DB_TYPE_NULL);
430  return size;
431  }
432 }
433 
434 int
436 {
437  if (f_data_lengthval != NULL)
438  {
439  return (*f_data_lengthval) (const_cast<DB_VALUE *> (value), 1);
440  }
441  else
442  {
443  assert (disksize != 0 || id == DB_TYPE_NULL);
444  return disksize;
445  }
446 }
447 
448 void
449 pr_type::initmem (void * memptr, const tp_domain * domain) const
450 {
451  /*
452  * Initialize an attribute value in instance memory
453  * For fixed width attributes, it tries to zero out the memory. This isn't a requirement but it makes the object
454  * block look cleaner in the debugger.
455  * For variable width attributes, it makes sure the pointers are NULL.
456  */
457  (*f_initmem) (memptr, const_cast<tp_domain *> (domain));
458 }
459 
460 void
461 pr_type::initval (DB_VALUE * value, int precision, int scale) const
462 {
463  (*f_initval) (value, precision, scale);
464 }
465 
466 int
467 pr_type::setmem (void * memptr, const tp_domain * domain, const DB_VALUE * value) const
468 {
469  // Assign a value into instance memory, copy the value.
470  return (*f_setmem) (memptr, const_cast<tp_domain *> (domain), const_cast<DB_VALUE *> (value));
471 }
472 
473 int
474 pr_type::getmem (void * memptr, const tp_domain * domain, DB_VALUE * value, bool copy) const
475 {
476  return (*f_getmem) (memptr, const_cast<tp_domain *> (domain), value, copy);
477 }
478 
479 int
480 pr_type::setval (DB_VALUE * dest, const DB_VALUE * src, bool copy) const
481 {
482  return (*f_setval) (dest, src, copy);
483 }
484 
485 void
486 pr_type::data_writemem (or_buf * buf, const void * memptr, const tp_domain * domain) const
487 {
488  (*f_data_writemem) (buf, const_cast<void *> (memptr), const_cast <tp_domain *> (domain));
489 }
490 
491 void
492 pr_type::data_readmem (or_buf * buf, void * memptr, const tp_domain * domain, int size) const
493 {
494  (*f_data_readmem) (buf, memptr, const_cast<tp_domain *> (domain), size);
495 }
496 
497 int
498 pr_type::data_writeval (or_buf * buf, const DB_VALUE * value) const
499 {
500  return (*f_data_writeval) (buf, const_cast<DB_VALUE *> (value));
501 }
502 
503 int
504 pr_type::data_readval (or_buf * buf, DB_VALUE * value, const tp_domain * domain, int size, bool copy, char * copy_buf,
505  int copy_buf_len) const
506 {
507  return (*f_data_readval) (buf, value, const_cast<tp_domain *> (domain), size, copy, copy_buf, copy_buf_len);
508 }
509 
510 int
511 pr_type::get_index_size_of_mem (const void * memptr, const tp_domain * domain) const
512 {
513  if (f_index_lengthmem != NULL)
514  {
515  return (*f_index_lengthmem) (const_cast<void *> (memptr), const_cast<tp_domain *> (domain));
516  }
517  else
518  {
519  assert (disksize != 0 || id == DB_TYPE_NULL);
520  return disksize;
521  }
522 }
523 
524 int
526 {
527  if (f_index_lengthval != NULL)
528  {
529  return (*f_index_lengthval) (const_cast<DB_VALUE *> (value));
530  }
531  else
532  {
533  assert (disksize != 0 || id == DB_TYPE_NULL);
534  return disksize;
535  }
536 }
537 
538 int
539 pr_type::index_writeval (or_buf * buf, const DB_VALUE * value) const
540 {
541  return (*f_index_writeval) (buf, const_cast<DB_VALUE *> (value));
542 }
543 
544 int
545 pr_type::index_readval (or_buf * buf, DB_VALUE * value, const tp_domain * domain, int size, bool copy, char * copy_buf,
546  int copy_buf_len) const
547 {
548  return (*f_index_readval) (buf, value, const_cast<tp_domain *> (domain), size, copy, copy_buf, copy_buf_len);
549 }
550 
552 pr_type::index_cmpdisk (const void * memptr1, const void * memptr2, const tp_domain * domain, int do_coercion,
553  int total_order, int * start_colp) const
554 {
555  return (*f_index_cmpdisk) (const_cast<void *> (memptr1), const_cast<void *> (memptr2),
556  const_cast<tp_domain *> (domain), do_coercion, total_order, start_colp);
557 }
558 
559 void
560 pr_type::freemem (void * memptr) const
561 {
562  if (f_freemem != NULL)
563  {
564  (*f_freemem) (memptr);
565  }
566  }
567 
569 pr_type::data_cmpdisk (const void * memptr1, const void * memptr2, const tp_domain * domain, int do_coercion,
570  int total_order, int * start_colp) const
571 {
572  return (*f_data_cmpdisk) (const_cast<void *> (memptr1), const_cast<void *> (memptr2),
573  const_cast<tp_domain *> (domain), do_coercion, total_order, start_colp);
574 }
575 
577 pr_type::cmpval (const DB_VALUE * value, const DB_VALUE * value2, int do_coercion, int total_order, int * start_colp,
578  int collation) const
579 {
580  return (*f_cmpval) (const_cast<DB_VALUE *> (value), const_cast<DB_VALUE *> (value2), do_coercion, total_order,
581  start_colp, collation);
582 }
583 
584 // *INDENT-ON*
585 
586 #endif /* _OBJECT_PRIMITIVE_H_ */
int pr_midxkey_add_elements(DB_VALUE *keyval, DB_VALUE *dbvals, int num_dbvals, struct tp_domain *dbvals_domain_list)
struct pr_type * PRIM
initmem_function_type f_initmem
PR_TYPE tp_Timestamptz
PR_TYPE tp_Object
int data_readval(struct or_buf *buf, DB_VALUE *value, const tp_domain *domain, int size, bool copy, char *copy_buf, int copy_buf_len) const
index_readval_function_type f_index_readval
int pr_clear_compressed_string(DB_VALUE *value)
PR_TYPE * tp_Type_datetime
DB_VALUE_COMPARE_RESULT(* data_cmpdisk_function_type)(void *memptr1, void *memptr2, tp_domain *domain, int do_coercion, int total_order, int *start_colp)
int(* data_lengthval_function_type)(DB_VALUE *value, int disk)
PR_TYPE * tp_Type_time
int index_readval(struct or_buf *buf, DB_VALUE *value, const tp_domain *domain, int size, bool copy, char *copy_buf, int copy_buf_len) const
PR_TYPE * tp_Type_bit
int(* index_writeval_function_type)(struct or_buf *buf, DB_VALUE *value)
int data_writeval(struct or_buf *buf, const DB_VALUE *value) const
int pr_Inhibit_oid_promotion
PR_TYPE * tp_Type_bigint
PR_TYPE * pr_find_type(const char *name)
int(* setmem_function_type)(void *memptr, struct tp_domain *domain, DB_VALUE *value)
PR_TYPE * tp_Type_set
int get_index_size_of_value(const DB_VALUE *value) const
PR_TYPE tp_Float
data_cmpdisk_function_type get_data_cmpdisk_function() const
size_t align(size_t v)
Definition: align.h:19
PR_TYPE * tp_Type_pointer
DB_TYPE
Definition: dbtype_def.h:670
int pr_is_string_type(DB_TYPE type)
freemem_function_type f_freemem
PR_TYPE tp_Double
const char * pr_type_name(DB_TYPE id)
void initval(DB_VALUE *value, int precision, int scale) const
PR_TYPE * tp_Type_vobj
cmpval_function_type get_cmpval_function() const
data_writemem_function_type f_data_writemem
DB_VALUE * pr_make_ext_value(void)
index_cmpdisk_function_type f_index_cmpdisk
PR_TYPE * tp_Type_numeric
void pr_clear_value_vector(std::vector< DB_VALUE > &value_vector)
PR_TYPE tp_Variable
int(* index_lengthmem_function_type)(void *memptr, struct tp_domain *domain)
void(* initval_function_type)(DB_VALUE *value, int precision, int scale)
PR_TYPE * tp_Type_resultset
int(* index_lengthval_function_type)(DB_VALUE *value)
PR_TYPE tp_VarNChar
DB_VALUE_COMPARE_RESULT cmpval(const DB_VALUE *value, const DB_VALUE *value2, int do_coercion, int total_order, int *start_colp, int collation) const
PR_TYPE tp_Elo
PR_TYPE * tp_Type_short
int pr_get_size_and_write_string_to_buffer(struct or_buf *buf, char *val_p, DB_VALUE *value, int *val_size, int align)
int pr_get_compression_length(const char *string, int str_length)
int index_writeval(struct or_buf *buf, const DB_VALUE *value) const
PR_TYPE * tp_Type_blob
DB_VALUE_COMPARE_RESULT(* cmpval_function_type)(DB_VALUE *value, DB_VALUE *value2, int do_coercion, int total_order, int *start_colp, int collation)
void data_readmem(struct or_buf *buf, void *memptr, const tp_domain *domain, int size) const
PR_TYPE * tp_Type_integer
void set_cmpval_function(cmpval_function_type cmpval_arg)
PR_TYPE * tp_Type_midxkey
PR_TYPE tp_Bigint
PR_TYPE tp_Datetime
void pr_area_final(void)
PR_TYPE tp_Monetary
const char * name
PR_TYPE tp_String
int getmem(void *memptr, const tp_domain *domain, DB_VALUE *value, bool copy=true) const
DB_TYPE get_id() const
int pr_clone_value(const DB_VALUE *src, DB_VALUE *dest)
PR_TYPE tp_Enumeration
DB_VALUE * pr_make_value(void)
void(* data_writemem_function_type)(struct or_buf *buf, void *memptr, struct tp_domain *domain)
PR_TYPE * tp_Type_json
data_readval_function_type f_data_readval
int get_mem_size_of_mem(const void *mem, const tp_domain *domain=NULL) const
int pr_is_prefix_key_type(DB_TYPE type)
DB_DOMAIN_INFO domain
Definition: dbtype_def.h:1082
PR_TYPE * tp_Type_string
PR_TYPE * tp_Type_substructure
PR_TYPE tp_ResultSet
PR_TYPE * tp_Type_oid
void(* data_readmem_function_type)(struct or_buf *buf, void *memptr, struct tp_domain *domain, int size)
int(* data_readval_function_type)(struct or_buf *buf, DB_VALUE *value, struct tp_domain *domain, int size, bool copy, char *copy_buf, int copy_buf_len)
void set_data_cmpdisk_function(data_cmpdisk_function_type data_cmpdisk_arg)
DB_VALUE_COMPARE_RESULT data_cmpdisk(const void *memptr1, const void *memptr2, const tp_domain *domain, int do_coercion, int total_order, int *start_colp) const
void data_writemem(struct or_buf *buf, const void *memptr, const tp_domain *domain) const
PR_TYPE tp_Datetimetz
int setmem(void *memptr, const tp_domain *domain, const DB_VALUE *value) const
int pr_value_mem_size(const DB_VALUE *value)
int pr_midxkey_element_disk_size(char *mem, DB_DOMAIN *domain)
struct pr_type PR_TYPE
void(* freemem_function_type)(void *memptr)
#define assert(x)
getmem_function_type f_getmem
PR_TYPE tp_Timeltz
PR_TYPE * tp_Type_multiset
data_cmpdisk_function_type f_data_cmpdisk
PR_TYPE tp_Midxkey
int pr_is_variable_type(DB_TYPE type)
setval_function_type f_setval
PR_TYPE tp_Utime
int pr_data_compress_string(const char *string, int str_length, char *compressed_string, int compress_buffer_size, int *compressed_length)
PR_TYPE tp_Error
int(* data_lengthmem_function_type)(void *memptr, struct tp_domain *domain, int disk)
int pr_data_writeval_disk_size(DB_VALUE *value)
int pr_do_db_value_string_compression(DB_VALUE *value)
PR_TYPE * tp_Type_clob
int(* data_writeval_function_type)(struct or_buf *buf, DB_VALUE *value)
PR_TYPE * tp_Type_error
bool is_always_variable() const
data_lengthval_function_type f_data_lengthval
PR_TYPE tp_Oid
PR_TYPE tp_Date
PR_TYPE tp_Char
int pr_midxkey_remove_prefix(DB_VALUE *key, int prefix)
PR_TYPE * tp_Type_double
PR_TYPE tp_Numeric
DB_VALUE_COMPARE_RESULT(* index_cmpdisk_function_type)(void *memptr1, void *memptr2, struct tp_domain *domain, int do_coercion, int total_order, int *start_colp)
#define NULL
Definition: freelistheap.h:34
data_lengthmem_function_type f_data_lengthmem
int pr_midxkey_unique_prefix(const DB_VALUE *db_midxkey1, const DB_VALUE *db_midxkey2, DB_VALUE *db_result)
struct pr_type * type
Definition: object_domain.h:76
void initmem(void *memptr, const tp_domain *domain) const
int pr_midxkey_common_prefix(DB_VALUE *key1, DB_VALUE *key2)
PR_TYPE tp_Timetz
PR_TYPE * tp_Type_monetary
PR_TYPE * tp_Type_varnchar
PR_TYPE tp_Blob
int pr_area_init(void)
int pr_free_ext_value(DB_VALUE *value)
void PRIM_SET_NULL(DB_VALUE *value)
bool pr_is_set_type(DB_TYPE type)
pr_type()=delete
PR_TYPE tp_Timestampltz
PR_TYPE tp_Datetimeltz
PR_TYPE * tp_Type_date
need_clear_type need_clear
Definition: dbtype_def.h:1084
int pr_clear_value(DB_VALUE *var)
void(* initmem_function_type)(void *memptr, struct tp_domain *domain)
PR_TYPE * tp_Type_null
void pr_data_writeval(struct or_buf *buf, DB_VALUE *value)
struct db_domain_info::general_info general_info
index_lengthmem_function_type f_index_lengthmem
size_t get_alignment() const
PR_TYPE tp_Integer
int get_mem_size_of_value(const DB_VALUE *value) const
PR_TYPE tp_Null
index_lengthval_function_type f_index_lengthval
int get_index_size_of_mem(const void *memptr, const tp_domain *domain) const
PR_TYPE * tp_Type_char
PR_TYPE * tp_Type_object
index_writeval_function_type f_index_writeval
data_readmem_function_type f_data_readmem
int pr_get_compressed_data_from_buffer(struct or_buf *buf, char *data, int compressed_size, int expected_decompressed_size)
DB_VALUE_COMPARE_RESULT pr_midxkey_compare(DB_MIDXKEY *mul1, DB_MIDXKEY *mul2, int do_coercion, int total_order, int num_index_term, int *start_colp, int *result_size1, int *result_size2, int *diff_column, bool *dom_is_desc, bool *next_dom_is_desc)
int pr_complete_enum_value(DB_VALUE *value, struct tp_domain *domain)
PR_TYPE * tp_Type_float
int(* index_readval_function_type)(struct or_buf *buf, DB_VALUE *value, struct tp_domain *domain, int size, bool copy, char *copy_buf, int copy_buf_len)
int(* getmem_function_type)(void *memptr, struct tp_domain *domain, DB_VALUE *value, bool copy)
setmem_function_type f_setmem
initval_function_type f_initval
PR_TYPE tp_Multiset
PR_TYPE tp_Set
DB_VALUE * pr_copy_value(DB_VALUE *var)
PR_TYPE * tp_Type_nchar
bool is_size_computed() const
PR_TYPE tp_VarBit
const char * get_name() const
PR_TYPE * pr_type_from_id(DB_TYPE id)
PR_TYPE tp_Sequence
int pr_midxkey_init_boundbits(char *bufptr, int n_atts)
PR_TYPE tp_Vobj
int pr_Enable_string_compression
char * pr_valstring(const DB_VALUE *)
DB_TYPE id
PR_TYPE tp_Substructure
void freemem(void *memptr) const
PR_TYPE * tp_Type_id_map[]
PR_TYPE * tp_Type_elo
int pr_midxkey_get_element_nocopy(const DB_MIDXKEY *midxkey, int index, DB_VALUE *value, int *prev_indexp, char **prev_ptrp)
data_writeval_function_type f_data_writeval
int setval(DB_VALUE *dest, const DB_VALUE *src, bool copy) const
cmpval_function_type f_cmpval
PR_TYPE tp_Time
PR_TYPE * tp_Type_sequence
PR_TYPE * tp_Type_varbit
PR_TYPE tp_Clob
int get_disk_size_of_mem(const void *mem, const tp_domain *domain=NULL) const
PR_TYPE tp_NChar
DB_VALUE_COMPARE_RESULT index_cmpdisk(const void *memptr1, const void *memptr2, const tp_domain *domain, int do_coercion, int total_order, int *start_colp) const
PR_TYPE tp_Short
PR_TYPE tp_Bit
DB_VALUE_COMPARE_RESULT
Definition: dbtype_def.h:199
int pr_midxkey_get_element_offset(const DB_MIDXKEY *midxkey, int index)
PR_TYPE tp_Pointer
PR_TYPE * tp_Type_utime
int pr_midxkey_add_prefix(DB_VALUE *result, DB_VALUE *prefix, DB_VALUE *postfix, int n_prefix)
int pr_free_value(DB_VALUE *var)
int pr_index_writeval_disk_size(DB_VALUE *value)
int get_disk_size_of_value(const DB_VALUE *value) const
PR_TYPE * tp_Type_variable
int pr_mem_size(const PR_TYPE *type)
int(* setval_function_type)(DB_VALUE *dest, const DB_VALUE *src, bool copy)
PR_TYPE tp_Json