CUBRID Engine  latest
object_template.c File Reference
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdarg.h>
#include <assert.h>
#include "db.h"
#include "dbtype.h"
#include "error_manager.h"
#include "system_parameter.h"
#include "server_interface.h"
#include "work_space.h"
#include "object_domain.h"
#include "object_primitive.h"
#include "object_representation.h"
#include "set_object.h"
#include "class_object.h"
#include "schema_manager.h"
#include "object_accessor.h"
#include "view_transform.h"
#include "authenticate.h"
#include "locator_cl.h"
#include "virtual_object.h"
#include "parser.h"
#include "transaction_cl.h"
#include "trigger_manager.h"
#include "environment_variable.h"
#include "transform.h"
#include "execute_statement.h"
#include "network_interface_cl.h"

Go to the source code of this file.

Macros

#define OBJ_INTERNAL_SAVEPOINT_NAME   "*template-unique*"
 

Functions

static DB_VALUEcheck_att_domain (SM_ATTRIBUTE *att, DB_VALUE *proposed_value)
 
static int check_constraints (SM_ATTRIBUTE *att, DB_VALUE *value, unsigned force_check_not_null)
 
static int quick_validate (SM_VALIDATION *valid, DB_VALUE *value)
 
static void cache_validation (SM_VALIDATION *valid, DB_VALUE *value)
 
static void begin_template_traversal (void)
 
static OBJ_TEMPLATEmake_template (MOP object, MOP classobj)
 
static int validate_template (OBJ_TEMPLATE *temp)
 
static OBJ_TEMPASSIGNobt_make_assignment (OBJ_TEMPLATE *template_ptr, SM_ATTRIBUTE *att)
 
static void obt_free_assignment (OBJ_TEMPASSIGN *assign)
 
static void obt_free_template (OBJ_TEMPLATE *template_ptr)
 
static int populate_auto_increment (OBJ_TEMPLATE *template_ptr)
 
static int populate_defaults (OBJ_TEMPLATE *template_ptr)
 
static int obt_assign_obt (OBJ_TEMPLATE *template_ptr, SM_ATTRIBUTE *att, int base_assignment, OBJ_TEMPLATE *value)
 
static MOP create_template_object (OBJ_TEMPLATE *template_ptr)
 
static int access_object (OBJ_TEMPLATE *template_ptr, MOP *object, MOBJ *objptr)
 
static int obt_convert_set_templates (SETREF *setref, int check_uniques)
 
static int obt_final_check_set (SETREF *setref, int *has_uniques)
 
static int obt_final_check (OBJ_TEMPLATE *template_ptr, int check_non_null, int *has_uniques)
 
static int obt_apply_assignment (MOP op, SM_ATTRIBUTE *att, char *mem, DB_VALUE *value, int check_uniques)
 
static int obt_apply_assignments (OBJ_TEMPLATE *template_ptr, int check_uniques, int level)
 
static MOP make_temp_object (DB_OBJECT *class_, OBJ_TEMPLATE *object)
 
static void free_temp_object (MOP obj)
 
int obt_area_init (void)
 
void obt_area_final (void)
 
int obt_find_attribute (OBJ_TEMPLATE *template_ptr, int use_base_class, const char *name, SM_ATTRIBUTE **attp)
 
DB_VALUEobt_check_assignment (SM_ATTRIBUTE *att, DB_VALUE *proposed_value, SM_VALIDATION *valid, unsigned force_check_not_null)
 
OBJ_TEMPLATEobt_def_object (MOP class_mop)
 
OBJ_TEMPLATEobt_edit_object (MOP object)
 
int obt_quit (OBJ_TEMPLATE *template_ptr)
 
int obt_assign (OBJ_TEMPLATE *template_ptr, SM_ATTRIBUTE *att, int base_assignment, DB_VALUE *value, SM_VALIDATION *valid)
 
int obt_set (OBJ_TEMPLATE *template_ptr, const char *attname, DB_VALUE *value)
 
int obt_set_obt (OBJ_TEMPLATE *template_ptr, const char *attname, OBJ_TEMPLATE *value)
 
