CUBRID Engine  latest
load_server_loader.hpp
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_server_loader.hpp: Loader server definitions. Updated using design from fast loaddb prototype
21  */
22 
23 #ifndef _LOAD_SERVER_LOADER_HPP_
24 #define _LOAD_SERVER_LOADER_HPP_
25 
26 #include "dbtype_def.h"
27 #include "heap_attrinfo.h"
28 #include "heap_file.h"
29 #include "load_common.hpp"
31 
32 #include <vector>
33 
34 namespace cubload
35 {
36 
37  // forward declaration
38  class session;
39  class attribute;
40  class class_entry;
41  class error_handler;
42 
44  {
45  public:
46  server_class_installer () = delete;
48  ~server_class_installer () override = default;
49 
50  void set_class_id (class_id clsid) override;
51 
52  void check_class (const char *class_name, int class_id) override;
53  int install_class (const char *class_name) override;
54  void install_class (string_type *class_name, class_command_spec_type *cmd_spec) override;
55 
56  bool is_class_ignored (const char *classname);
57  void to_lowercase_identifier (const char *idname, cubmem::extensible_block &eb);
58 
59  private:
60  session &m_session;
61  error_handler &m_error_handler;
62 
63  class_id m_clsid;
64 
65  LC_FIND_CLASSNAME locate_class (const char *class_name, OID &class_oid);
66  void register_class_with_attributes (const char *class_name, class_command_spec_type *cmd_spec);
67  void get_class_attributes (heap_cache_attrinfo &attrinfo, attribute_type attr_type, or_attribute *&or_attributes,
68  int *n_attributes);
69  };
70 
72  {
73  public:
74  server_object_loader () = delete;
76  ~server_object_loader () override = default;
77 
78  void init (class_id clsid) override;
79  void destroy () override;
80 
81  void start_line (int object_id) override;
82  void process_line (constant_type *cons) override;
83  void finish_line () override;
84  void flush_records () override;
85 
86  std::size_t get_rows_number () override;
87 
88  private:
89  int process_constant (constant_type *cons, const attribute &attr);
90  int process_generic_constant (constant_type *cons, const attribute &attr);
91  int process_monetary_constant (constant_type *cons, const attribute &attr);
92  int process_collection_constant (constant_type *cons, const attribute &attr);
93 
94  void clear_db_values ();
95  db_value &get_attribute_db_value (size_t attr_index);
96 
97  void start_scancache (const OID &class_oid);
98  void stop_scancache ();
99 
100  void start_attrinfo (const OID &class_oid);
101  void stop_attrinfo ();
102 
103  session &m_session;
104  error_handler &m_error_handler;
106 
108 
112  std::vector<db_value> m_db_values;
113  std::vector<record_descriptor> m_recdes_collected;
114 
117 
118  std::size_t m_rows;
119  };
120 
121 } // namespace cubload
122 #endif /* _LOAD_SERVER_LOADER_HPP_ */
void register_class_with_attributes(const char *class_name, class_command_spec_type *cmd_spec)
void check_class(const char *class_name, int class_id) override
void get_class_attributes(heap_cache_attrinfo &attrinfo, attribute_type attr_type, or_attribute *&or_attributes, int *n_attributes)
std::vector< db_value > m_db_values
int install_class(const char *class_name) override
~server_class_installer() override=default
LC_FIND_CLASSNAME locate_class(const char *class_name, OID &class_oid)
void set_class_id(class_id clsid) override
LC_FIND_CLASSNAME
std::vector< record_descriptor > m_recdes_collected
void to_lowercase_identifier(const char *idname, cubmem::extensible_block &eb)
bool is_class_ignored(const char *classname)
int class_id
Definition: load_common.hpp:40