CUBRID Engine  latest
load_object.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  * load_object.h: simplified object definitions
21  */
22 
23 #ifndef _LOAD_OBJECT_H_
24 #define _LOAD_OBJECT_H_
25 
26 #include "dbtype_def.h"
27 #include "class_object.h"
28 #include <vector>
29 
30 class print_output;
31 
32 #define CHECK_PRINT_ERROR(print_fnc) \
33  do { \
34  if ((error = print_fnc) != NO_ERROR) \
35  goto exit_on_error; \
36  } while (0)
37 
38 #define CHECK_EXIT_ERROR(e) \
39  do { \
40  if ((e) == NO_ERROR) { \
41  if (((e) = er_errid()) == NO_ERROR) \
42  (e) = ER_GENERIC_ERROR; \
43  } \
44  } while (0)
45 
46 /*
47  * DESC_OBJ
48  * This is a simplified description of an object that is used in cases
49  * where we do not want or need to build complete memory representations
50  * of an instance. This was developed primarily to support the
51  * loader/import/export utility but could be used for other things as
52  * well.
53  */
54 typedef struct desc_obj
55 {
59  int count;
62 } DESC_OBJ;
63 
64 typedef struct text_output
65 {
66  /* pointer to the buffer */
67  char *buffer;
68  /* pointer to the next byte to buffer when writing */
69  char *ptr;
70  /* optimal I/O pagesize for device */
71  int iosize;
72  /* number of current buffered bytes */
73  int count;
74  /* output file */
75  FILE *fp;
76 } TEXT_OUTPUT;
77 
78 extern int text_print_flush (TEXT_OUTPUT * tout);
79 extern int text_print (TEXT_OUTPUT * tout, const char *buf, int buflen, char const *fmt, ...);
81 extern int desc_obj_to_disk (DESC_OBJ * obj, RECDES * record, bool * index_flag);
82 extern int desc_disk_to_obj (MOP classop, SM_CLASS * class_, RECDES * record, DESC_OBJ * obj);
83 extern void desc_free (DESC_OBJ * obj);
84 
85 extern int desc_value_special_fprint (TEXT_OUTPUT * tout, DB_VALUE * value);
86 extern void desc_value_print (print_output & output_ctx, DB_VALUE * value);
87 extern int er_filter_fileset (FILE * ef);
88 extern int er_filter_errid (bool ignore_warning);
89 
90 /* *INDENT-OFF* */
91 extern void get_ignored_errors (std::vector<int> &vec);
92 /* *INDENT-ON* */
93 
94 #endif /* _LOAD_OBJECT_H_ */
int count
Definition: load_object.h:59
SM_CLASS * class_
Definition: load_object.h:57
FILE * fp
Definition: load_object.h:75
int updated_flag
Definition: load_object.h:58
int text_print(TEXT_OUTPUT *tout, const char *buf, int buflen, char const *fmt,...)
Definition: load_object.c:467
void desc_free(DESC_OBJ *obj)
Definition: load_object.c:138
int desc_value_special_fprint(TEXT_OUTPUT *tout, DB_VALUE *value)
Definition: load_object.c:1575
int desc_obj_to_disk(DESC_OBJ *obj, RECDES *record, bool *index_flag)
Definition: load_object.c:532
char * buffer
Definition: load_object.h:67
struct desc_obj DESC_OBJ
DESC_OBJ * make_desc_obj(SM_CLASS *class_)
Definition: load_object.c:87
char * ptr
Definition: load_object.h:69
DB_VALUE * values
Definition: load_object.h:61
MOP classop
Definition: load_object.h:56
int er_filter_errid(bool ignore_warning)
Definition: load_object.c:1759
void get_ignored_errors(std::vector< int > &vec)
Definition: load_object.c:1801
SM_ATTRIBUTE ** atts
Definition: load_object.h:60
struct text_output TEXT_OUTPUT
int er_filter_fileset(FILE *ef)
Definition: load_object.c:1680
void desc_value_print(print_output &output_ctx, DB_VALUE *value)
Definition: load_object.c:1616
int text_print_flush(TEXT_OUTPUT *tout)
Definition: load_object.c:442
int desc_disk_to_obj(MOP classop, SM_CLASS *class_, RECDES *record, DESC_OBJ *obj)
Definition: load_object.c:930