int obt_desc_set (OBJ_TEMPLATE *template_ptr, SM_DESCRIPTOR *desc, DB_VALUE *value)
 
int obt_check_missing_assignments (OBJ_TEMPLATE *template_ptr)
 
void obt_set_label (OBJ_TEMPLATE *template_ptr, DB_VALUE *label)
 
void obt_disable_unique_checking (OBJ_TEMPLATE *template_ptr)
 
void obt_disable_serializable_conflict_checking (OBJ_TEMPLATE *template_ptr)
 
bool obt_enable_unique_checking (bool new_state)
 
void obt_set_force_flush (OBJ_TEMPLATE *template_ptr)
 
void obt_reset_force_flush (OBJ_TEMPLATE *template_ptr)
 
void obt_retain_after_finish (OBJ_TEMPLATE *template_ptr)
 
int obt_update_internal (OBJ_TEMPLATE *template_ptr, MOP *newobj, int check_non_null)
 
int obt_update (OBJ_TEMPLATE *template_ptr, MOP *newobj)
 
int obt_populate_known_arguments (OBJ_TEMPLATE *template_ptr)
 
void obt_begin_insert_values (void)
 

Variables

bool obt_Check_uniques = true
 
bool obt_Enable_autoincrement = true
 
bool obt_Last_insert_id_generated = false
 
static AREATemplate_area = NULL
 
static AREAAssignment_area = NULL
 
static unsigned int obj_Template_traversal = 0
 
static unsigned int template_savepoint_count = 0
 

Macro Definition Documentation

#define OBJ_INTERNAL_SAVEPOINT_NAME   "*template-unique*"

Definition at line 65 of file object_template.c.

Referenced by obt_update_internal().

Function Documentation

static void begin_template_traversal ( void  )
static

Definition at line 721 of file object_template.c.

References obj_Template_traversal.

Referenced by obt_update_internal().

Here is the caller graph for this function:

static void free_temp_object ( MOP  obj)
static

Definition at line 3021 of file object_template.c.

References db_object::class_mop, NULL, db_object::object, and ws_free_temp_mop().

Referenced by obt_apply_assignments().

Here is the caller graph for this function:

static MOP make_temp_object ( DB_OBJECT class_,
OBJ_TEMPLATE object 
)
static
static OBJ_TEMPLATE * make_template ( MOP  object,
MOP  classobj 
)
static

Definition at line 742 of file object_template.c.

References area_alloc(), ARG_FILE_LINE, obj_template::assignments, sm_class::att_count, AU_ALTER, au_fetch_class(), au_fetch_instance(), AU_FETCH_READ, AU_FETCH_UPDATE, AU_INSERT, AU_TYPE, AU_UPDATE, obj_template::base_class, obj_template::base_classobj, obj_template::base_object, obj_template::check_serializable_conflict, obj_template::check_uniques, obj_template::class_, sm_class::class_attribute_count, sm_class::class_type, obj_template::classobj, DB_NOT_PARTITIONED_CLASS, obj_template::discard_on_finish, ER_ERROR_SEVERITY, ER_IT_NOT_UPDATABLE_STMT, er_set(), obj_template::fkeys_were_modified, obj_template::force_check_not_null, obj_template::force_flush, obj_template::function_key_modified, i, obj_template::is_autoincrement_set, obj_template::is_class_update, obj_template::is_old_template, obj_template::label, LC_FETCH_MVCC_VERSION, mode, mq_fetch_one_real_class(), mq_is_updatable(), obj_template::nassigns, NULL, obj_template::object, obt_Check_uniques, obj_template::pruning_type, obj_template::schema_id, sm_class::shared_count, obj_template::shared_was_modified, sm_local_schema_version(), SM_VCLASS_CT, tm_Tran_index, TM_TRAN_ISOLATION, obj_template::tran_id, TRAN_REPEATABLE_READ, obj_template::traversal, obj_template::traversed, obj_template::uniques_were_modified, vid_get_referenced_mop(), vid_is_base_instance(), and obj_template::write_lock.

Referenced by obt_def_object(), and obt_edit_object().

Here is the caller graph for this function:

