CUBRID Engine  latest
load_object.c File Reference
#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_ATTRIBUTEfind_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_OBJmake_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
 

Macro Definition Documentation

#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.

Function Documentation

static int bfmt_print ( int  bfmt,
const DB_VALUE the_db_bit,
char *  string,
int  max_size 
)
static

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().

Here is the caller graph for this function:

static void default_clear_err_filter ( void  )
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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

static SM_ATTRIBUTE * find_current_attribute ( SM_CLASS class_,
int  id 
)
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().

Here is the caller graph for this function:

static int fprint_special_set ( TEXT_OUTPUT tout,
DB_SET set 
)
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().

Here is the caller graph for this function:

static int fprint_special_strings ( TEXT_OUTPUT tout,
DB_VALUE value 
)
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().

Here is the caller graph for this function:

static void get_desc_current ( OR_BUF buf,
SM_CLASS class_,
DESC_OBJ obj,
int  bound_bit_flag,
int  offset_size 
)
static
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().

Here is the caller graph for this function:

static void init_load_err_filter ( void  )
static
static int itoa_print ( TEXT_OUTPUT tout,
DB_BIGINT  value,
int  base 
)
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().

Here is the caller graph for this function:

static void itoa_strreverse ( char *  begin,
char *  end 
)
static

Definition at line 1274 of file load_object.c.

References begin().

Referenced by itoa_print().

Here is the caller graph for this function:

static int print_quoted_str ( TEXT_OUTPUT tout,
const char *  str,
int  len,
int  max_token_len 
)
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().

Here is the caller graph for this function:

static void print_set ( print_output output_ctx,
DB_SET set 
)
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().

Here is the caller graph for this function:

static const char * strnchr ( const char *  str,
char  ch,
int  nbytes 
)
static

Definition at line 1188 of file load_object.c.

References NULL.

Referenced by print_quoted_str().

Here is the caller graph for this function:

int text_print ( TEXT_OUTPUT tout,
const char *  buf,
int  buflen,
char const fmt,
  ... 
)
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().

Here is the caller graph for this function:

Variable Documentation

bool filter_ignore_errors[-ER_LAST_ERROR] = { false, }
static
bool filter_ignore_init = false
static

Definition at line 1639 of file load_object.c.

Referenced by er_filter_errid(), er_filter_fileset(), and init_load_err_filter().

char migration_buffer[MIGRATION_CHUNK]
static

Definition at line 61 of file load_object.c.