48 , m_error_handler (error_handler)
149 std::string classname (lower_case_class_name);
158 if (is_syntax_check_only)
172 assert (attrinfo.num_values != -1);
189 int n_attributes = -1;
197 std::vector<int> attrib_order (n_attributes);
198 for (
size_t i = 0;
i < attrib_order.size (); ++
i)
202 std::sort (attrib_order.begin (), attrib_order.end (), [or_attributes] (
int a,
int b)
208 std::map<std::string, or_attribute *> attr_map;
209 std::vector<const attribute *> attributes;
210 attributes.reserve ((std::size_t) n_attributes);
212 for (std::size_t attr_index = 0; attr_index < (std::size_t) n_attributes; ++attr_index)
214 char *attr_name =
NULL;
215 int free_attr_name = 0;
218 attr_repr = &or_attributes[attrib_order[attr_index]];
220 error_code =
or_get_attrname (&recdes, attr_repr->
id, &attr_name, &free_attr_name);
229 std::string attr_name_ (attr_name);
230 if (cmd_spec ==
NULL)
236 attributes.push_back (attr);
240 attr_map.insert (std::make_pair (attr_name_, attr_repr));
244 if (attr_name !=
NULL && free_attr_name == 1)
251 std::size_t attr_index = 0;
253 for (; str_attr !=
NULL; str_attr = str_attr->
next, ++attr_index)
259 auto found = attr_map.find (attr_name_);
260 if (found == attr_map.end ())
274 attributes.push_back (attr);
275 attr_map.erase (attr_name_);
279 for (
const std::pair<const std::string, or_attribute *> &attr : attr_map)
281 if (attr.second->is_notnull)
283 char class_attr[512];
285 snprintf (class_attr, 512,
"%s.%s", class_name, attr.first.c_str ());
296 return a->
get_index () < b->get_index ();
313 or_attributes = attrinfo.last_classrepr->class_attrs;
314 *n_attributes = attrinfo.last_classrepr->n_class_attrs;
318 or_attributes = attrinfo.last_classrepr->shared_attrs;
319 *n_attributes = attrinfo.last_classrepr->n_shared_attrs;
323 or_attributes = attrinfo.last_classrepr->attributes;
324 *n_attributes = attrinfo.last_classrepr->n_attributes;
330 assert (*n_attributes >= 0);
348 std::string class_name (eb.
get_ptr ());
350 auto result = std::find (classes_ignored.begin (), classes_ignored.end (), class_name);
352 is_ignored = (result != classes_ignored.end ());
369 , m_thread_ref (
NULL)
371 , m_class_entry (
NULL)
372 , m_attrinfo_started (false)
375 , m_recdes_collected ()
376 , m_scancache_started (false)
437 std::size_t attr_index = 0;
440 if (cons !=
NULL && attr_size == 0)
449 if (attr_index == attr_size)
473 if (attr_index < attr_size)
490 if (!is_syntax_check_only)
524 int pruning_type = 0;
526 int records_inserted = 0;
527 bool insert_errors_filtered =
false;
558 if (insert_errors_filtered)
566 &dummy_oid, &local_record,
true, op_type, &
m_scancache, &force_count,
658 const char *class_name;
663 class_name = str->
val;
695 size_t str_size = str !=
NULL ? str->
size : 0;
700 int error_code = func (token, str_size, &attr, &db_val);
707 char class_attr[512];
725 char *full_mon_str_p = full_mon_str;
729 size_t full_mon_str_len = (str->
size +
strlen (curr_str));
731 if (full_mon_str_len >=
sizeof (full_mon_str))
733 full_mon_str_p =
new char[full_mon_str_len + 1];
736 std::strcpy (full_mon_str_p, curr_str);
737 std::strcat (full_mon_str_p, str->
val);
742 error_code = func (full_mon_str_p, full_mon_str_len, &attr, &db_val);
748 char class_attr[512];
757 if (full_mon_str_p != full_mon_str)
759 delete [] full_mon_str_p;
846 for (
size_t i = 0;
i < n_values; ++
i)
901 if (!it.second.is_unique ())
#define ER_SM_ATTRIBUTE_NOT_FOUND
void heap_scancache_end_modify(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache)
error_handler & m_error_handler
cubthread::entry * thread_get_thread_entry_info(void)
void on_syntax_failure(bool use_scanner_line=false)
bool current_line_has_error()
void register_class_with_attributes(const char *class_name, class_command_spec_type *cmd_spec)
#define ER_LDR_SHARED_NOT_SUPPORTED
int heap_scancache_start_modify(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache, const HFID *hfid, const OID *class_oid, int op_type, MVCC_SNAPSHOT *mvcc_snapshot)
#define TP_IS_SET_TYPE(typenum)
void check_class(const char *class_name, int class_id) override
void set_free(DB_COLLECTION *set)
#define ER_LDR_CLASS_NOT_SUPPORTED
multi_index_unique_stats * m_index_stats
void log_date_time_conversion_error(Args &&...args)
int process_collection_constant(constant_type *cons, const attribute &attr)
void log_sysop_start(THREAD_ENTRY *thread_p)
int heap_scancache_quick_start_root_hfid(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache)
void start_line(int object_id) override
#define OID_SET_NULL(oidp)
void get_class_attributes(heap_cache_attrinfo &attrinfo, attribute_type attr_type, or_attribute *&or_attributes, int *n_attributes)
DB_COLLECTION * set_create_with_domain(TP_DOMAIN *domain, int initial_size)
const char * get_class_name() const
void init(class_id clsid) override
const block_allocator STANDARD_BLOCK_ALLOCATOR
int heap_scancache_end(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache)
std::vector< db_value > m_db_values
void start_scancache(const OID &class_oid)
heap_cache_attrinfo m_attrinfo
void register_class(const char *class_name, class_id clsid, OID class_oid, std::vector< const attribute * > &attributes)
const class_entry * get_class_entry(class_id clsid)
db_value & get_attribute_db_value(size_t attr_index)
int intl_identifier_lower(const char *src, char *dst)
server_object_loader()=delete
void append_log_msg(MSGCAT_LOADDB_MSG msg_id, Args &&...args)
int heap_attrinfo_start(THREAD_ENTRY *thread_p, const OID *class_oid, int requested_num_attrs, const ATTR_ID *attrids, HEAP_CACHE_ATTRINFO *attr_info)
void er_set(int severity, const char *file_name, const int line_no, int err_id, int num_args,...)
const attribute & get_attribute(std::size_t index) const
conv_func & get_conv_func(const data_type ldr_type, const DB_TYPE db_type)
int set_add_element(DB_COLLECTION *set, DB_VALUE *value)
std::size_t get_rows_number() override
class_registry & get_class_registry()
LC_FIND_CLASSNAME xlocator_find_class_oid(THREAD_ENTRY *thread_p, const char *classname, OID *class_oid, LOCK lock)
int install_class(const char *class_name) override
const tp_domain & get_domain() const
void start_attrinfo(const OID &class_oid)
cubload::driver * m_loaddb_driver
#define ER_LDR_MISSING_ATTRIBUTES
cubthread::entry * m_thread_ref
void register_ignored_class(class_entry *cls_entry, class_id cls_id)
#define IS_OLD_GLO_CLASS(class_name)
LC_FIND_CLASSNAME locate_class(const char *class_name, OID &class_oid)
const load_args & get_args()
int heap_attrinfo_clear_dbvalues(HEAP_CACHE_ATTRINFO *attr_info)
#define ER_OBJ_ATTRIBUTE_CANT_BE_NULL
heap_scancache m_scancache
const char * get_read_ptr() const
std::size_t get_index() const
const char * pr_type_name(DB_TYPE id)
void set_class_id(class_id clsid) override
#define db_private_free_and_init(thrd, ptr)
std::vector< record_descriptor > m_recdes_collected
int logtb_tran_update_unique_stats(THREAD_ENTRY *thread_p, const BTID *btid, int n_keys, int n_oids, int n_nulls, bool write_to_log)
int process_monetary_constant(constant_type *cons, const attribute &attr)
bool has_errors_filtered_for_insert(std::vector< int > error_filter_array)
void log_sysop_abort(THREAD_ENTRY *thread_p)
#define ER_DATE_CONVERSION
error_handler & m_error_handler
static void error(const char *msg)
#define ER_LDR_NESTED_SET
void finish_line() override
void to_lowercase_identifier(const char *idname, cubmem::extensible_block &eb)
void on_failure_with_line(MSGCAT_LOADDB_MSG msg_id, Args &&...args)
bool is_class_ignored(const char *classname)
int intl_identifier_lower_string_size(const char *src)
int db_make_collection(DB_VALUE *value, DB_C_SET *set)
#define ER_LDR_DOMAIN_MISMATCH
int or_get_attrname(RECDES *record, int attrid, char **string, int *alloced_string)
int locator_multi_insert_force(THREAD_ENTRY *thread_p, HFID *hfid, OID *class_oid, const std::vector< record_descriptor > &recdes, int has_index, int op_type, HEAP_SCANCACHE *scan_cache, int *force_count, int pruning_type, PRUNING_CONTEXT *pcontext, FUNC_PRED_UNPACK_INFO *func_preds, UPDATE_INPLACE_STYLE force_in_place, bool dont_check_fk)
const class_id NULL_CLASS_ID
const char * get_name() const
int process_generic_constant(constant_type *cons, const attribute &attr)
const char * get_name() const
SCAN_CODE heap_attrinfo_transform_to_disk_except_lob(THREAD_ENTRY *thread_p, HEAP_CACHE_ATTRINFO *attr_info, RECDES *old_recdes, record_descriptor *new_recdes)
void set_error_on_current_line(bool has_error)
void log_sysop_attach_to_outer(THREAD_ENTRY *thread_p)
size_t get_attributes_size() const
const container_type & get_map() const
const class_entry * m_class_entry
void process_line(constant_type *cons) override
int locator_insert_force(THREAD_ENTRY *thread_p, HFID *hfid, OID *class_oid, OID *oid, RECDES *recdes, int has_index, int op_type, HEAP_SCANCACHE *scan_cache, int *force_count, int pruning_type, PRUNING_CONTEXT *pcontext, FUNC_PRED_UNPACK_INFO *func_preds, UPDATE_INPLACE_STYLE force_in_place, PGBUF_WATCHER *home_hint_p, bool has_BU_lock, bool dont_check_fk, bool use_bulk_logging)
void extend_to(size_t total_bytes)
#define ER_LDR_VALUE_OVERFLOW
int lock_has_lock_on_object(const OID *oid, const OID *class_oid, LOCK lock)
std::vector< std::string > ignore_classes
int db_value_clear(DB_VALUE *value)
void heap_attrinfo_end(THREAD_ENTRY *thread_p, HEAP_CACHE_ATTRINFO *attr_info)
void stats_update_current_line(int64_t current_line)
void flush_records() override
int heap_attrinfo_set(const OID *inst_oid, ATTR_ID attrid, DB_VALUE *attr_val, HEAP_CACHE_ATTRINFO *attr_info)
int heap_get_class_info(THREAD_ENTRY *thread_p, const OID *class_oid, HFID *hfid_out, FILE_TYPE *ftype_out, char **classname_out)
server_class_installer()=delete
int(* conv_func)(const char *, const size_t, const attribute *, db_value *)
const or_attribute & get_repr() const
#define ER_LDR_NO_CLASS_OR_NO_ATTRIBUTE
const OID & get_class_oid() const
void on_error_with_line(MSGCAT_LOADDB_MSG msg_id, Args &&...args)
int process_constant(constant_type *cons, const attribute &attr)
std::vector< int > m_ignored_errors
#define BTREE_SET_UNIQUE_VIOLATION_ERROR(THREAD, KEY, OID, C_OID, BTID, BTNM)
char * intl_get_money_esc_ISO_symbol(const DB_CURRENCY currency)
SCAN_CODE heap_get_class_record(THREAD_ENTRY *thread_p, const OID *class_oid, RECDES *recdes_p, HEAP_SCANCACHE *scan_cache, int ispeeking)