static int obt_apply_assignment ( MOP  op,
SM_ATTRIBUTE att,
char *  mem,
DB_VALUE value,
int  check_uniques 
)
static

Definition at line 2321 of file object_template.c.

References db_get_set(), sm_attribute::domain, error(), NO_ERROR, obj_assign_value(), obt_convert_set_templates(), TP_DOMAIN_TYPE, and TP_IS_SET_TYPE.

Referenced by obt_apply_assignments().

Here is the caller graph for this function:

static int obt_apply_assignments ( OBJ_TEMPLATE template_ptr,
int  check_uniques,
int  level 
)
static

Definition at line 2365 of file object_template.c.

References access_object(), assert, obj_template::assignments, obj_tempassign::att, au_fetch_instance_force(), AU_FETCH_UPDATE, obj_template::check_serializable_conflict, DB_CLIENT_TYPE_LOG_APPLIER, DB_DEFAULT_PRECISION, DB_DEFAULT_SCALE, db_elo_copy(), db_elo_delete(), db_get_client_type(), db_get_elo(), db_make_elo(), db_make_object(), DB_TYPE_BLOB, DB_TYPE_CLOB, db_value_clear(), db_value_domain_init(), db_value_is_null(), db_value_type(), db_object::decached, er_errid(), error(), obj_template::fkeys_were_modified, obj_template::force_flush, free_temp_object(), obj_template::function_key_modified, sm_attribute::header, i, pr_type::id, ID_ATTRIBUTE, obj_template::is_old_template, db_object::is_vid, LC_FETCH_MVCC_VERSION, locator_flush_class(), locator_flush_instance(), make_temp_object(), db_elo::meta_data, sm_component::name_space, obj_template::nassigns, NO_ERROR, NULL, obj_tempassign::obj, obj_get_value(), obj_Template_traversal, obj_template::object, obt_apply_assignment(), OBT_BASE_CLASS, OBT_BASE_CLASSOBJ, OBT_BASE_OBJECT, sm_attribute::offset, vid_oid::oid, db_object::oid_info, OID_ISTEMP, obj_tempassign::old_value, pr_make_ext_value(), obj_template::shared_was_modified, sm_active_triggers(), sm_ch_name(), tr_abort(), tr_after_object(), tr_before_object(), TR_EVENT_ALL, TR_EVENT_INSERT, TR_EVENT_NULL, TR_EVENT_UPDATE, tr_prepare_class(), obj_template::traversal, tr_state::triggers, sm_attribute::triggers, sm_class::triggers, sm_attribute::type, obj_template::uniques_were_modified, validate_template(), obj_tempassign::variable, vid_flush_and_rehash(), vid_is_base_instance(), ws_decache(), ws_dirty(), WS_IS_DELETED, and ws_pin().

Referenced by obt_convert_set_templates(), and obt_update_internal().

Here is the caller graph for this function:

void obt_area_final ( void  )

Definition at line 185 of file object_template.c.

References area_destroy(), and NULL.

Referenced by obt_area_init(), and ws_init().

Here is the caller graph for this function:

int obt_area_init ( void  )

Definition at line 155 of file object_template.c.

References area_create(), assert, er_errid(), error(), NO_ERROR, NULL, and obt_area_final().

Referenced by ws_init().

Here is the caller graph for this function:

void obt_begin_insert_values ( void  )

Definition at line 3089 of file object_template.c.

References obt_Last_insert_id_generated.

Referenced by do_execute_merge(), do_merge(), and insert_local().

Here is the caller graph for this function:

DB_VALUE* obt_check_assignment ( SM_ATTRIBUTE att,
DB_VALUE proposed_value,
SM_VALIDATION valid,
unsigned  force_check_not_null 
)

Definition at line 649 of file object_template.c.

References cache_validation(), check_att_domain(), check_constraints(), NO_ERROR, NULL, pr_free_ext_value(), pr_make_ext_value(), and quick_validate().

Referenced by obj_set_att(), obj_set_shared(), and obt_assign().

Here is the caller graph for this function:

