CUBRID Engine  latest
catalog_class.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "system_catalog.h"
#include "btree.h"
#include "error_manager.h"
#include "heap_file.h"
#include "transform.h"
#include "set_object.h"
#include "locator_sr.h"
#include "xserver_interface.h"
#include "object_primitive.h"
#include "object_representation.h"
#include "query_dump.h"
#include "tz_support.h"
#include "db_date.h"
#include "dbtype.h"
#include "string_opfunc.h"
#include "thread_manager.hpp"

Go to the source code of this file.

Classes

struct  or_value
 
union  or_value::or_id
 
struct  or_value::or_sub
 
struct  catcls_entry
 
struct  catcls_property
 

Macros

#define IS_SUBSET(value)   (value).sub.count >= 0
 
#define EXCHANGE_OR_VALUE(a, b)
 
#define CATCLS_INDEX_NAME   "i__db_class_class_name"
 
#define CATCLS_INDEX_KEY   11
 
#define CATCLS_OID_TABLE_SIZE   1024
 

Typedefs

typedef struct or_value OR_VALUE
 
typedef struct catcls_entry CATCLS_ENTRY
 
typedef struct catcls_property CATCLS_PROPERTY
 
typedef int(* CREADER) (THREAD_ENTRY *thread_p, OR_BUF *buf, OR_VALUE *value_p)
 

Functions

int catcls_compile_catalog_classes (THREAD_ENTRY *thread_p)
 
int catcls_insert_catalog_classes (THREAD_ENTRY *thread_p, RECDES *record)
 
int catcls_delete_catalog_classes (THREAD_ENTRY *thread_p, const char *name, OID *class_oid)
 
int catcls_update_catalog_classes (THREAD_ENTRY *thread_p, const char *name, RECDES *record, OID *class_oid_p, UPDATE_INPLACE_STYLE force_in_place)
 
int catcls_finalize_class_oid_to_oid_hash_table (THREAD_ENTRY *thread_p)
 
int catcls_remove_entry (THREAD_ENTRY *thread_p, OID *class_oid)
 
int catcls_get_server_compat_info (THREAD_ENTRY *thread_p, INTL_CODESET *charset_id_p, char *lang_buf, const int lang_buf_size, char *timezone_checksum)
 
int catcls_get_db_collation (THREAD_ENTRY *thread_p, LANG_COLL_COMPAT **db_collations, int *coll_cnt)
 
int catcls_get_apply_info_log_record_time (THREAD_ENTRY *thread_p, time_t *log_record_time)
 
int catcls_find_and_set_cached_class_oid (THREAD_ENTRY *thread_p)
 
static int catcls_initialize_class_oid_to_oid_hash_table (THREAD_ENTRY *thread_p, int num_entry)
 
static int catcls_get_or_value_from_class (THREAD_ENTRY *thread_p, OR_BUF *buf_p, OR_VALUE *value_p)
 
static int catcls_get_or_value_from_attribute (THREAD_ENTRY *thread_p, OR_BUF *buf_p, OR_VALUE *value_p)
 
static int catcls_get_or_value_from_attrid (THREAD_ENTRY *thread_p, OR_BUF *buf_p, OR_VALUE *value_p)
 
static int catcls_get_or_value_from_domain (THREAD_ENTRY *thread_p, OR_BUF *buf_p, OR_VALUE *value_p)
 
static int catcls_get_or_value_from_method (THREAD_ENTRY *thread_p, OR_BUF *buf_p, OR_VALUE *value_p)
 
static int catcls_get_or_value_from_method_signiture (THREAD_ENTRY *thread_p, OR_BUF *buf_p, OR_VALUE *value_p)
 
static int catcls_get_or_value_from_method_argument (THREAD_ENTRY *thread_p, OR_BUF *buf_p, OR_VALUE *value_p)
 
static int catcls_get_or_value_from_method_file (THREAD_ENTRY *thread_p, OR_BUF *buf_p, OR_VALUE *value_p)
 
static int catcls_get_or_value_from_resolution (THREAD_ENTRY *thread_p, OR_BUF *buf_p, OR_VALUE *value_p)
 
static int catcls_get_or_value_from_query_spec (THREAD_ENTRY *thread_p, OR_BUF *buf_p, OR_VALUE *value_p)
 
