CUBRID Engine  latest
cubload Namespace Reference

Classes

class  attribute
 
class  batch
 
struct  class_command_spec_type
 
class  class_entry
 
class  class_installer
 
class  class_registry
 
struct  constant_type
 
struct  constructor_spec_type
 
class  driver
 
class  error_handler
 
struct  load_args
 
class  load_status
 
class  load_task
 
struct  monetary_type
 
class  object_loader
 
struct  object_ref_type
 
class  sa_class_installer
 
class  sa_object_loader
 
class  scanner
 
class  semantic_helper
 
class  server_class_installer
 
class  server_object_loader
 
class  session
 
struct  stats
 
struct  string_type
 
class  worker_context_manager
 

Typedefs

using batch_id = int64_t
 
using class_id = int
 
using batch_handler = std::function< int64_t(const batch &)>
 
using class_handler = std::function< int64_t(const batch &, bool &)>
 
using conv_setters = std::array< std::array< conv_func, NUM_LDR_TYPES >, NUM_DB_TYPES >
 
typedef int(* conv_func) (const char *, const size_t, const attribute *, db_value *)
 

Enumerations

enum  data_type {
  LDR_NULL, LDR_INT, LDR_STR, LDR_NSTR,
  LDR_NUMERIC, LDR_DOUBLE, LDR_FLOAT, LDR_OID,
  LDR_CLASS_OID, LDR_DATE, LDR_TIME, LDR_TIMESTAMP,
  LDR_TIMESTAMPLTZ, LDR_TIMESTAMPTZ, LDR_COLLECTION, LDR_ELO_INT,
  LDR_ELO_EXT, LDR_SYS_USER, LDR_SYS_CLASS, LDR_MONETARY,
  LDR_BSTR, LDR_XSTR, LDR_DATETIME, LDR_DATETIMELTZ,
  LDR_DATETIMETZ, LDR_JSON, LDR_TYPE_MAX = LDR_JSON
}
 
enum  attribute_type { LDR_ATTRIBUTE_ANY = 0, LDR_ATTRIBUTE_SHARED, LDR_ATTRIBUTE_CLASS, LDR_ATTRIBUTE_DEFAULT }
 
enum  interrupt_type { LDR_NO_INTERRUPT, LDR_STOP_AND_ABORT_INTERRUPT, LDR_STOP_AND_COMMIT_INTERRUPT }
 

Functions

int handle_batch (batch_handler &handler, class_id clsid, std::string &batch_content, batch_id &batch_id, int64_t line_offset, int64_t &rows)
 
bool starts_with (const std::string &str, const std::string &prefix)
 
bool ends_with (const std::string &str, const std::string &suffix)
 
void rtrim (std::string &str)
 
int split (int batch_size, const std::string &object_file_name, class_handler &c_handler, batch_handler &b_handler)
 
