mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 22:03:03 +01:00
Cleanup
This commit is contained in:
parent
bba7de25fb
commit
3164d5a86b
@ -76,11 +76,11 @@ const int drq_s_rels = 23; // store relations
|
||||
const int drq_l_rel_name = 24; // lookup relation name
|
||||
const int drq_l_view_rels = 25; // lookup relations in view
|
||||
const int drq_s_usr_prvs = 26; // store user privileges
|
||||
const int drq_s_classes = 27; // store security classes
|
||||
///const int drq_s_classes = 27; // store security classes
|
||||
const int drq_s_sql_lfld = 28; // store sql fields
|
||||
const int drq_s_sql_gfld = 29; // store sql fields
|
||||
const int drq_s_triggers = 30; // store triggers
|
||||
const int drq_s_trg_msgs = 31; // store trigger messages
|
||||
///const int drq_s_trg_msgs = 31; // store trigger messages
|
||||
const int drq_s_view_rels = 32; // store view relations
|
||||
const int drq_e_dims = 33; // erase dimensions
|
||||
const int drq_e_filters = 34; // erase filters
|
||||
@ -116,7 +116,7 @@ const int drq_m_index = 63; // modify index
|
||||
const int drq_m_lfield = 64; // modify local field
|
||||
const int drq_m_relation = 65; // modify relation
|
||||
///const int drq_m_trigger = 66; // modify trigger
|
||||
const int drq_m_trg_msg = 67; // modify trigger message
|
||||
///const int drq_m_trg_msg = 67; // modify trigger message
|
||||
const int drq_e_grant1 = 68; // erase grant
|
||||
const int drq_e_grant2 = 69; // erase grant
|
||||
const int drq_s_indices = 70; // store indices
|
||||
|
@ -410,14 +410,6 @@ void DYN_execute(Global* gbl,
|
||||
DYN_delete_relation(gbl, ptr, relation_name);
|
||||
break;
|
||||
|
||||
case isc_dyn_def_security_class:
|
||||
DYN_define_security_class(gbl, ptr);
|
||||
break;
|
||||
|
||||
case isc_dyn_delete_security_class:
|
||||
DYN_delete_security_class(gbl, ptr);
|
||||
break;
|
||||
|
||||
case isc_dyn_def_exception:
|
||||
DYN_define_exception(gbl, ptr);
|
||||
break;
|
||||
@ -478,14 +470,6 @@ void DYN_execute(Global* gbl,
|
||||
DYN_define_trigger(gbl, ptr, relation_name, NULL, false);
|
||||
break;
|
||||
|
||||
case isc_dyn_def_trigger_msg:
|
||||
DYN_define_trigger_msg(gbl, ptr, trigger_name);
|
||||
break;
|
||||
|
||||
case isc_dyn_mod_trigger_msg:
|
||||
DYN_modify_trigger_msg(gbl, ptr, trigger_name);
|
||||
break;
|
||||
|
||||
case isc_dyn_def_global_fld:
|
||||
DYN_define_global_field(gbl, ptr, relation_name, field_name);
|
||||
break;
|
||||
|
@ -99,26 +99,6 @@ const int FOR_KEY_DEL_NONE = 0x80;
|
||||
|
||||
DATABASE DB = STATIC "ODS.RDB";
|
||||
|
||||
|
||||
static const UCHAR who_blr[] =
|
||||
{
|
||||
blr_version5,
|
||||
blr_begin,
|
||||
blr_message, 0, 1, 0,
|
||||
blr_cstring2, CS_METADATA, 0, BLR_WORD(MAX_SQL_IDENTIFIER_SIZE),
|
||||
blr_begin,
|
||||
blr_send, 0,
|
||||
blr_begin,
|
||||
blr_assignment,
|
||||
blr_user_name,
|
||||
blr_parameter, 0, 0, 0,
|
||||
blr_end,
|
||||
blr_end,
|
||||
blr_end,
|
||||
blr_eoc
|
||||
};
|
||||
|
||||
|
||||
static bool is_it_user_name(Global*, const Firebird::MetaName&, thread_db*);
|
||||
|
||||
static rel_t get_relation_type(thread_db*, Global*, const Firebird::MetaName&);
|
||||
@ -148,9 +128,6 @@ void DYN_define_collation( Global* gbl, const UCHAR** ptr)
|
||||
|
||||
GET_STRING(ptr, collation_name);
|
||||
|
||||
if (!collation_name.length())
|
||||
DYN_error_punt(false, 212); // msg 212: "Zero length identifiers not allowed"
|
||||
|
||||
DdlNode::executeDdlTrigger(tdbb, gbl->gbl_transaction, DdlNode::DTW_BEFORE,
|
||||
DDL_TRIGGER_CREATE_COLLATION, collation_name, gbl->sqlText);
|
||||
|
||||
@ -422,11 +399,6 @@ void DYN_define_constraint(Global* gbl,
|
||||
{
|
||||
DYN_UTIL_generate_constraint_name(tdbb, gbl, constraint_name);
|
||||
}
|
||||
if (constraint_name.length() == 0)
|
||||
{
|
||||
DYN_error_punt(false, 212);
|
||||
// msg 212: "Zero length identifiers not allowed"
|
||||
}
|
||||
|
||||
jrd_req* request = NULL;
|
||||
SSHORT id = -1;
|
||||
@ -909,12 +881,6 @@ void DYN_define_exception( Global* gbl, const UCHAR** ptr)
|
||||
|
||||
GET_STRING(ptr, exception_name);
|
||||
|
||||
if (exception_name.length() == 0)
|
||||
{
|
||||
DYN_error_punt(false, 212);
|
||||
// msg 212: "Zero length identifiers not allowed"
|
||||
}
|
||||
|
||||
DdlNode::executeDdlTrigger(tdbb, gbl->gbl_transaction, DdlNode::DTW_BEFORE,
|
||||
DDL_TRIGGER_CREATE_EXCEPTION, exception_name, gbl->sqlText);
|
||||
|
||||
@ -1245,9 +1211,6 @@ void DYN_define_filter( Global* gbl, const UCHAR** ptr)
|
||||
Firebird::MetaName filter_name;
|
||||
GET_STRING(ptr, filter_name);
|
||||
|
||||
if (filter_name.isEmpty())
|
||||
DYN_error_punt(false, 212); // msg 212: "Zero length identifiers not allowed"
|
||||
|
||||
jrd_req* request = CMP_find_request(tdbb, drq_s_filters, DYN_REQUESTS);
|
||||
|
||||
bool b_ending_store = false;
|
||||
@ -1334,12 +1297,6 @@ void DYN_define_function( Global* gbl, const UCHAR** ptr)
|
||||
Firebird::MetaName function_name;
|
||||
GET_STRING(ptr, function_name);
|
||||
|
||||
if (function_name.length() == 0)
|
||||
{
|
||||
DYN_error_punt(false, 212);
|
||||
// msg 212: "Zero length identifiers not allowed"
|
||||
}
|
||||
|
||||
DdlNode::executeDdlTrigger(tdbb, gbl->gbl_transaction, DdlNode::DTW_BEFORE,
|
||||
DDL_TRIGGER_CREATE_FUNCTION, function_name, gbl->sqlText);
|
||||
|
||||
@ -1559,12 +1516,6 @@ void DYN_define_generator( Global* gbl, const UCHAR** ptr)
|
||||
Firebird::MetaName generator_name;
|
||||
GET_STRING(ptr, generator_name);
|
||||
|
||||
if (generator_name.length() == 0)
|
||||
{
|
||||
DYN_error_punt(false, 212);
|
||||
// msg 212: "Zero length identifiers not allowed"
|
||||
}
|
||||
|
||||
DdlNode::executeDdlTrigger(tdbb, gbl->gbl_transaction, DdlNode::DTW_BEFORE,
|
||||
DDL_TRIGGER_CREATE_SEQUENCE, generator_name, gbl->sqlText);
|
||||
|
||||
@ -1675,11 +1626,6 @@ void DYN_define_global_field(Global* gbl,
|
||||
{
|
||||
DYN_UTIL_generate_field_name(tdbb, gbl, global_field_name);
|
||||
}
|
||||
if (global_field_name.length() == 0)
|
||||
{
|
||||
DYN_error_punt(false, 212);
|
||||
// msg 212: "Zero length identifiers not allowed"
|
||||
}
|
||||
|
||||
DdlNode::executeDdlTrigger(tdbb, gbl->gbl_transaction, DdlNode::DTW_BEFORE,
|
||||
DDL_TRIGGER_CREATE_DOMAIN, global_field_name, gbl->sqlText);
|
||||
@ -1955,11 +1901,6 @@ void DYN_define_index(Global* gbl,
|
||||
{
|
||||
DYN_UTIL_generate_index_name(tdbb, gbl, index_name, index_type);
|
||||
}
|
||||
if (index_name.isEmpty())
|
||||
{
|
||||
DYN_error_punt(false, 212);
|
||||
// msg 212: "Zero length identifiers not allowed"
|
||||
}
|
||||
|
||||
DdlNode::executeDdlTrigger(tdbb, gbl->gbl_transaction, DdlNode::DTW_BEFORE,
|
||||
DDL_TRIGGER_CREATE_INDEX, index_name, gbl->sqlText);
|
||||
@ -2156,11 +2097,6 @@ void DYN_define_index(Global* gbl,
|
||||
|
||||
case isc_dyn_idx_foreign_key:
|
||||
GET_STRING(ptr, referenced_relation);
|
||||
if (referenced_relation.isEmpty())
|
||||
{
|
||||
DYN_error_punt(false, 212);
|
||||
// msg 212: "Zero length identifiers not allowed"
|
||||
}
|
||||
break;
|
||||
|
||||
case isc_dyn_idx_ref_column:
|
||||
@ -2541,12 +2477,6 @@ void DYN_define_local_field(Global* gbl,
|
||||
Firebird::MetaName local_field_name;
|
||||
GET_STRING(ptr, local_field_name);
|
||||
|
||||
if (local_field_name.isEmpty())
|
||||
{
|
||||
DYN_error_punt(false, 212);
|
||||
// msg 212: "Zero length identifiers not allowed"
|
||||
}
|
||||
|
||||
jrd_req* request = NULL;
|
||||
SSHORT id = -1;
|
||||
|
||||
@ -2878,12 +2808,6 @@ void DYN_define_relation(Global* gbl, const UCHAR** ptr, bool view)
|
||||
|
||||
GET_STRING(ptr, relation_name);
|
||||
|
||||
if (relation_name.length() == 0)
|
||||
{
|
||||
DYN_error_punt(false, 212);
|
||||
// msg 212: "Zero length identifiers not allowed"
|
||||
}
|
||||
|
||||
DdlNode::executeDdlTrigger(tdbb, gbl->gbl_transaction, DdlNode::DTW_BEFORE,
|
||||
(view ? DDL_TRIGGER_CREATE_VIEW : DDL_TRIGGER_CREATE_TABLE), relation_name, gbl->sqlText);
|
||||
|
||||
@ -3228,70 +3152,6 @@ do_error_punt_9:
|
||||
}
|
||||
|
||||
|
||||
void DYN_define_security_class( Global* gbl, const UCHAR** ptr)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* D Y N _ d e f i n e _ s e c u r i t y _ c l a s s
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Execute a dynamic ddl statement.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
thread_db* tdbb = JRD_get_thread_data();
|
||||
Database* dbb = tdbb->getDatabase();
|
||||
jrd_req* request = CMP_find_request(tdbb, drq_s_classes, DYN_REQUESTS);
|
||||
|
||||
bool b_ending_store = false;
|
||||
|
||||
try {
|
||||
|
||||
STORE(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
SC IN RDB$SECURITY_CLASSES
|
||||
GET_STRING(ptr, SC.RDB$SECURITY_CLASS);
|
||||
SC.RDB$ACL.NULL = TRUE;
|
||||
SC.RDB$DESCRIPTION.NULL = TRUE;
|
||||
|
||||
UCHAR verb;
|
||||
while ((verb = *(*ptr)++) != isc_dyn_end)
|
||||
{
|
||||
switch (verb)
|
||||
{
|
||||
case isc_dyn_scl_acl:
|
||||
DYN_put_blr_blob(gbl, ptr, &SC.RDB$ACL);
|
||||
SC.RDB$ACL.NULL = FALSE;
|
||||
break;
|
||||
|
||||
default:
|
||||
DYN_unsupported_verb();
|
||||
}
|
||||
}
|
||||
|
||||
b_ending_store = true;
|
||||
|
||||
END_STORE;
|
||||
|
||||
if (!DYN_REQUEST(drq_s_classes)) {
|
||||
DYN_REQUEST(drq_s_classes) = request;
|
||||
}
|
||||
}
|
||||
catch (const Firebird::Exception& ex)
|
||||
{
|
||||
Firebird::stuff_exception(tdbb->tdbb_status_vector, ex);
|
||||
if (b_ending_store)
|
||||
{
|
||||
DYN_rundown_request(request, drq_s_classes);
|
||||
DYN_error_punt(true, 27);
|
||||
// msg 27: "STORE RDB$RELATIONS failed"
|
||||
}
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DYN_define_sql_field(Global* gbl,
|
||||
const UCHAR** ptr,
|
||||
const Firebird::MetaName* relation_name,
|
||||
@ -3318,12 +3178,6 @@ void DYN_define_sql_field(Global* gbl,
|
||||
Firebird::MetaName sql_field_name;
|
||||
GET_STRING(ptr, sql_field_name);
|
||||
|
||||
if (sql_field_name.isEmpty())
|
||||
{
|
||||
DYN_error_punt(false, 212);
|
||||
// msg 212: "Zero length identifiers not allowed"
|
||||
}
|
||||
|
||||
jrd_req* request = NULL;
|
||||
SSHORT id = -1;
|
||||
|
||||
@ -3701,19 +3555,10 @@ void DYN_define_trigger(Global* gbl,
|
||||
|
||||
GET_STRING(ptr, t);
|
||||
if (t.length() == 0)
|
||||
{
|
||||
DYN_UTIL_generate_trigger_name(tdbb, gbl, t);
|
||||
}
|
||||
|
||||
if (t.length() == 0)
|
||||
{
|
||||
DYN_error_punt(false, 212);
|
||||
// msg 212: "Zero length identifiers not allowed"
|
||||
}
|
||||
|
||||
if (trigger_name) {
|
||||
if (trigger_name)
|
||||
*trigger_name = t;
|
||||
}
|
||||
|
||||
jrd_req* request = CMP_find_request(tdbb, drq_s_triggers, DYN_REQUESTS);
|
||||
|
||||
@ -3882,83 +3727,6 @@ void DYN_define_trigger(Global* gbl,
|
||||
}
|
||||
|
||||
|
||||
void DYN_define_trigger_msg(Global* gbl, const UCHAR** ptr, const Firebird::MetaName* trigger_name)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* D Y N _ d e f i n e _ t r i g g e r _ m s g
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Define a trigger message.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
thread_db* tdbb = JRD_get_thread_data();
|
||||
Database* dbb = tdbb->getDatabase();
|
||||
|
||||
jrd_req* request = CMP_find_request(tdbb, drq_s_trg_msgs, DYN_REQUESTS);
|
||||
|
||||
bool b_ending_store = false;
|
||||
|
||||
try {
|
||||
|
||||
STORE(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
X IN RDB$TRIGGER_MESSAGES
|
||||
X.RDB$MESSAGE_NUMBER = DYN_get_number(ptr);
|
||||
X.RDB$MESSAGE.NULL = TRUE;
|
||||
if (trigger_name)
|
||||
{
|
||||
strcpy(X.RDB$TRIGGER_NAME, trigger_name->c_str());
|
||||
X.RDB$TRIGGER_NAME.NULL = FALSE;
|
||||
}
|
||||
else {
|
||||
X.RDB$TRIGGER_NAME.NULL = TRUE;
|
||||
}
|
||||
|
||||
UCHAR verb;
|
||||
while ((verb = *(*ptr)++) != isc_dyn_end)
|
||||
{
|
||||
switch (verb)
|
||||
{
|
||||
case isc_dyn_trg_name:
|
||||
GET_STRING(ptr, X.RDB$TRIGGER_NAME);
|
||||
X.RDB$TRIGGER_NAME.NULL = FALSE;
|
||||
break;
|
||||
|
||||
case isc_dyn_trg_msg:
|
||||
GET_STRING(ptr, X.RDB$MESSAGE);
|
||||
X.RDB$MESSAGE.NULL = FALSE;
|
||||
break;
|
||||
|
||||
default:
|
||||
DYN_unsupported_verb();
|
||||
}
|
||||
}
|
||||
|
||||
b_ending_store = true;
|
||||
|
||||
END_STORE;
|
||||
|
||||
if (!DYN_REQUEST(drq_s_trg_msgs)) {
|
||||
DYN_REQUEST(drq_s_trg_msgs) = request;
|
||||
}
|
||||
}
|
||||
catch (const Firebird::Exception& ex)
|
||||
{
|
||||
Firebird::stuff_exception(tdbb->tdbb_status_vector, ex);
|
||||
if (b_ending_store)
|
||||
{
|
||||
DYN_rundown_request(request, drq_s_trg_msgs);
|
||||
DYN_error_punt(true, 33);
|
||||
// msg 33: "DEFINE TRIGGER MESSAGE failed"
|
||||
}
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DYN_define_view_relation( Global* gbl, const UCHAR** ptr, const Firebird::MetaName* view)
|
||||
{
|
||||
/**************************************
|
||||
@ -3976,11 +3744,6 @@ void DYN_define_view_relation( Global* gbl, const UCHAR** ptr, const Firebird::M
|
||||
Database* dbb = tdbb->getDatabase();
|
||||
|
||||
fb_assert(view);
|
||||
if (view->isEmpty())
|
||||
{
|
||||
DYN_error_punt(false, 212);
|
||||
// msg 212: "Zero length identifiers not allowed"
|
||||
}
|
||||
|
||||
jrd_req* request = CMP_find_request(tdbb, drq_s_view_rels, DYN_REQUESTS);
|
||||
SSHORT id = drq_s_view_rels;
|
||||
|
@ -1371,37 +1371,6 @@ do_punt: // ugly, rethink logic of this function
|
||||
}
|
||||
|
||||
|
||||
void DYN_delete_security_class( Global* gbl, const UCHAR** ptr)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* D Y N _ d e l e t e _ s e c u r i t y _ c l a s s
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Execute a dynamic ddl statement that
|
||||
* deletes a security class.
|
||||
*
|
||||
**************************************/
|
||||
Firebird::MetaName security_class;
|
||||
|
||||
GET_STRING(ptr, security_class);
|
||||
|
||||
if (!DYN_delete_security_class2(gbl->gbl_transaction, security_class))
|
||||
{
|
||||
DYN_error_punt(false, 75);
|
||||
// msg 75: "Security class not found"
|
||||
}
|
||||
|
||||
while (*(*ptr)++ != isc_dyn_end)
|
||||
{
|
||||
--(*ptr);
|
||||
DYN_execute(gbl, ptr, NULL, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DYN_delete_shadow( Global* gbl, const UCHAR** ptr)
|
||||
{
|
||||
/**************************************
|
||||
|
@ -39,11 +39,9 @@ void DYN_define_index(Jrd::Global*, const UCHAR**, const Firebird::MetaName*, UC
|
||||
void DYN_define_local_field(Jrd::Global*, const UCHAR**, const Firebird::MetaName*, Firebird::MetaName*);
|
||||
void DYN_define_relation(Jrd::Global*, const UCHAR**, bool view);
|
||||
void DYN_define_role(Jrd::Global*, const UCHAR**);
|
||||
void DYN_define_security_class(Jrd::Global*, const UCHAR**);
|
||||
void DYN_define_shadow(Jrd::Global*, const UCHAR**);
|
||||
void DYN_define_sql_field(Jrd::Global*, const UCHAR**, const Firebird::MetaName*, Firebird::MetaName*);
|
||||
void DYN_define_trigger(Jrd::Global*, const UCHAR**, const Firebird::MetaName*, Firebird::MetaName*, const bool);
|
||||
void DYN_define_trigger_msg(Jrd::Global*, const UCHAR**, const Firebird::MetaName*);
|
||||
void DYN_define_view_relation(Jrd::Global*, const UCHAR**, const Firebird::MetaName*);
|
||||
void DYN_define_difference(Jrd::Global*, const UCHAR**);
|
||||
|
||||
|
@ -35,7 +35,6 @@ void DYN_delete_index(Jrd::Global*, const UCHAR**);
|
||||
void DYN_delete_local_field(Jrd::Global*, const UCHAR**, const Firebird::MetaName*);
|
||||
void DYN_delete_relation(Jrd::Global*, const UCHAR**, const Firebird::MetaName*);
|
||||
void DYN_delete_role(Jrd::Global*, const UCHAR**);
|
||||
void DYN_delete_security_class(Jrd::Global*, const UCHAR**);
|
||||
bool DYN_delete_security_class2(Jrd::jrd_tra* transaction, const Firebird::MetaName& security_class);
|
||||
void DYN_delete_shadow(Jrd::Global*, const UCHAR**);
|
||||
|
||||
|
@ -81,15 +81,9 @@ using namespace Firebird;
|
||||
|
||||
DATABASE DB = STATIC "ODS.RDB";
|
||||
|
||||
//const int MAX_CHARS_SHORT = 6; // 2**16 = 5 chars + sign
|
||||
//const int MAX_CHARS_LONG = 11; // 2**32 = 10 chars + sign
|
||||
//const int MAX_CHARS_INT64 = 20; // 2**64 = 19 chars + sign
|
||||
//const int MAX_CHARS_DOUBLE = 22; // 15 digits + 2 signs + E + decimal + 3 digit exp
|
||||
//const int MAX_CHARS_FLOAT = 13; // 7 digits + 2 signs + E + decimal + 2 digit exp
|
||||
|
||||
static const UCHAR alloc_info[] = { isc_info_allocation, isc_info_end };
|
||||
static void change_backup_mode(Global*, UCHAR verb);
|
||||
|
||||
static void change_backup_mode(Global*, UCHAR verb);
|
||||
static void modify_lfield_position(thread_db*, Global*, const MetaName&, const MetaName&,
|
||||
USHORT, USHORT);
|
||||
static bool check_view_dependency(thread_db*, Global*, const MetaName&, const MetaName&);
|
||||
@ -468,58 +462,53 @@ void DYN_modify_global_field(Global* gbl,
|
||||
{
|
||||
MetaName newfld;
|
||||
|
||||
if (GET_STRING(ptr, newfld))
|
||||
GET_STRING(ptr, newfld);
|
||||
|
||||
if (!domain_exists(tdbb, gbl, newfld))
|
||||
{
|
||||
if (!domain_exists(tdbb, gbl, newfld))
|
||||
{
|
||||
MODIFY FLD USING
|
||||
strcpy(FLD.RDB$FIELD_NAME, newfld.c_str());
|
||||
FLD.RDB$FIELD_NAME.NULL = FALSE;
|
||||
jrd_req* old_request = request;
|
||||
request = NULL;
|
||||
// CVC: Let's update the dimensions, too.
|
||||
if (has_dimensions)
|
||||
{
|
||||
FOR (REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
DIM_DOM IN RDB$FIELD_DIMENSIONS
|
||||
WITH DIM_DOM.RDB$FIELD_NAME EQ orig_dom.dyn_fld_name.c_str()
|
||||
MODIFY DIM_DOM USING
|
||||
strcpy (DIM_DOM.RDB$FIELD_NAME, newfld.c_str());
|
||||
DIM_DOM.RDB$FIELD_NAME.NULL = FALSE;
|
||||
END_MODIFY;
|
||||
END_FOR;
|
||||
CMP_release (tdbb, request);
|
||||
request = NULL;
|
||||
}
|
||||
// CVC: End modification.
|
||||
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
DOM IN RDB$RELATION_FIELDS
|
||||
WITH DOM.RDB$FIELD_SOURCE EQ orig_dom.dyn_fld_name.c_str()
|
||||
MODIFY DOM USING
|
||||
strcpy(DOM.RDB$FIELD_SOURCE, newfld.c_str());
|
||||
DOM.RDB$FIELD_SOURCE.NULL = FALSE;
|
||||
MODIFY FLD USING
|
||||
strcpy(FLD.RDB$FIELD_NAME, newfld.c_str());
|
||||
FLD.RDB$FIELD_NAME.NULL = FALSE;
|
||||
jrd_req* old_request = request;
|
||||
request = NULL;
|
||||
// CVC: Let's update the dimensions, too.
|
||||
if (has_dimensions)
|
||||
{
|
||||
FOR (REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
DIM_DOM IN RDB$FIELD_DIMENSIONS
|
||||
WITH DIM_DOM.RDB$FIELD_NAME EQ orig_dom.dyn_fld_name.c_str()
|
||||
MODIFY DIM_DOM USING
|
||||
strcpy (DIM_DOM.RDB$FIELD_NAME, newfld.c_str());
|
||||
DIM_DOM.RDB$FIELD_NAME.NULL = FALSE;
|
||||
END_MODIFY;
|
||||
modify_lfield_index(tdbb, gbl,
|
||||
DOM.RDB$RELATION_NAME,
|
||||
DOM.RDB$FIELD_NAME,
|
||||
DOM.RDB$FIELD_NAME);
|
||||
END_FOR;
|
||||
CMP_release(tdbb, request);
|
||||
request = old_request;
|
||||
END_MODIFY;
|
||||
}
|
||||
else
|
||||
{
|
||||
DYN_error_punt(false, 204, SafeArg() << orig_dom.dyn_fld_name.c_str() <<
|
||||
newfld.c_str());
|
||||
// msg 204: Cannot rename domain %s to %s. A domain with that name already exists.
|
||||
}
|
||||
CMP_release (tdbb, request);
|
||||
request = NULL;
|
||||
}
|
||||
// CVC: End modification.
|
||||
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
DOM IN RDB$RELATION_FIELDS
|
||||
WITH DOM.RDB$FIELD_SOURCE EQ orig_dom.dyn_fld_name.c_str()
|
||||
MODIFY DOM USING
|
||||
strcpy(DOM.RDB$FIELD_SOURCE, newfld.c_str());
|
||||
DOM.RDB$FIELD_SOURCE.NULL = FALSE;
|
||||
END_MODIFY;
|
||||
modify_lfield_index(tdbb, gbl,
|
||||
DOM.RDB$RELATION_NAME,
|
||||
DOM.RDB$FIELD_NAME,
|
||||
DOM.RDB$FIELD_NAME);
|
||||
END_FOR;
|
||||
CMP_release(tdbb, request);
|
||||
request = old_request;
|
||||
END_MODIFY;
|
||||
}
|
||||
else
|
||||
{
|
||||
DYN_error_punt(false, 212);
|
||||
// msg 212: "Zero length identifiers not allowed"
|
||||
DYN_error_punt(false, 204, SafeArg() << orig_dom.dyn_fld_name.c_str() <<
|
||||
newfld.c_str());
|
||||
// msg 204: Cannot rename domain %s to %s. A domain with that name already exists.
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1160,11 +1149,6 @@ void DYN_modify_local_field(Global* gbl, const UCHAR** ptr, const MetaName* rela
|
||||
{
|
||||
MetaName new_fld;
|
||||
GET_STRING(&new_name, new_fld);
|
||||
if (new_fld.length() == 0)
|
||||
{
|
||||
DYN_error_punt(false, 212);
|
||||
// msg 212: "Zero length identifiers not allowed"
|
||||
}
|
||||
|
||||
check_view_dependency(tdbb, gbl, r, f);
|
||||
check_sptrig_dependency(tdbb, gbl, r, f);
|
||||
@ -1334,77 +1318,6 @@ void DYN_modify_relation( Global* gbl, const UCHAR** ptr)
|
||||
}
|
||||
|
||||
|
||||
void DYN_modify_trigger_msg( Global* gbl, const UCHAR** ptr, MetaName* trigger_name)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* D Y N _ m o d i f y _ t r i g g e r _ m s g
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Modify a trigger message.
|
||||
*
|
||||
**************************************/
|
||||
MetaName t;
|
||||
|
||||
thread_db* tdbb = JRD_get_thread_data();
|
||||
Database* dbb = tdbb->getDatabase();
|
||||
|
||||
jrd_req* request = CMP_find_request(tdbb, drq_m_trg_msg, DYN_REQUESTS);
|
||||
|
||||
try {
|
||||
|
||||
const int number = DYN_get_number(ptr);
|
||||
if (trigger_name)
|
||||
t = *trigger_name;
|
||||
else if (*(*ptr)++ == isc_dyn_trg_name)
|
||||
GET_STRING(ptr, t);
|
||||
else
|
||||
DYN_error_punt(false, 103); // msg 103: "TRIGGER NAME expected"
|
||||
|
||||
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||
X IN RDB$TRIGGER_MESSAGES
|
||||
WITH X.RDB$MESSAGE_NUMBER EQ number AND X.RDB$TRIGGER_NAME EQ t.c_str()
|
||||
|
||||
if (!DYN_REQUEST(drq_m_trg_msg))
|
||||
DYN_REQUEST(drq_m_trg_msg) = request;
|
||||
|
||||
MODIFY X
|
||||
UCHAR verb;
|
||||
while ((verb = *(*ptr)++) != isc_dyn_end)
|
||||
switch (verb)
|
||||
{
|
||||
case isc_dyn_trg_msg_number:
|
||||
X.RDB$MESSAGE_NUMBER = DYN_get_number(ptr);
|
||||
X.RDB$MESSAGE_NUMBER.NULL = FALSE;
|
||||
break;
|
||||
|
||||
case isc_dyn_trg_msg:
|
||||
GET_STRING(ptr, X.RDB$MESSAGE);
|
||||
X.RDB$MESSAGE.NULL = FALSE;
|
||||
break;
|
||||
|
||||
default:
|
||||
DYN_unsupported_verb();
|
||||
}
|
||||
END_MODIFY;
|
||||
END_FOR;
|
||||
|
||||
if (!DYN_REQUEST(drq_m_trg_msg))
|
||||
DYN_REQUEST(drq_m_trg_msg) = request;
|
||||
|
||||
}
|
||||
catch (const Exception& ex)
|
||||
{
|
||||
stuff_exception(tdbb->tdbb_status_vector, ex);
|
||||
DYN_rundown_request(request, -1);
|
||||
DYN_error_punt(true, 105);
|
||||
// msg 105: "MODIFY TRIGGER MESSAGE failed"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DYN_modify_view( Global* gbl, const UCHAR** ptr)
|
||||
{
|
||||
/**************************************
|
||||
@ -1423,12 +1336,6 @@ void DYN_modify_view( Global* gbl, const UCHAR** ptr)
|
||||
MetaName view_name;
|
||||
GET_STRING(ptr, view_name);
|
||||
|
||||
if (view_name.length() == 0)
|
||||
{
|
||||
DYN_error_punt(false, 212);
|
||||
// msg 212: "Zero length identifiers not allowed"
|
||||
}
|
||||
|
||||
jrd_req* request = NULL;
|
||||
bool found = false;
|
||||
|
||||
@ -2012,7 +1919,6 @@ void DYN_modify_sql_field(Global* gbl, const UCHAR** ptr, const MetaName* relati
|
||||
*
|
||||
**************************************/
|
||||
thread_db* tdbb = JRD_get_thread_data();
|
||||
//Database* dbb = tdbb->getDatabase();
|
||||
|
||||
dyn_fld orig_fld, new_fld, dom_fld;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user