static int catcls_get_or_value_from_indexes (DB_SEQ *seq, OR_VALUE *subset, int is_unique, int is_reverse, int is_primary_key, int is_foreign_key)
 
static int catcls_get_subset (THREAD_ENTRY *thread_p, OR_BUF *buf_p, int expected_size, OR_VALUE *value_p, CREADER reader)
 
static int catcls_get_object_set (THREAD_ENTRY *thread_p, OR_BUF *buf_p, int expected_size, OR_VALUE *value)
 
static int catcls_get_property_set (THREAD_ENTRY *thread_p, OR_BUF *buf_p, int expected_size, OR_VALUE *value_p)
 
static int catcls_reorder_attributes_by_repr (THREAD_ENTRY *thread_p, OR_VALUE *value_p)
 
static int catcls_expand_or_value_by_repr (OR_VALUE *value_p, OID *class_oid, DISK_REPR *rep)
 
static int catcls_expand_or_value_by_subset (THREAD_ENTRY *thread_p, OR_VALUE *value_p)
 
static int catcls_get_or_value_from_buffer (THREAD_ENTRY *thread_p, OR_BUF *buf_p, OR_VALUE *value_p, DISK_REPR *rep)
 
static int catcls_put_or_value_into_buffer (OR_VALUE *value_p, int chn, OR_BUF *buf_p, OID *class_oid, DISK_REPR *rep)
 
static OR_VALUEcatcls_get_or_value_from_class_record (THREAD_ENTRY *thread_p, RECDES *record)
 
static OR_VALUEcatcls_get_or_value_from_record (THREAD_ENTRY *thread_p, RECDES *record, OID *class_oid)
 
static int catcls_put_or_value_into_record (THREAD_ENTRY *thread_p, OR_VALUE *value_p, int chn, RECDES *record, OID *class_oid)
 
static int catcls_insert_subset (THREAD_ENTRY *thread_p, OR_VALUE *value_p, OID *root_oid)
 
static int catcls_delete_subset (THREAD_ENTRY *thread_p, OR_VALUE *value_p)
 
static int catcls_update_subset (THREAD_ENTRY *thread_p, OR_VALUE *value_p, OR_VALUE *old_value, bool *uflag, UPDATE_INPLACE_STYLE force_in_place)
 
static int catcls_insert_instance (THREAD_ENTRY *thread_p, OR_VALUE *value_p, OID *oid, OID *root_oid, OID *class_oid, HFID *hfid, HEAP_SCANCACHE *scan)
 
static int catcls_delete_instance (THREAD_ENTRY *thread_p, OID *oid, OID *class_oid, HFID *hfid, HEAP_SCANCACHE *scan)
 
static int catcls_update_instance (THREAD_ENTRY *thread_p, OR_VALUE *value_p, OID *oid, OID *class_oid, HFID *hfid, HEAP_SCANCACHE *scan, UPDATE_INPLACE_STYLE force_in_place)
 
static CATCLS_ENTRYcatcls_allocate_entry (THREAD_ENTRY *thread_p)
 
static int catcls_free_entry_kv (const void *key, void *data, void *args)
 
static int catcls_free_entry (CATCLS_ENTRY *entry_p)
 
static OIDcatcls_find_oid (THREAD_ENTRY *thread_p, OID *class_oid)
 
static int catcls_put_entry (THREAD_ENTRY *thread_p, CATCLS_ENTRY *entry, bool *already_exists)
 
static char * catcls_unpack_allocator (int size)
 
static OR_VALUEcatcls_allocate_or_value (int size)
 
static void catcls_free_sub_value (OR_VALUE *values, int count)
 
static void catcls_free_or_value (OR_VALUE *value)
 
static int catcls_expand_or_value_by_def (OR_VALUE *value_p, CT_CLASS *def)
 
static int catcls_guess_record_length (OR_VALUE *value_p)
 
static int catcls_find_class_oid_by_class_name (THREAD_ENTRY *thread_p, const char *name, OID *class_oid)
 
static int catcls_find_btid_of_class_name (THREAD_ENTRY *thread_p, BTID *btid)
 
static int catcls_find_oid_by_class_name (THREAD_ENTRY *thread_p, const char *name, OID *oid)
 
static int catcls_convert_class_oid_to_oid (THREAD_ENTRY *thread_p, DB_VALUE *oid_val)
 