static int obt_convert_set_templates ( SETREF setref,
int  check_uniques 
)
static
OBJ_TEMPLATE* obt_def_object ( MOP  class_mop)
int obt_desc_set ( OBJ_TEMPLATE template_ptr,
SM_DESCRIPTOR desc,
DB_VALUE value 
)
void obt_disable_serializable_conflict_checking ( OBJ_TEMPLATE template_ptr)

Definition at line 2781 of file object_template.c.

References obj_template::check_serializable_conflict.

Referenced by update_object_tuple().

Here is the caller graph for this function:

void obt_disable_unique_checking ( OBJ_TEMPLATE template_ptr)

Definition at line 2766 of file object_template.c.

References obj_template::check_uniques.

Referenced by update_object_tuple().

Here is the caller graph for this function:

OBJ_TEMPLATE* obt_edit_object ( MOP  object)
bool obt_enable_unique_checking ( bool  new_state)

Definition at line 2801 of file object_template.c.

References obt_Check_uniques.

Referenced by ldr_init().

Here is the caller graph for this function:

static int obt_final_check_set ( SETREF setref,
int *  has_uniques 
)
static

Definition at line 2113 of file object_template.c.

References db_get_pointer(), DB_TYPE_POINTER, DB_VALUE_TYPE, error(), i, NO_ERROR, NULL, obt_final_check(), db_set::set, set_size(), setobj_get_element_ptr(), and setobj_size().

Referenced by obt_final_check().

Here is the caller graph for this function:

static void obt_free_template ( OBJ_TEMPLATE template_ptr)
static
int obt_populate_known_arguments ( OBJ_TEMPLATE template_ptr)
int obt_quit ( OBJ_TEMPLATE template_ptr)

Definition at line 1489 of file object_template.c.

References NO_ERROR, NULL, and obt_free_template().

Referenced by dbt_abort_object(), do_insert_template(), insert_subquery_results(), obj_copy(), obj_create(), obj_set_att(), and pt_set_value_to_db().

Here is the caller graph for this function:

void obt_reset_force_flush ( OBJ_TEMPLATE template_ptr)

Definition at line 2830 of file object_template.c.

References assert, obj_template::force_flush, and NULL.

void obt_retain_after_finish ( OBJ_TEMPLATE template_ptr)

Definition at line 2844 of file object_template.c.

References assert, obj_template::discard_on_finish, and NULL.

Referenced by do_insert_template(), and insert_subquery_results().

Here is the caller graph for this function:

int obt_set ( OBJ_TEMPLATE template_ptr,
const char *  attname,
DB_VALUE value 
)
void obt_set_force_flush ( OBJ_TEMPLATE template_ptr)

Definition at line 2816 of file object_template.c.

References assert, obj_template::force_flush, and NULL.

Referenced by do_insert_template(), insert_subquery_results(), and update_object_tuple().

Here is the caller graph for this function:

void obt_set_label ( OBJ_TEMPLATE template_ptr,
DB_VALUE label 
)

Definition at line 2748 of file object_template.c.

References obj_template::label.

Referenced by dbt_set_label().

Here is the caller graph for this function:

int obt_set_obt ( OBJ_TEMPLATE template_ptr,
const char *  attname,
OBJ_TEMPLATE value 
)

Definition at line 1813 of file object_template.c.

References db_make_pointer(), and obt_set().

Referenced by dbt_put_internal().

Here is the caller graph for this function:

int obt_update ( OBJ_TEMPLATE template_ptr,
MOP newobj 
)

Definition at line 2968 of file object_template.c.

References obt_update_internal().

Referenced by dbt_finish_object(), dbt_finish_object_and_decache_when_failure(), and obj_set_att().

Here is the caller graph for this function:

Variable Documentation

AREA* Assignment_area = NULL
static

Definition at line 107 of file object_template.c.

unsigned int obj_Template_traversal = 0
static
bool obt_Check_uniques = true

Definition at line 75 of file object_template.c.

Referenced by make_template(), and obt_enable_unique_checking().

bool obt_Enable_autoincrement = true
bool obt_Last_insert_id_generated = false
AREA* Template_area = NULL
static

Definition at line 106 of file object_template.c.

unsigned int template_savepoint_count = 0
static

Definition at line 120 of file object_template.c.

Referenced by obt_update_internal().