int mismatch (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_null (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_short (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_int (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_int_set (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_bigint (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_generic_char (DB_TYPE type, const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_char (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_varchar (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_make_nchar (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_make_varnchar (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_string (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_float (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_double (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_numeric (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_date (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_time (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_timestamp (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_timestampltz (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_timestamptz (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_datetime (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_datetimeltz (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_datetimetz (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_json (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_monetary (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_varbit_from_bin_str (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_varbit_from_hex_str (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_elo_ext (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_db_elo_int (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
int to_int_generic (const char *str, const size_t str_size, const attribute *attr, db_value *val)
 
static conv_setters init_setters ()
 
conv_funcget_conv_func (const data_type ldr_type, const DB_TYPE db_type)
 
void init_driver (driver *driver, session &session)
 
bool invoke_parser (driver *driver, const batch &batch_)
 
bool worker_manager_try_task (cubthread::entry_task *task)
 
void worker_manager_register_session (session &load_session)
 
void worker_manager_unregister_session (session &load_session)
 
void worker_manager_stop_all ()
 
void worker_manager_get_stats (UINT64 *stats_out)
 

Variables

const class_id NULL_CLASS_ID = 0
 
const batch_id NULL_BATCH_ID = 0
 
const class_id FIRST_CLASS_ID = 1
 
const batch_id FIRST_BATCH_ID = 1
 
static conv_setters setters = init_setters ()
 
static const std::size_t STRING_POOL_SIZE = 1024
 
static const std::size_t MAX_COPY_BUF_SIZE = 256
 
static const std::size_t COPY_BUF_POOL_SIZE = 512
 
static const std::size_t CONSTANT_POOL_SIZE = 1024
 
static const std::size_t QUOTED_STR_BUF_POOL_SIZE = 512
 
static const std::size_t MAX_QUOTED_STR_BUF_SIZE = 32 * 1024
 
static std::mutex g_wp_mutex
 
static std::condition_variable g_wp_condvar
 
std::set< session * > g_active_sessions
 
static cubthread::entry_workpoolg_worker_pool
 
static worker_context_managerg_wp_context_manager
 
static cubthread::worker_pool_task_capper< cubthread::entry > * g_wp_task_capper
 

Typedef Documentation

using cubload::batch_handler = typedef std::function<int64_t (const batch &)>

Definition at line 77 of file load_common.hpp.

using cubload::batch_id = typedef int64_t

Definition at line 39 of file load_common.hpp.

using cubload::class_handler = typedef std::function<int64_t (const batch &, bool &)>

Definition at line 78 of file load_common.hpp.

using cubload::class_id = typedef int

Definition at line 40 of file load_common.hpp.

typedef int(* cubload::conv_func) (const char *, const size_t, const attribute *, db_value *)

Definition at line 34 of file load_db_value_converter.hpp.

using cubload::conv_setters = typedef std::array<std::array<conv_func, NUM_LDR_TYPES>, NUM_DB_TYPES>

Definition at line 80 of file load_db_value_converter.cpp.

Enumeration Type Documentation

Enumerator
LDR_ATTRIBUTE_ANY 
LDR_ATTRIBUTE_SHARED 
LDR_ATTRIBUTE_CLASS 
LDR_ATTRIBUTE_DEFAULT 

Definition at line 169 of file load_common.hpp.

Enumerator
LDR_NULL 
LDR_INT 
LDR_STR 
LDR_NSTR 
LDR_NUMERIC 
LDR_DOUBLE 
LDR_FLOAT 
LDR_OID 
LDR_CLASS_OID 
LDR_DATE 
LDR_TIME 
LDR_TIMESTAMP 
LDR_TIMESTAMPLTZ 
LDR_TIMESTAMPTZ 
LDR_COLLECTION 
LDR_ELO_INT 
LDR_ELO_EXT 
LDR_SYS_USER 
LDR_SYS_CLASS 
LDR_MONETARY 
LDR_BSTR 
LDR_XSTR 
LDR_DATETIME 
LDR_DATETIMELTZ 
LDR_DATETIMETZ 
LDR_JSON 
LDR_TYPE_MAX 

Definition at line 129 of file load_common.hpp.

Enumerator
LDR_NO_INTERRUPT 
LDR_STOP_AND_ABORT_INTERRUPT 
LDR_STOP_AND_COMMIT_INTERRUPT 

Definition at line 177 of file load_common.hpp.

Function Documentation

bool cubload::ends_with ( const std::string &  str,
const std::string &  suffix 
)
inline

Definition at line 780 of file load_common.cpp.

Referenced by split().

Here is the caller graph for this function:

conv_func & cubload::get_conv_func ( const data_type  ldr_type,
const DB_TYPE  db_type 
)

Definition at line 197 of file load_db_value_converter.cpp.

Referenced by cubload::server_object_loader::process_generic_constant(), and cubload::server_object_loader::process_monetary_constant().

Here is the caller graph for this function:

int cubload::handle_batch ( batch_handler handler,
class_id  clsid,
std::string &  batch_content,
batch_id batch_id,
int64_t  line_offset,
int64_t &  rows 
)

Definition at line 754 of file load_common.cpp.

References NO_ERROR.

Referenced by split().

Here is the caller graph for this function:

void cubload::init_driver ( driver driver,
session session 
)

Definition at line 46 of file load_session.cpp.

References assert, cubload::session::fail(), cubload::driver::initialize(), cubload::driver::is_initialized(), and NULL.

Referenced by cubload::load_task::execute(), and cubload::session::session().

Here is the caller graph for this function:

int cubload::mismatch ( const char *  str,
const size_t  str_size,
const attribute attr,
db_value val 
)

Definition at line 204 of file load_db_value_converter.cpp.

References ARG_FILE_LINE, ER_ERROR_SEVERITY, ER_OBJ_DOMAIN_CONFLICT, er_set(), and cubload::attribute::get_name().

Referenced by init_setters().

Here is the caller graph for this function:

void cubload::rtrim ( std::string &  str)
inline

Definition at line 786 of file load_common.cpp.

Referenced by cubload::load_args::parse_ignore_class_file(), and split().

Here is the caller graph for this function:

int cubload::split ( int  batch_size,
const std::string &  object_file_name,
class_handler c_handler,
batch_handler b_handler 
)

Definition at line 622 of file load_common.cpp.

References assert, ends_with(), ER_FILE_UNKNOWN_FILE, FIRST_CLASS_ID, handle_batch(), NO_ERROR, NULL_BATCH_ID, rtrim(), and starts_with().

Referenced by load_object_file().

Here is the caller graph for this function:

bool cubload::starts_with ( const std::string &  str,
const std::string &  prefix 
)
inline

Definition at line 774 of file load_common.cpp.

Referenced by split().

Here is the caller graph for this function:

int cubload::to_db_char ( const char *  str,
const size_t  str_size,
const attribute attr,
db_value val 
)

Definition at line 405 of file load_db_value_converter.cpp.

References DB_TYPE_CHAR, and to_db_generic_char().

Referenced by init_setters().

Here is the caller graph for this function:

int cubload::to_db_date ( const char *  str,
const size_t  str_size,
const attribute attr,
db_value val 
)

Definition at line 494 of file load_db_value_converter.cpp.

References db_value::data, db_data::date, db_make_date(), and db_string_to_date().

Referenced by init_setters().

Here is the caller graph for this function:

int cubload::to_db_datetime ( const char *  str,
const size_t  str_size,
const attribute attr,
db_value val 
)

Definition at line 540 of file load_db_value_converter.cpp.

References db_value::data, db_data::datetime, db_datetime_encode(), db_make_datetime(), and db_string_to_datetime().

Referenced by init_setters().

Here is the caller graph for this function:

int cubload::to_db_datetimeltz ( const char *  str,
const size_t  str_size,
const attribute attr,
db_value val 
)

Definition at line 551 of file load_db_value_converter.cpp.

References db_value::data, db_data::datetime, db_datetime_encode(), db_make_datetimeltz(), and db_string_to_datetimeltz().

Referenced by init_setters().

Here is the caller graph for this function:

int cubload::to_db_datetimetz ( const char *  str,
const size_t  str_size,
const attribute attr,
db_value val 
)
int cubload::to_db_double ( const char *  str,
const size_t  str_size,
const attribute attr,
db_value val 
)
int cubload::to_db_elo_int ( const char *  str,
const size_t  str_size,
const attribute attr,
db_value val 
)

Definition at line 888 of file load_db_value_converter.cpp.

References assert, and ER_FAILED.

Referenced by init_setters().

Here is the caller graph for this function:

int cubload::to_db_float ( const char *  str,
const size_t  str_size,
const attribute attr,
db_value val 
)
int cubload::to_db_int ( const char *  str,
const size_t  str_size,
const attribute attr,
db_value val 
)
int cubload::to_db_int_set ( const char *  str,
const size_t  str_size,
const attribute attr,
db_value val 
)

Used in case of collection when if int overflows fallback to bigint

Definition at line 306 of file load_db_value_converter.cpp.

References er_clear(), ER_IT_DATA_OVERFLOW, to_db_bigint(), and to_db_int().

Referenced by init_setters().

Here is the caller graph for this function:

int cubload::to_db_json ( const char *  str,
const size_t  str_size,
const attribute attr,
db_value val 
)

Definition at line 579 of file load_db_value_converter.cpp.

References assert, db_json_get_json_from_str(), db_make_json(), NO_ERROR, and NULL.

Referenced by init_setters().

Here is the caller graph for this function:

int cubload::to_db_make_nchar ( const char *  str,
const size_t  str_size,
const attribute attr,
db_value val 
)

Definition at line 416 of file load_db_value_converter.cpp.

References DB_TYPE_NCHAR, and to_db_generic_char().

Referenced by init_setters().

Here is the caller graph for this function:

int cubload::to_db_make_varnchar ( const char *  str,
const size_t  str_size,
const attribute attr,
db_value val 
)

Definition at line 421 of file load_db_value_converter.cpp.

References DB_TYPE_VARNCHAR, and to_db_generic_char().

Referenced by init_setters().

Here is the caller graph for this function:

int cubload::to_db_monetary ( const char *  str,
const size_t  str_size,
const attribute attr,
db_value val 
)
int cubload::to_db_null ( const char *  str,
const size_t  str_size,
const attribute attr,
db_value val 
)

Definition at line 212 of file load_db_value_converter.cpp.

References db_make_null(), ER_OBJ_ATTRIBUTE_CANT_BE_NULL, cubload::attribute::get_repr(), and or_attribute::is_notnull.

Referenced by init_setters().

Here is the caller graph for this function:

int cubload::to_db_numeric ( const char *  str,
const size_t  str_size,
const attribute attr,
db_value val 
)

Definition at line 479 of file load_db_value_converter.cpp.

References DB_TYPE_C_CHAR, DB_TYPE_NUMERIC, db_value_domain_init(), db_value_put(), and NO_ERROR.

Referenced by init_setters().

Here is the caller graph for this function:

int cubload::to_db_short ( const char *  str,
const size_t  str_size,
const attribute attr,
db_value val 
)
int cubload::to_db_string ( const char *  str,
const size_t  str_size,
const attribute attr,
db_value val 
)

Definition at line 427 of file load_db_value_converter.cpp.

References db_make_string().

Referenced by init_setters().

Here is the caller graph for this function:

int cubload::to_db_time ( const char *  str,
const size_t  str_size,
const attribute attr,
db_value val 
)

Definition at line 502 of file load_db_value_converter.cpp.

References db_value::data, db_make_time(), db_string_to_time(), and db_data::time.

Referenced by init_setters().

Here is the caller graph for this function:

int cubload::to_db_timestamp ( const char *  str,
const size_t  str_size,
const attribute attr,
db_value val 
)

Definition at line 510 of file load_db_value_converter.cpp.

References db_value::data, db_make_timestamp(), db_string_to_timestamp(), and db_data::utime.

Referenced by init_setters().

Here is the caller graph for this function:

int cubload::to_db_timestampltz ( const char *  str,
const size_t  str_size,
const attribute attr,
db_value val 
)

Definition at line 518 of file load_db_value_converter.cpp.

References db_value::data, db_make_timestampltz(), db_string_to_timestampltz(), and db_data::utime.

Referenced by init_setters().

Here is the caller graph for this function:

int cubload::to_db_timestamptz ( const char *  str,
const size_t  str_size,
const attribute attr,
db_value val 
)

Definition at line 526 of file load_db_value_converter.cpp.

References db_value::data, db_make_timestamptz(), db_string_to_timestamptz(), db_timestamptz::timestamp, db_data::timestamptz, and db_timestamptz::tz_id.

Referenced by init_setters().

Here is the caller graph for this function:

int cubload::to_db_varchar ( const char *  str,
const size_t  str_size,
const attribute attr,
db_value val 
)

Definition at line 411 of file load_db_value_converter.cpp.

References DB_TYPE_VARCHAR, and to_db_generic_char().

Referenced by init_setters().

Here is the caller graph for this function:

void cubload::worker_manager_get_stats ( UINT64 *  stats_out)

Definition at line 182 of file load_worker_manager.cpp.

References cubthread::worker_pool< Context >::get_stats(), and NULL.

Referenced by perfmon_server_calc_stats().

Here is the caller graph for this function:

void cubload::worker_manager_register_session ( session load_session)
void cubload::worker_manager_stop_all ( )

Definition at line 162 of file load_worker_manager.cpp.

Referenced by css_init().

Here is the caller graph for this function:

bool cubload::worker_manager_try_task ( cubthread::entry_task task)

Definition at line 98 of file load_worker_manager.cpp.

References assert, NULL, and cubthread::worker_pool_task_capper< Context >::try_task().

Referenced by cubload::session::load_batch().

Here is the caller graph for this function:

void cubload::worker_manager_unregister_session ( session load_session)

Definition at line 134 of file load_worker_manager.cpp.

References assert, cubthread::manager::destroy_worker_pool(), g_wp_context_manager, g_wp_task_capper, cubthread::get_manager(), and NULL.

Referenced by cubload::session::~session().

Here is the caller graph for this function:

Variable Documentation

const std::size_t cubload::CONSTANT_POOL_SIZE = 1024
static

Definition at line 37 of file load_semantic_helper.hpp.

Referenced by cubload::semantic_helper::make_constant().

const std::size_t cubload::COPY_BUF_POOL_SIZE = 512
static
const batch_id cubload::FIRST_BATCH_ID = 1

Definition at line 45 of file load_common.hpp.

Referenced by cubload::session::wait_for_previous_batch().

const class_id cubload::FIRST_CLASS_ID = 1

Definition at line 44 of file load_common.hpp.

Referenced by cubload::session::session(), and split().

std::set<session *> cubload::g_active_sessions

Definition at line 63 of file load_worker_manager.cpp.

cubthread::entry_workpool* cubload::g_worker_pool
static

Definition at line 64 of file load_worker_manager.cpp.

Referenced by worker_manager_register_session().

std::condition_variable cubload::g_wp_condvar
static

Definition at line 62 of file load_worker_manager.cpp.

worker_context_manager* cubload::g_wp_context_manager
static

Definition at line 65 of file load_worker_manager.cpp.

Referenced by worker_manager_unregister_session().

std::mutex cubload::g_wp_mutex
static

Definition at line 61 of file load_worker_manager.cpp.

cubthread::worker_pool_task_capper<cubthread::entry>* cubload::g_wp_task_capper
static

Definition at line 66 of file load_worker_manager.cpp.

Referenced by worker_manager_unregister_session().

const std::size_t cubload::MAX_COPY_BUF_SIZE = 256
static
const std::size_t cubload::MAX_QUOTED_STR_BUF_SIZE = 32 * 1024
static
const batch_id cubload::NULL_BATCH_ID = 0

Definition at line 43 of file load_common.hpp.

Referenced by cubload::session::session(), and split().

const std::size_t cubload::QUOTED_STR_BUF_POOL_SIZE = 512
static
conv_setters cubload::setters = init_setters ()
static

Definition at line 83 of file load_db_value_converter.cpp.

const std::size_t cubload::STRING_POOL_SIZE = 1024
static