static int catcls_convert_attr_id_to_name (THREAD_ENTRY *thread_p, OR_BUF *orbuf_p, OR_VALUE *value_p)
 
static void catcls_apply_component_type (OR_VALUE *value_p, int type)
 
static int catcls_resolution_space (int name_space)
 
static void catcls_apply_resolutions (OR_VALUE *value_p, OR_VALUE *resolution_p)
 
static int catcls_replace_entry_oid (THREAD_ENTRY *thread_p, OID *entry_class_oid, OID *entry_new_oid)
 
static int catcls_get_or_value_from_partition (THREAD_ENTRY *thread_p, OR_BUF *buf_p, OR_VALUE *value_p)
 

Variables

bool catcls_Enable = false
 
static BTID catcls_Btid
 
static CATCLS_ENTRYcatcls_Free_entry_list = NULL
 
static MHT_TABLEcatcls_Class_oid_to_oid_hash_table = NULL
 

Macro Definition Documentation

#define CATCLS_INDEX_KEY   11

Definition at line 59 of file catalog_class.c.

Referenced by catcls_find_btid_of_class_name().

#define CATCLS_INDEX_NAME   "i__db_class_class_name"

Definition at line 58 of file catalog_class.c.

Referenced by catcls_find_btid_of_class_name().

#define CATCLS_OID_TABLE_SIZE   1024

Definition at line 61 of file catalog_class.c.

Referenced by catcls_compile_catalog_classes().

#define EXCHANGE_OR_VALUE (   a,
 
)
Value:
do { \
t = a; \
a = b; \
b = t; \
} while (0)
struct or_value OR_VALUE
Definition: catalog_class.c:63

Definition at line 50 of file catalog_class.c.

Referenced by catcls_reorder_attributes_by_repr().

#define IS_SUBSET (   value)    (value).sub.count >= 0

Typedef Documentation

typedef struct catcls_entry CATCLS_ENTRY

Definition at line 64 of file catalog_class.c.

Definition at line 65 of file catalog_class.c.

typedef int(* CREADER) (THREAD_ENTRY *thread_p, OR_BUF *buf, OR_VALUE *value_p)

Definition at line 66 of file catalog_class.c.

typedef struct or_value OR_VALUE

Definition at line 63 of file catalog_class.c.

Function Documentation

static CATCLS_ENTRY * catcls_allocate_entry ( THREAD_ENTRY thread_p)
static
static void catcls_apply_component_type ( OR_VALUE value_p,
int  type 
)
static

Definition at line 896 of file catalog_class.c.

References or_value::or_sub::count, db_make_int(), i, or_value::sub, or_value::value, and or_value::or_sub::value.

Referenced by catcls_get_or_value_from_class().

Here is the caller graph for this function:

static void catcls_apply_resolutions ( OR_VALUE value_p,
OR_VALUE resolution_p 
)
static
int catcls_finalize_class_oid_to_oid_hash_table ( THREAD_ENTRY thread_p)

Definition at line 280 of file catalog_class.c.

References catcls_free_entry_kv(), CSECT_CT_OID_TABLE, csect_enter, csect_exit, ER_FAILED, free_and_init, INF_WAIT, mht_destroy(), mht_map(), catcls_entry::next, NO_ERROR, and NULL.

Referenced by boot_server_all_finalize().

Here is the caller graph for this function:

int catcls_find_and_set_cached_class_oid ( THREAD_ENTRY thread_p)
static int catcls_find_class_oid_by_class_name ( THREAD_ENTRY thread_p,
const char *  name,
OID class_oid 
)
static
static OID * catcls_find_oid ( THREAD_ENTRY thread_p,
OID class_oid 
)
static

Definition at line 315 of file catalog_class.c.

References assert, csect_check_own, CSECT_CT_OID_TABLE, mht_get(), NULL, and catcls_entry::oid.

Referenced by catcls_convert_class_oid_to_oid().

Here is the caller graph for this function:

static int catcls_free_entry ( CATCLS_ENTRY entry_p)
static

Definition at line 237 of file catalog_class.c.

References assert, catcls_Free_entry_list, csect_check_own, CSECT_CT_OID_TABLE, catcls_entry::next, NO_ERROR, and NULL.

