CUBRID Engine
latest
|
#include "config.h"
#include <stdio.h>
#include <fcntl.h>
#include <assert.h>
#include <unistd.h>
#include <ctype.h>
#include <sys/stat.h>
#include <math.h>
#include "utility.h"
#include "misc_string.h"
#include "memory_alloc.h"
#include "dbtype.h"
#include "object_representation.h"
#include "work_space.h"
#include "class_object.h"
#include "object_primitive.h"
#include "set_object.h"
#include "db.h"
#include "schema_manager.h"
#include "server_interface.h"
#include "load_object.h"
#include "db_value_printer.hpp"
#include "network_interface_cl.h"
#include "printer.hpp"
#include "message_catalog.h"
#include "string_opfunc.h"
Go to the source code of this file.
Macros | |
#define | MIGRATION_CHUNK 4096 |
#define | MAX_DISPLAY_COLUMN 70 |
#define | DBL_MAX_DIGITS ((int)ceil(DBL_MAX_EXP * log10(FLT_RADIX))) |
#define | BITS_IN_BYTE 8 |
#define | HEX_IN_BYTE 2 |
#define | BITS_IN_HEX 4 |
#define | BYTE_COUNT(bit_cnt) (((bit_cnt)+BITS_IN_BYTE-1)/BITS_IN_BYTE) |
#define | BYTE_COUNT_HEX(bit_cnt) (((bit_cnt)+BITS_IN_HEX-1)/BITS_IN_HEX) |
#define | INTERNAL_BUFFER_SIZE (400) /* bigger than DBL_MAX_DIGITS */ |
Functions | |
static int | object_disk_size (DESC_OBJ *obj, int *offset_size_ptr) |
static void | put_varinfo (OR_BUF *buf, DESC_OBJ *obj, int offset_size) |
static void | put_attributes (OR_BUF *buf, DESC_OBJ *obj) |
static void | get_desc_current (OR_BUF *buf, SM_CLASS *class_, DESC_OBJ *obj, int bound_bit_flag, int offset_size) |
static SM_ATTRIBUTE * | find_current_attribute (SM_CLASS *class_, int id) |
static void | get_desc_old (OR_BUF *buf, SM_CLASS *class_, int repid, DESC_OBJ *obj, int bound_bit_flag, int offset_size) |
static void | print_set (print_output &output_ctx, DB_SET *set) |
static int | fprint_special_set (TEXT_OUTPUT *tout, DB_SET *set) |
static int | bfmt_print (int bfmt, const DB_VALUE *the_db_bit, char *string, int max_size) |
static const char * | strnchr (const char *str, char ch, int nbytes) |
static int | print_quoted_str (TEXT_OUTPUT *tout, const char *str, int len, int max_token_len) |
static void | itoa_strreverse (char *begin, char *end) |
static int | itoa_print (TEXT_OUTPUT *tout, DB_BIGINT value, int base) |
static int | fprint_special_strings (TEXT_OUTPUT *tout, DB_VALUE *value) |
static void | init_load_err_filter (void) |
static void | default_clear_err_filter (void) |
DESC_OBJ * | make_desc_obj (SM_CLASS *class_) |
void | desc_free (DESC_OBJ *obj) |
int | text_print_flush (TEXT_OUTPUT *tout) |
int | text_print (TEXT_OUTPUT *tout, const char *buf, int buflen, char const *fmt,...) |
int | desc_obj_to_disk (DESC_OBJ *obj, RECDES *record, bool *index_flag) |
int | desc_disk_to_obj (MOP classop, SM_CLASS *class_, RECDES *record, DESC_OBJ *obj) |
int | desc_value_special_fprint (TEXT_OUTPUT *tout, DB_VALUE *value) |
void | desc_value_print (print_output &output_ctx, DB_VALUE *value) |
int | er_filter_fileset (FILE *ef) |
int | er_filter_errid (bool ignore_warning) |
void | get_ignored_errors (std::vector< int > &vec) |
Variables | |
static char | migration_buffer [MIGRATION_CHUNK] |
static bool | filter_ignore_errors [-ER_LAST_ERROR] = { false, } |
static bool | filter_ignore_init = false |
#define BITS_IN_BYTE 8 |
Definition at line 1103 of file load_object.c.
#define BITS_IN_HEX 4 |
Definition at line 1105 of file load_object.c.
Referenced by bfmt_print().
#define BYTE_COUNT | ( | bit_cnt | ) | (((bit_cnt)+BITS_IN_BYTE-1)/BITS_IN_BYTE) |
Definition at line 1106 of file load_object.c.
Referenced by bfmt_print().
#define BYTE_COUNT_HEX | ( | bit_cnt | ) | (((bit_cnt)+BITS_IN_HEX-1)/BITS_IN_HEX) |
Definition at line 1107 of file load_object.c.
Referenced by bfmt_print().
#define DBL_MAX_DIGITS ((int)ceil(DBL_MAX_EXP * log10(FLT_RADIX))) |
Definition at line 1101 of file load_object.c.
#define HEX_IN_BYTE 2 |
Definition at line 1104 of file load_object.c.
#define INTERNAL_BUFFER_SIZE (400) /* bigger than DBL_MAX_DIGITS */ |
Definition at line 1265 of file load_object.c.
Referenced by fprint_special_strings().
#define MAX_DISPLAY_COLUMN 70 |
Definition at line 1100 of file load_object.c.
Referenced by fprint_special_strings().
#define MIGRATION_CHUNK 4096 |
Definition at line 60 of file load_object.c.
Definition at line 1110 of file load_object.c.
References BITS_IN_HEX, BYTE_COUNT, BYTE_COUNT_HEX, db_get_bit(), error(), and NO_ERROR.
Referenced by fprint_special_strings().
|
static |
Definition at line 1664 of file load_object.c.
References ER_BO_NOTIFY_AUTO_VOLEXT, ER_DISK_ALMOST_OUT_OF_SPACE, ER_DISK_TEMP_LAST_ALMOST_OUT_OF_SPACE, and filter_ignore_errors.
Referenced by er_filter_fileset().
Definition at line 930 of file load_object.c.
References ARG_FILE_LINE, desc_obj::classop, desc_obj::count, recdes::data, or_buf::env, ER_ERROR_SEVERITY, ER_FAILED, er_set(), ER_TF_BUFFER_UNDERFLOW, error(), or_buf::error_abort, get_desc_current(), get_desc_old(), i, recdes::length, NO_ERROR, NULL, or_advance(), OR_BOUND_BIT_FLAG, OR_GET_OFFSET_SIZE, or_init(), OR_INT_SIZE, OR_MVCC_FLAG_MASK, OR_MVCC_FLAG_SHIFT_BITS, OR_MVCC_FLAG_VALID_DELID, OR_MVCC_FLAG_VALID_INSID, OR_MVCC_FLAG_VALID_PREV_VERSION, or_mvcc_get_repid_and_flags(), OR_MVCC_PREV_VERSION_LSA_SIZE, OR_MVCC_REPID_MASK, OR_MVCCID_SIZE, pr_clear_value(), pr_Inhibit_oid_promotion, or_buf::ptr, rc, sm_class::repid, and desc_obj::values.
Referenced by process_class().
void desc_free | ( | DESC_OBJ * | obj | ) |
Definition at line 138 of file load_object.c.
References desc_obj::atts, desc_obj::count, free_and_init, i, NULL, pr_clear_value(), and desc_obj::values.
Referenced by process_class().
Definition at line 532 of file load_object.c.
References recdes::area_size, assert, or_buf::buffer, desc_obj::class_, classobj_class_has_indexes(), desc_obj::classop, recdes::data, or_buf::env, error(), or_buf::error_abort, sm_class::fixed_count, recdes::length, MIGDB_MSG_TEMPORARY_CLASS_OID, MSGCAT_CATALOG_UTILS, msgcat_message(), MSGCAT_UTIL_SET_MIGDB, MVCCID_NULL, object_disk_size(), OID_ISTEMP, OR_BOUND_BIT_FLAG, or_init(), OR_MVCC_FLAG_SHIFT_BITS, OR_MVCC_FLAG_VALID_INSID, OR_MVCC_INSERT_HEADER_SIZE, OR_MVCC_MAX_HEADER_SIZE, or_put_bigint(), or_put_int(), OR_SET_VAR_OFFSET_SIZE, or_buf::ptr, put_attributes(), put_varinfo(), sm_class::repid, and WS_OID.
Referenced by disk_update_instance().
void desc_value_print | ( | print_output & | output_ctx, |
DB_VALUE * | value | ||
) |
Definition at line 1616 of file load_object.c.
References db_get_set(), db_print_value(), DB_TYPE_BLOB, DB_TYPE_CLOB, DB_TYPE_MULTISET, DB_TYPE_SEQUENCE, DB_TYPE_SET, DB_VALUE_TYPE, MIGDB_MSG_CANT_PRINT_ELO, MSGCAT_CATALOG_UTILS, msgcat_message(), MSGCAT_UTIL_SET_MIGDB, and print_set().
Referenced by emit_attribute_def(), emit_partition_parts(), emit_stored_procedure(), emit_stored_procedure_args(), export_serial(), and print_set().
int desc_value_special_fprint | ( | TEXT_OUTPUT * | tout, |
DB_VALUE * | value | ||
) |
Definition at line 1575 of file load_object.c.
References CHECK_EXIT_ERROR, CHECK_PRINT_ERROR, db_get_set(), DB_TYPE_BLOB, DB_TYPE_CLOB, DB_TYPE_MULTISET, DB_TYPE_SEQUENCE, DB_TYPE_SET, DB_VALUE_TYPE, error(), fprint_special_set(), fprint_special_strings(), MIGDB_MSG_CANT_PRINT_ELO, MSGCAT_CATALOG_UTILS, msgcat_message(), MSGCAT_UTIL_SET_MIGDB, and NO_ERROR.
Referenced by fprint_special_set(), and process_value().
int er_filter_errid | ( | bool | ignore_warning | ) |
Definition at line 1759 of file load_object.c.
References er_clearid(), er_errid(), er_get_severity(), ER_WARNING_SEVERITY, filter_ignore_errors, filter_ignore_init, init_load_err_filter(), and NO_ERROR.
Referenced by cubload::sa_object_loader::destroy(), cubload::sa_object_loader::finish_line(), ldr_act_add_class_all_attrs(), ldr_finish_context(), ldr_refresh_attrs(), and ldr_reset_context().
int er_filter_fileset | ( | FILE * | ef | ) |
Definition at line 1680 of file load_object.c.
References default_clear_err_filter(), ER_LAST_ERROR, filter_ignore_errors, filter_ignore_init, i, init_load_err_filter(), NULL, and ws_set_ignore_error_list_for_mflush().
Referenced by loaddb_internal().
|
static |
Definition at line 708 of file load_object.c.
References sm_class::attributes, sm_attribute::header, sm_attribute::id, sm_component::next, and NULL.
Referenced by get_desc_old().
|
static |
Definition at line 1058 of file load_object.c.
References CHECK_EXIT_ERROR, CHECK_PRINT_ERROR, desc_value_special_fprint(), error(), i, NO_ERROR, NULL, set_get_element(), set_size(), and text_print().
Referenced by desc_value_special_fprint().
|
static |
Definition at line 1360 of file load_object.c.
References ARG_FILE_LINE, bfmt_print(), text_output::buffer, CHECK_EXIT_ERROR, CHECK_PRINT_ERROR, text_output::count, db_datetimetz::datetime, db_date_to_string(), db_datetime_to_string(), db_datetimeltz_to_string(), db_datetimetz_to_string(), db_get_bigint(), db_get_date(), db_get_datetime(), db_get_datetimetz(), db_get_double(), db_get_enum_short(), db_get_error(), db_get_float(), db_get_int(), db_get_json_raw_body(), db_get_monetary(), db_get_pointer(), db_get_short(), db_get_string(), db_get_string_length(), db_get_string_size(), db_get_time(), db_get_timestamp(), db_get_timestamptz(), db_private_free, db_time_to_string(), db_timestamp_to_string(), db_timestampltz_to_string(), db_timestamptz_to_string(), DB_TYPE_BIGINT, DB_TYPE_BIT, DB_TYPE_CHAR, DB_TYPE_DATE, DB_TYPE_DATETIME, DB_TYPE_DATETIMELTZ, DB_TYPE_DATETIMETZ, DB_TYPE_DOUBLE, DB_TYPE_ENUMERATION, DB_TYPE_ERROR, DB_TYPE_FLOAT, DB_TYPE_INTEGER, DB_TYPE_JSON, DB_TYPE_MONETARY, DB_TYPE_NCHAR, DB_TYPE_NULL, DB_TYPE_NUMERIC, DB_TYPE_POINTER, DB_TYPE_SMALLINT, DB_TYPE_TIME, DB_TYPE_TIMESTAMP, DB_TYPE_TIMESTAMPLTZ, DB_TYPE_TIMESTAMPTZ, DB_TYPE_VARBIT, DB_TYPE_VARCHAR, DB_TYPE_VARNCHAR, DB_VALUE_TYPE, ER_ERROR_SEVERITY, ER_OUT_OF_VIRTUAL_MEMORY, er_set(), error(), free_and_init, INTERNAL_BUFFER_SIZE, intl_get_money_esc_ISO_symbol(), text_output::iosize, itoa_print(), MAX_DISPLAY_COLUMN, NO_ERROR, NULL, numeric_db_value_print(), print_quoted_str(), text_output::ptr, strlen, text_print(), text_print_flush(), db_timestamptz::timestamp, db_timestamptz::tz_id, and db_datetimetz::tz_id.
Referenced by desc_value_special_fprint().
|
static |
Definition at line 623 of file load_object.c.
References sm_class::attributes, desc_obj::class_, db_value_put_null(), db_value::domain, sm_class::fixed_count, sm_class::fixed_size, free_and_init, sm_attribute::header, i, INT_ALIGNMENT, sm_component::next, NO_ERROR, NULL, or_advance(), OR_BOUND_BIT_BYTES, OR_GET_BOUND_BIT, or_get_offset_internal(), or_buf::ptr, PTR_ALIGN, rc, tp_domain_disk_size(), desc_obj::values, and sm_class::variable_count.
Referenced by desc_disk_to_obj().
|
static |
Definition at line 738 of file load_object.c.
References ARG_FILE_LINE, sm_repr_attribute::attid, sm_representation::attributes, sm_class::attributes, classobj_find_representation(), pr_type::data_readval(), DB_ATT_ALIGN, db_value_clear(), db_value_put_null(), sm_attribute::default_value, db_value::domain, or_buf::endptr, ER_ERROR_SEVERITY, er_set(), ER_TF_INVALID_REPRESENTATION, find_current_attribute(), sm_representation::fixed_count, free_and_init, sm_attribute::header, i, sm_attribute::id, INT_ALIGNMENT, sm_component::next, sm_repr_attribute::next, NO_ERROR, NULL, or_abort(), or_advance(), OR_BOUND_BIT_BYTES, OR_GET_BOUND_BIT, or_get_offset_internal(), or_overflow(), sm_default_value::original_value, pr_clone_value(), pr_type_from_id(), or_buf::ptr, PTR_ALIGN, rc, sm_ch_name(), sm_attribute::storage_order, desc_obj::updated_flag, desc_obj::values, and sm_representation::variable_count.
Referenced by desc_disk_to_obj().
void get_ignored_errors | ( | std::vector< int > & | vec | ) |
Definition at line 1801 of file load_object.c.
References ER_LAST_ERROR, filter_ignore_errors, and i.
Referenced by loaddb_internal().
|
static |
Definition at line 1645 of file load_object.c.
References ER_BO_NOTIFY_AUTO_VOLEXT, ER_DISK_ALMOST_OUT_OF_SPACE, ER_DISK_TEMP_LAST_ALMOST_OUT_OF_SPACE, ER_LOG_MAX_ARCHIVES_HAS_BEEN_EXCEEDED, filter_ignore_errors, and filter_ignore_init.
Referenced by er_filter_errid(), and er_filter_fileset().
|
static |
Definition at line 1297 of file load_object.c.
References CAST_STRLEN, CHECK_EXIT_ERROR, text_output::count, error(), itoa_strreverse(), NO_ERROR, and text_output::ptr.
Referenced by fprint_special_strings().
|
static |
Definition at line 1274 of file load_object.c.
References begin().
Referenced by itoa_print().
Definition at line 87 of file load_object.c.
References sm_class::att_count, sm_class::attributes, desc_obj::atts, desc_obj::class_, desc_obj::classop, desc_obj::count, db_make_null(), free_and_init, sm_attribute::header, i, sm_component::next, NULL, desc_obj::updated_flag, and desc_obj::values.
Referenced by process_class().
|
static |
Definition at line 169 of file load_object.c.
References sm_class::attributes, desc_obj::atts, BIG_VAR_OFFSET_SIZE, desc_obj::class_, desc_obj::count, cubregex::count(), DB_IS_NULL, sm_attribute::default_value, sm_attribute::domain, sm_class::fixed_count, sm_class::fixed_size, i, OR_BOUND_BIT_BYTES, OR_BYTE_SIZE, OR_MAX_BYTE, OR_MAX_SHORT, OR_MVCC_INSERT_HEADER_SIZE, OR_SHORT_SIZE, OR_VAR_TABLE_SIZE_INTERNAL, pr_data_writeval_disk_size(), tp_domain_disk_size(), sm_attribute::type, sm_default_value::value, desc_obj::values, sm_class::variable_count, and pr_type::variable_p.
Referenced by desc_obj_to_disk().
|
static |
Definition at line 1212 of file load_object.c.
References CAST_STRLEN, CHECK_EXIT_ERROR, CHECK_PRINT_ERROR, error(), NO_ERROR, NULL, p, strnchr(), and text_print().
Referenced by fprint_special_strings().
|
static |
Definition at line 1029 of file load_object.c.
References desc_value_print(), i, NO_ERROR, set_get_element(), and set_size().
Referenced by desc_value_print().
Definition at line 314 of file load_object.c.
References ARG_FILE_LINE, sm_class::attributes, desc_obj::atts, desc_obj::class_, desc_obj::count, cubregex::count(), DB_IS_NULL, sm_attribute::default_value, sm_attribute::domain, ER_ERROR_SEVERITY, er_set(), ER_SM_CORRUPTED, error(), sm_class::fixed_count, sm_class::fixed_size, free_and_init, sm_attribute::header, i, sm_component::next, NULL, or_abort(), OR_BOUND_BIT_BYTES, OR_ENABLE_BOUND_BIT, or_pad(), or_put_data(), pr_data_writeval(), or_buf::ptr, sm_attribute::storage_order, tp_domain_disk_size(), sm_attribute::type, sm_default_value::value, desc_obj::values, and pr_type::variable_p.
Referenced by desc_obj_to_disk().
Definition at line 246 of file load_object.c.
References sm_class::attributes, desc_obj::atts, desc_obj::class_, desc_obj::count, cubregex::count(), DB_IS_NULL, sm_attribute::default_value, sm_attribute::domain, sm_class::fixed_count, sm_class::fixed_size, i, INT_ALIGNMENT, OR_BOUND_BIT_BYTES, or_put_offset_internal(), OR_VAR_TABLE_SIZE_INTERNAL, pr_data_writeval_disk_size(), or_buf::ptr, PTR_ALIGN, tp_domain_disk_size(), sm_attribute::type, sm_default_value::value, desc_obj::values, sm_class::variable_count, and pr_type::variable_p.
Referenced by desc_obj_to_disk().
Definition at line 1188 of file load_object.c.
References NULL.
Referenced by print_quoted_str().
int text_print | ( | TEXT_OUTPUT * | tout, |
const char * | buf, | ||
int | buflen, | ||
char const * | fmt, | ||
... | |||
) |
Definition at line 467 of file load_object.c.
References assert, CHECK_EXIT_ERROR, CHECK_PRINT_ERROR, text_output::count, error(), text_output::iosize, NO_ERROR, NULL, text_output::ptr, and text_print_flush().
Referenced by extract_objects(), fprint_special_set(), fprint_special_strings(), print_quoted_str(), process_class(), process_object(), process_set(), and process_value().
int text_print_flush | ( | TEXT_OUTPUT * | tout | ) |
Definition at line 442 of file load_object.c.
References text_output::buffer, text_output::count, ER_IO_WRITE, text_output::fp, NO_ERROR, and text_output::ptr.
Referenced by extract_objects(), fprint_special_strings(), and text_print().
|
static |
Definition at line 1637 of file load_object.c.
Referenced by default_clear_err_filter(), er_filter_errid(), er_filter_fileset(), get_ignored_errors(), and init_load_err_filter().
|
static |
Definition at line 1639 of file load_object.c.
Referenced by er_filter_errid(), er_filter_fileset(), and init_load_err_filter().
|
static |
Definition at line 61 of file load_object.c.