Referenced by catcls_convert_class_oid_to_oid(), and catcls_free_entry_kv().

Here is the caller graph for this function:

static int catcls_free_entry_kv ( const void *  key,
void *  data,
void *  args 
)
static

Definition at line 226 of file catalog_class.c.

References catcls_free_entry().

Referenced by catcls_finalize_class_oid_to_oid_hash_table(), and catcls_remove_entry().

Here is the caller graph for this function:

static void catcls_free_sub_value ( OR_VALUE values,
int  count 
)
static

Definition at line 477 of file catalog_class.c.

References or_value::or_sub::count, cubregex::count(), free_and_init, i, NULL, pr_clear_value(), or_value::sub, or_value::value, and or_value::or_sub::value.

Referenced by catcls_free_or_value().

Here is the caller graph for this function:

static int catcls_get_object_set ( THREAD_ENTRY thread_p,
OR_BUF buf_p,
int  expected_size,
OR_VALUE value 
)
static
static int catcls_get_or_value_from_attribute ( THREAD_ENTRY thread_p,
OR_BUF buf_p,
OR_VALUE value_p 
)
static

variable offset

variable

Definition at line 1229 of file catalog_class.c.

References ARG_FILE_LINE, assert, ASSERT_ERROR, catcls_convert_class_oid_to_oid(), catcls_expand_or_value_by_def(), catcls_get_or_value_from_domain(), catcls_get_subset(), catcls_unpack_allocator(), classobj_get_prop(), or_value::or_sub::count, ct_Attribute, db_value::data, pr_type::data_readval(), db_default_expression_string(), db_get_enum_codeset(), db_get_enum_collation(), db_get_enum_short(), db_get_int(), db_get_set(), db_get_string(), db_get_string_size(), db_make_enumeration(), db_make_int(), db_make_null(), db_make_string(), DB_MAX_COMMENT_LENGTH, DB_MAX_IDENTIFIER_LENGTH, db_private_alloc, db_string_truncate(), DB_TYPE_CHAR, DB_TYPE_ENUMERATION, DB_TYPE_INTEGER, DB_TYPE_NCHAR, DB_TYPE_NULL, DB_TYPE_SEQUENCE, DB_TYPE_STRING, DB_TYPE_VARCHAR, DB_TYPE_VARNCHAR, db_value_is_null(), DB_VALUE_TYPE, db_value_type(), ER_ERROR_SEVERITY, ER_FAILED, ER_GENERIC_ERROR, ER_OUT_OF_VIRTUAL_MEMORY, er_set(), error(), free_and_init, tf_meta_class::mc_n_variable, db_value::need_clear, NO_ERROR, NULL, or_advance(), or_get_value(), or_get_var_table(), OR_INT_SIZE, ORC_ATT_COMMENT_INDEX, ORC_ATT_CURRENT_VALUE_INDEX, ORC_ATT_DOMAIN_INDEX, ORC_ATT_NAME_INDEX, ORC_ATT_ORIGINAL_VALUE_INDEX, ORC_ATT_PROPERTIES_INDEX, ORC_ATT_TRIGGER_INDEX, pr_clear_value(), qdump_operator_type_string(), db_set::set, db_data::set, set_get_element(), set_get_element_nocopy(), set_size(), setobj::size, SM_ATTFLAG_NON_NULL, strlen, or_value::sub, T_TO_CHAR, tf_Metaclass_attribute, tp_domain_resolve_default(), tp_Integer, TP_IS_SET_TYPE, tp_Object, tp_String, valcnv_convert_value_to_string(), or_value::value, and or_value::or_sub::value.

Referenced by catcls_get_or_value_from_class().

Here is the caller graph for this function:

static int catcls_get_or_value_from_class ( THREAD_ENTRY thread_p,
OR_BUF buf_p,
OR_VALUE value_p 
)
static

variable offset

Definition at line 977 of file catalog_class.c.

References ARG_FILE_LINE, assert, catcls_allocate_or_value(), catcls_apply_component_type(), catcls_apply_resolutions(), catcls_expand_or_value_by_def(), catcls_find_class_oid_by_class_name(), catcls_free_or_value(), catcls_get_object_set(), catcls_get_or_value_from_attribute(), catcls_get_or_value_from_method(), catcls_get_or_value_from_method_file(), catcls_get_or_value_from_partition(), catcls_get_or_value_from_query_spec(), catcls_get_or_value_from_resolution(), catcls_get_property_set(), catcls_get_subset(), catcls_unpack_allocator(), ct_Class, pr_type::data_readval(), db_get_string(), db_make_oid(), DB_MAX_CLASS_COMMENT_LENGTH, DB_MAX_IDENTIFIER_LENGTH, db_string_truncate(), er_errid(), ER_ERROR_SEVERITY, ER_OUT_OF_VIRTUAL_MEMORY, er_set(), error(), free_and_init, tf_meta_class::mc_n_variable, NO_ERROR, NULL, or_advance(), or_get_var_table(), OR_INT_SIZE, ORC_ATT_COUNT_OFFSET, ORC_ATTRIBUTES_INDEX, ORC_CLASS_ATTRS_INDEX, ORC_CLASS_METHODS_INDEX, ORC_COMMENT_INDEX, ORC_LOADER_COMMANDS_INDEX, ORC_METHOD_FILES_INDEX, ORC_METHODS_INDEX, ORC_NAME_INDEX, ORC_PARTITION_INDEX, ORC_PROPERTIES_INDEX, ORC_QUERY_SPEC_INDEX, ORC_REPRESENTATIONS_INDEX, ORC_RESOLUTIONS_INDEX, ORC_SHARED_ATTRS_INDEX, ORC_SUBCLASSES_INDEX, ORC_SUPERCLASSES_INDEX, ORC_TRIGGERS_INDEX, or_value::sub, tf_Metaclass_class, tp_Integer, tp_Object, tp_String, or_value::value, and or_value::or_sub::value.

Referenced by catcls_get_or_value_from_class_record().

Here is the caller graph for this function:

static OR_VALUE * catcls_get_or_value_from_class_record ( THREAD_ENTRY thread_p,
RECDES record 
)
static
static int catcls_guess_record_length ( OR_VALUE value_p)
static
static int catcls_initialize_class_oid_to_oid_hash_table ( THREAD_ENTRY thread_p,
int  num_entry 
)
static

Definition at line 254 of file catalog_class.c.

References CSECT_CT_OID_TABLE, csect_enter, csect_exit, ER_FAILED, INF_WAIT, mht_create(), NO_ERROR, NULL, oid_compare_equals(), and oid_hash().

Referenced by catcls_compile_catalog_classes().

Here is the caller graph for this function:

static int catcls_put_entry ( THREAD_ENTRY thread_p,
CATCLS_ENTRY entry,
bool already_exists 
)
static

Definition at line 347 of file catalog_class.c.

References assert, catcls_entry::class_oid, csect_check_own, CSECT_CT_OID_TABLE, ER_FAILED, mht_put_if_not_exists(), NO_ERROR, NULL, catcls_entry::oid, and OID_EQ.

Referenced by catcls_convert_class_oid_to_oid().

Here is the caller graph for this function:

static int catcls_put_or_value_into_record ( THREAD_ENTRY thread_p,
OR_VALUE value_p,
int  chn,
RECDES record,
OID class_oid 
)
static
int catcls_remove_entry ( THREAD_ENTRY thread_p,
OID class_oid 
)

Definition at line 385 of file catalog_class.c.

References assert, catcls_free_entry_kv(), csect_check_own, CSECT_CT_OID_TABLE, mht_rem(), NO_ERROR, and NULL.

Referenced by catcls_delete_catalog_classes(), and locator_force_drop_class_name_entry().

Here is the caller graph for this function:

int catcls_replace_entry_oid ( THREAD_ENTRY thread_p,
OID entry_class_oid,
OID entry_new_oid 
)
static
static int catcls_resolution_space ( int  name_space)
static

Definition at line 917 of file catalog_class.c.

Referenced by catcls_apply_resolutions().

Here is the caller graph for this function:

Variable Documentation

BTID catcls_Btid
static

Definition at line 104 of file catalog_class.c.

MHT_TABLE* catcls_Class_oid_to_oid_hash_table = NULL
static

Definition at line 106 of file catalog_class.c.

CATCLS_ENTRY* catcls_Free_entry_list = NULL
static

Definition at line 105 of file catalog_class.c.

Referenced by catcls_allocate_entry(), and catcls_free_entry().