diff --git a/src/jrd/dyn_def.epp b/src/jrd/dyn_def.epp index 3388b0c471..6156ae987a 100644 --- a/src/jrd/dyn_def.epp +++ b/src/jrd/dyn_def.epp @@ -160,8 +160,7 @@ 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" */ + 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); @@ -495,8 +494,8 @@ void DYN_define_constraint(Global* gbl, relation_name->c_str(), referred_index_name.c_str()); id = old_id; - /* check that we have references permissions on the table and - fields that the index:referred_index_name is on. */ + // check that we have references permissions on the table and + // fields that the index:referred_index_name is on. SCL_check_index(tdbb, referred_index_name, 0, SCL_sql_references); } @@ -576,8 +575,8 @@ void DYN_define_constraint(Global* gbl, try { -/* Make sure unique field names were specified for UNIQUE/PRIMARY/FOREIGN */ -/* All fields must have the NOT NULL attribute specified for UNIQUE/PRIMARY. */ + // Make sure unique field names were specified for UNIQUE/PRIMARY/FOREIGN + // All fields must have the NOT NULL attribute specified for UNIQUE/PRIMARY. request = CMP_find_request(tdbb, drq_c_unq_nam, DYN_REQUESTS); id = drq_c_unq_nam; @@ -617,7 +616,7 @@ void DYN_define_constraint(Global* gbl, if (!not_null) { DYN_error_punt(false, 123, null_field_name.c_str()); - /* msg 123: "Field: %s not defined as NOT NULL - can't be used in PRIMARY KEY constraint definition" */ + // msg 123: "Field: %s not defined as NOT NULL - can't be used in PRIMARY KEY constraint definition" } request = CMP_find_request(tdbb, drq_n_idx_seg, DYN_REQUESTS); @@ -639,8 +638,8 @@ void DYN_define_constraint(Global* gbl, goto dyn_punt_false_124; } -/* For PRIMARY KEY/UNIQUE constraints, make sure same set of columns - is not used in another constraint of either type */ + // For PRIMARY KEY/UNIQUE constraints, make sure same set of columns + // is not used in another constraint of either type if (!foreign_flag) { @@ -699,7 +698,8 @@ void DYN_define_constraint(Global* gbl, } } else - { /* Foreign key being defined */ + { + // Foreign key being defined request = CMP_find_request(tdbb, drq_s_ref_con, DYN_REQUESTS); id = drq_s_ref_con; @@ -736,7 +736,7 @@ void DYN_define_constraint(Global* gbl, else if (ri_action & FOR_KEY_UPD_NONE) strcpy(REF.RDB$UPDATE_RULE, RI_ACTION_NONE); else - /* RESTRICT is the default value for this column */ + // RESTRICT is the default value for this column strcpy(REF.RDB$UPDATE_RULE, RI_RESTRICT); @@ -750,7 +750,7 @@ void DYN_define_constraint(Global* gbl, else if (ri_action & FOR_KEY_DEL_NONE) strcpy(REF.RDB$DELETE_RULE, RI_ACTION_NONE); else - /* RESTRICT is the default value for this column */ + // RESTRICT is the default value for this column strcpy(REF.RDB$DELETE_RULE, RI_RESTRICT); END_FOR; @@ -807,12 +807,12 @@ void DYN_define_constraint(Global* gbl, dyn_punt_false_124: DYN_error_punt(false, 124, constraint_name.c_str()); - /* msg 124: "A column name is repeated in the definition of constraint: %s" */ + // msg 124: "A column name is repeated in the definition of constraint: %s" return; dyn_punt_false_126: DYN_error_punt(false, 126); - /* msg 126: "Same set of columns cannot be used in more than one PRIMARY KEY and/or UNIQUE constraint definition" */ + // msg 126: "Same set of columns cannot be used in more than one PRIMARY KEY and/or UNIQUE constraint definition" } @@ -886,7 +886,7 @@ void DYN_define_dimension(Global* gbl, if (b_ending_store) { DYN_rundown_request(request, drq_s_dims); DYN_error_punt(true, 3); - /* msg 3: "STORE RDB$FIELD_DIMENSIONS failed" */ + // msg 3: "STORE RDB$FIELD_DIMENSIONS failed" } throw; } @@ -1220,13 +1220,13 @@ void DYN_define_difference(Global* gbl, { DYN_rundown_request(request, drq_s_difference); DYN_error_punt(true, 150); - /* msg 150: STORE RDB$FILES failed */ + // msg 150: STORE RDB$FILES failed } else { DYN_rundown_request(request, drq_l_difference); DYN_error_punt(true, 156); - /* msg 156: Difference file lookup failed */ + // msg 156: Difference file lookup failed } } @@ -1234,7 +1234,7 @@ void DYN_define_difference(Global* gbl, dyn_punt_216: DYN_error_punt(false, 216); - /* msg 216: "Difference file is already defined" */ + // msg 216: "Difference file is already defined" } @@ -1259,7 +1259,7 @@ void DYN_define_filter( Global* gbl, const UCHAR** ptr) if (filter_name.length() == 0) { DYN_error_punt(false, 212); - /* msg 212: "Zero length identifiers not allowed" */ + // msg 212: "Zero length identifiers not allowed" } jrd_req* request = CMP_find_request(tdbb, drq_s_filters, DYN_REQUESTS); @@ -1325,7 +1325,7 @@ void DYN_define_filter( Global* gbl, const UCHAR** ptr) if (b_ending_store) { DYN_rundown_request(request, drq_s_filters); DYN_error_punt(true, 7); - /* msg 7: "DEFINE BLOB FILTER failed" */ + // msg 7: "DEFINE BLOB FILTER failed" } throw; } @@ -1388,7 +1388,7 @@ void DYN_define_function( Global* gbl, const UCHAR** ptr) X.RDB$RETURN_ARGUMENT.NULL = FALSE; if (X.RDB$RETURN_ARGUMENT > MAX_UDF_ARGUMENTS) DYN_error_punt(true, 10); - /* msg 10: "DEFINE FUNCTION failed" */ + // msg 10: "DEFINE FUNCTION failed" break; case isc_dyn_func_module_name: @@ -1430,7 +1430,7 @@ void DYN_define_function( Global* gbl, const UCHAR** ptr) if (b_ending_store) { DYN_rundown_request(request, drq_s_funcs); DYN_error_punt(true, 10); - /* msg 10: "DEFINE FUNCTION failed" */ + // msg 10: "DEFINE FUNCTION failed" } throw; } @@ -1470,8 +1470,7 @@ void DYN_define_function_arg(Global* gbl, const UCHAR** ptr, Firebird::MetaName* X.RDB$ARGUMENT_POSITION = (SSHORT)DYN_get_number(ptr); if (X.RDB$ARGUMENT_POSITION > MAX_UDF_ARGUMENTS) - DYN_error_punt(true, 12); - /* msg 12: "DEFINE FUNCTION ARGUMENT failed" */ + DYN_error_punt(true, 12); // msg 12: "DEFINE FUNCTION ARGUMENT failed" if (function_name) { strcpy(X.RDB$FUNCTION_NAME, function_name->c_str()); @@ -1532,10 +1531,9 @@ void DYN_define_function_arg(Global* gbl, const UCHAR** ptr, Firebird::MetaName* X.RDB$FIELD_PRECISION.NULL = FALSE; break; - /* Ignore the field character length as the system UDF parameter - * table has no place to store the information - * But IB6/FB has the place for this information. CVC 2001. - */ + // Ignore the field character length as the system UDF parameter + // table has no place to store the information + // But IB6/FB has the place for this information. CVC 2001. case isc_dyn_fld_char_length: if (ENCODE_ODS(major_version, minor_version) < ODS_10_0) { @@ -1565,7 +1563,7 @@ void DYN_define_function_arg(Global* gbl, const UCHAR** ptr, Firebird::MetaName* DYN_rundown_request(request, drq_s_func_args); } DYN_error_punt(true, 12); - /* msg 12: "DEFINE FUNCTION ARGUMENT failed" */ + // msg 12: "DEFINE FUNCTION ARGUMENT failed" } } @@ -1591,7 +1589,7 @@ void DYN_define_generator( Global* gbl, const UCHAR** ptr) if (generator_name.length() == 0) { DYN_error_punt(false, 212); - /* msg 212: "Zero length identifiers not allowed" */ + // msg 212: "Zero length identifiers not allowed" } DdlNode::executeDdlTrigger(tdbb, gbl->gbl_transaction, DdlNode::DTW_BEFORE, @@ -1658,7 +1656,7 @@ void DYN_define_generator( Global* gbl, const UCHAR** ptr) Firebird::stuff_exception(tdbb->tdbb_status_vector, ex); if (b_ending_store) { DYN_error_punt(true, 8); - /* msg 8: "DEFINE GENERATOR failed" */ + // msg 8: "DEFINE GENERATOR failed" } throw; } @@ -1666,7 +1664,7 @@ void DYN_define_generator( Global* gbl, const UCHAR** ptr) if (*(*ptr)++ != isc_dyn_end) { DYN_error_punt(true, 9); - /* msg 9: "DEFINE GENERATOR unexpected dyn verb" */ + // msg 9: "DEFINE GENERATOR unexpected dyn verb" } DdlNode::executeDdlTrigger(tdbb, gbl->gbl_transaction, DdlNode::DTW_AFTER, @@ -1706,7 +1704,7 @@ void DYN_define_global_field(Global* gbl, if (global_field_name.length() == 0) { DYN_error_punt(false, 212); - /* msg 212: "Zero length identifiers not allowed" */ + // msg 212: "Zero length identifiers not allowed" } DdlNode::executeDdlTrigger(tdbb, gbl->gbl_transaction, DdlNode::DTW_BEFORE, @@ -1937,7 +1935,7 @@ void DYN_define_global_field(Global* gbl, if (b_ending_store) { DYN_rundown_request(request, drq_s_gfields); DYN_error_punt(true, 13); - /* msg 13: "STORE RDB$FIELDS failed" */ + // msg 13: "STORE RDB$FIELDS failed" } throw; } @@ -1988,7 +1986,7 @@ void DYN_define_index(Global* gbl, } if (index_name.length() == 0) { DYN_error_punt(false, 212); - /* msg 212: "Zero length identifiers not allowed" */ + // msg 212: "Zero length identifiers not allowed" } DdlNode::executeDdlTrigger(tdbb, gbl->gbl_transaction, DdlNode::DTW_BEFORE, @@ -2026,14 +2024,13 @@ void DYN_define_index(Global* gbl, else if (*(*ptr)++ == isc_dyn_rel_name) GET_STRING(ptr, IDX.RDB$RELATION_NAME); else - DYN_error_punt(false, 14); - /* msg 14: "No relation specified for index" */ + DYN_error_punt(false, 14); // msg 14: "No relation specified for index" IDX.RDB$RELATION_NAME.NULL = FALSE; IDX.RDB$SYSTEM_FLAG = 0; IDX.RDB$SYSTEM_FLAG.NULL = FALSE; - /* Check if the table is actually a view */ + // Check if the table is actually a view old_request = request; SSHORT old_id = id; @@ -2048,8 +2045,7 @@ void DYN_define_index(Global* gbl, DYN_REQUEST(drq_l_view_idx) = request; if (!VREL.RDB$VIEW_BLR.NULL) - DYN_error_punt(false, 181); - /* msg 181: "attempt to index a view" */ + DYN_error_punt(false, 181); // msg 181: "attempt to index a view" END_FOR; if (!DYN_REQUEST(drq_l_view_idx)) @@ -2058,9 +2054,8 @@ void DYN_define_index(Global* gbl, request = old_request; id = old_id; - /* The previous 2 lines and the next two lines can be - * deleted as long as no code is added in the middle. - */ + // The previous 2 lines and the next two lines can be + // deleted as long as no code is added in the middle. old_request = request; old_id = id; @@ -2119,25 +2114,25 @@ void DYN_define_index(Global* gbl, if (GF.RDB$FIELD_TYPE == blr_blob) { DYN_error_punt(false, 116, IDX.RDB$INDEX_NAME); - /* msg 116 "attempt to index blob field in index %s" */ + // msg 116 "attempt to index blob field in index %s" } else if (!GF.RDB$DIMENSIONS.NULL) { DYN_error_punt(false, 117, IDX.RDB$INDEX_NAME); - /* msg 117 "attempt to index array field in index %s" */ + // msg 117 "attempt to index array field in index %s" } else if (!GF.RDB$COMPUTED_BLR.NULL) { DYN_error_punt(false, 179, IDX.RDB$INDEX_NAME); - /* msg 179 "attempt to index COMPUTED BY field in index %s" */ + // msg 179 "attempt to index COMPUTED BY field in index %s" } else if (GF.RDB$FIELD_TYPE == blr_varying || GF.RDB$FIELD_TYPE == blr_text) { - /* Compute the length of the key segment allowing - for international information. Note that we - must convert a type - to an index type in order to compute the length */ + // Compute the length of the key segment allowing + // for international information. Note that we + // must convert a type + // to an index type in order to compute the length if (!F.RDB$COLLATION_ID.NULL) { length = @@ -2180,7 +2175,7 @@ void DYN_define_index(Global* gbl, break; } - /* for expression indices, store the BLR and the source string */ + // for expression indices, store the BLR and the source string case isc_dyn_fld_computed_blr: DYN_put_blr_blob(gbl, ptr, &IDX.RDB$EXPRESSION_BLR); @@ -2192,13 +2187,13 @@ void DYN_define_index(Global* gbl, IDX.RDB$EXPRESSION_SOURCE.NULL = FALSE; break; - /* for foreign keys, point to the corresponding relation */ + // for foreign keys, point to the corresponding relation case isc_dyn_idx_foreign_key: GET_STRING(ptr, referenced_relation); if (referenced_relation.length() == 0) { DYN_error_punt(false, 212); - /* msg 212: "Zero length identifiers not allowed" */ + // msg 212: "Zero length identifiers not allowed" } break; @@ -2256,7 +2251,7 @@ void DYN_define_index(Global* gbl, (*ri_actionP) |= FOR_KEY_DEL_NONE; break; default: - fb_assert(0); /* should not come here */ + fb_assert(0); // should not come here DYN_unsupported_verb(); } break; @@ -2302,7 +2297,7 @@ void DYN_define_index(Global* gbl, (*ri_actionP) |= FOR_KEY_UPD_NONE; break; default: - fb_assert(0); /* should not come here */ + fb_assert(0); // should not come here DYN_unsupported_verb(); } break; @@ -2314,13 +2309,11 @@ void DYN_define_index(Global* gbl, key_length = ROUNDUP(key_length, sizeof(SLONG)); if (key_length >= MAX_KEY) - DYN_error_punt(false, 118, IDX.RDB$INDEX_NAME); - /* msg 118 "key size too big for index %s" */ + DYN_error_punt(false, 118, IDX.RDB$INDEX_NAME); // msg 118 "key size too big for index %s" if (seg_count) { if (seg_count != fld_count) - DYN_error_punt(false, 120, IDX.RDB$INDEX_NAME); - /* msg 118 "Unknown fields in index %s" */ + DYN_error_punt(false, 120, IDX.RDB$INDEX_NAME); // msg 118 "Unknown fields in index %s" old_request = request; old_id = id; @@ -2347,14 +2340,14 @@ void DYN_define_index(Global* gbl, } if (field_list.getCount()) { - /* If referring columns count <> referred columns return error */ + // If referring columns count <> referred columns return error if (seg_count != referred_cols) DYN_error_punt(true, 133); - /* msg 133: "Number of referencing columns do not equal number of referenced columns */ + // msg 133: "Number of referencing columns do not equal number of referenced columns - /* lookup a unique index in the referenced relation with the - referenced fields mentioned */ + // lookup a unique index in the referenced relation with the + // referenced fields mentioned old_request = request; old_id = id; @@ -2390,8 +2383,8 @@ void DYN_define_index(Global* gbl, found = true; } - /* if there are no more fields or the field name doesn't - match, then this is not the correct index */ + // if there are no more fields or the field name doesn't + // match, then this is not the correct index if (list_index >= 0) { fb_utils::exact_name_limit(ISEG.RDB$FIELD_NAME, sizeof(ISEG.RDB$FIELD_NAME)); @@ -2466,13 +2459,13 @@ void DYN_define_index(Global* gbl, if (!DYN_REQUEST(drq_l_primary)) DYN_REQUEST(drq_l_primary) = request; - /* Number of columns in referred index should be same as number - of columns in referring index */ + // Number of columns in referred index should be same as number + // of columns in referring index fb_assert(IND.RDB$SEGMENT_COUNT >= 0); if (seg_count != ULONG(IND.RDB$SEGMENT_COUNT)) DYN_error_punt(true, 133); - /* msg 133: "Number of referencing columns do not equal number of referenced columns" */ + // msg 133: "Number of referencing columns do not equal number of referenced columns" fb_utils::exact_name_limit(IND.RDB$INDEX_NAME, sizeof(IND.RDB$INDEX_NAME)); strcpy(IDX.RDB$FOREIGN_KEY, IND.RDB$INDEX_NAME); @@ -2507,12 +2500,12 @@ void DYN_define_index(Global* gbl, if (id == drq_s_indices) { DYN_rundown_request(request, id); DYN_error_punt(true, 21); - /* msg 21: "STORE RDB$INDICES failed" */ + // msg 21: "STORE RDB$INDICES failed" } else if (id == drq_s_idx_segs) { DYN_rundown_request(request, id); DYN_error_punt(true, 15); - /* msg 15: "STORE RDB$INDEX_SEGMENTS failed" */ + // msg 15: "STORE RDB$INDEX_SEGMENTS failed" } DYN_rundown_request(request, -1); @@ -2521,23 +2514,23 @@ void DYN_define_index(Global* gbl, { case drq_l_idx_name: DYN_error_punt(true, 21); - /* msg 21: "STORE RDB$INDICES failed" */ + // msg 21: "STORE RDB$INDICES failed" break; case drq_l_lfield: DYN_error_punt(true, 15); - /* msg 15: "STORE RDB$INDEX_SEGMENTS failed" */ + // msg 15: "STORE RDB$INDEX_SEGMENTS failed" break; case drq_l_unq_idx: DYN_error_punt(true, 17); - /* msg 17: "Primary Key field lookup failed" */ + // msg 17: "Primary Key field lookup failed" break; case drq_l_view_idx: DYN_error_punt(true, 180); - /* msg 180: "Table Name lookup failed" */ + // msg 180: "Table Name lookup failed" break; case drq_l_primary: DYN_error_punt(true, 19); - /* msg 19: "Primary Key lookup failed" */ + // msg 19: "Primary Key lookup failed" break; default: fb_assert(false); @@ -2578,7 +2571,7 @@ void DYN_define_local_field(Global* gbl, if (local_field_name.length() == 0) { DYN_error_punt(false, 212); - /* msg 212: "Zero length identifiers not allowed" */ + // msg 212: "Zero length identifiers not allowed" } jrd_req* request = NULL; @@ -2871,12 +2864,12 @@ void DYN_define_local_field(Global* gbl, if (id == drq_s_lfields) { DYN_rundown_request(request, id); DYN_error_punt(true, 23); - /* msg 23: "STORE RDB$RELATION_FIELDS failed" */ + // msg 23: "STORE RDB$RELATION_FIELDS failed" } else { DYN_rundown_request(request, id); DYN_error_punt(true, 22); - /* msg 22: "STORE RDB$FIELDS failed" */ + // msg 22: "STORE RDB$FIELDS failed" } } } @@ -2905,7 +2898,7 @@ void DYN_define_relation(Global* gbl, const UCHAR** ptr, bool view) if (relation_name.length() == 0) { DYN_error_punt(false, 212); - /* msg 212: "Zero length identifiers not allowed" */ + // msg 212: "Zero length identifiers not allowed" } DdlNode::executeDdlTrigger(tdbb, gbl->gbl_transaction, DdlNode::DTW_BEFORE, @@ -3036,8 +3029,7 @@ void DYN_define_relation(Global* gbl, const UCHAR** ptr, bool view) if (sql_prot) { if (!get_who(tdbb, gbl, owner_name)) - DYN_error_punt(true, 115); - /* msg 115: "CREATE VIEW failed" */ + DYN_error_punt(true, 115); // msg 115: "CREATE VIEW failed" if (rel_type == rel_view) { jrd_req* old_request = request; @@ -3052,8 +3044,8 @@ void DYN_define_relation(Global* gbl, const UCHAR** ptr, bool view) if (!DYN_REQUEST(drq_l_view_rels)) DYN_REQUEST(drq_l_view_rels) = request; - /* CVC: This never matches so it causes unnecessary calls to verify, - so I included a call to strip trailing blanks. */ + // CVC: This never matches so it causes unnecessary calls to verify, + // so I included a call to strip trailing blanks. fb_utils::exact_name_limit(PREL.RDB$OWNER_NAME, sizeof(PREL.RDB$OWNER_NAME)); if (owner_name != PREL.RDB$OWNER_NAME) { SecurityClass::flags_t priv; @@ -3062,7 +3054,7 @@ void DYN_define_relation(Global* gbl, const UCHAR** ptr, bool view) // I think this should be the responsability of DFW // or the user will find ways to circumvent DYN. DYN_error_punt(true, 115); - /* msg 115: "CREATE VIEW failed" */ + // msg 115: "CREATE VIEW failed" } if (!(priv & SCL_read)) { @@ -3071,9 +3063,9 @@ void DYN_define_relation(Global* gbl, const UCHAR** ptr, bool view) Arg::Str("TABLE/VIEW") << // Non-Translatable // We want to print the name of the base table or view. Arg::Str(PREL.RDB$RELATION_NAME)); - /* msg 32: no permission for %s access to %s %s */ + // msg 32: no permission for %s access to %s %s DYN_error_punt(true, 115); - /* msg 115: "CREATE VIEW failed" */ + // msg 115: "CREATE VIEW failed" } } END_FOR; @@ -3133,12 +3125,12 @@ void DYN_define_relation(Global* gbl, const UCHAR** ptr, bool view) if (id == drq_s_rels) { DYN_rundown_request(request, id); DYN_error_punt(true, 24); - /* msg 24: "STORE RDB$RELATIONS failed" */ + // msg 24: "STORE RDB$RELATIONS failed" } else if (id == drq_s_usr_prvs) { DYN_rundown_request(request, id); DYN_error_punt(true, 25); - /* msg 25: "STORE RDB$USER_PRIVILEGES failed defining a relation" */ + // msg 25: "STORE RDB$USER_PRIVILEGES failed defining a relation" } DYN_rundown_request(request, -1); @@ -3146,18 +3138,18 @@ void DYN_define_relation(Global* gbl, const UCHAR** ptr, bool view) switch (id) { case drq_l_rel_name: - DYN_error_punt(true, 24); /* msg 24: "STORE RDB$RELATIONS failed" */ + DYN_error_punt(true, 24); // msg 24: "STORE RDB$RELATIONS failed" break; case drq_l_view_rels: - DYN_error_punt(true, 115); /* msg 115: "CREATE VIEW failed" */ + DYN_error_punt(true, 115); // msg 115: "CREATE VIEW failed" break; case drq_l_rel_info2: ERR_punt(); break; } - /* Control should never reach this point, because id should - always have one of the values test-for above. */ + // Control should never reach this point, because id should + // always have one of the values test-for above. fb_assert(false); DYN_error_punt(true, 0); } @@ -3204,21 +3196,13 @@ void DYN_define_role( Global* gbl, const UCHAR** ptr) DDL_TRIGGER_CREATE_ROLE, role_name, gbl->sqlText); if (role_name == owner_name) { - /************************************************ - ** - ** user name could not be used for SQL role - ** - *************************************************/ + // user name could not be used for SQL role DYN_error(false, 193, SafeArg() << owner_name.c_str()); ERR_punt(); } if (role_name == NULL_ROLE) { - /************************************************ - ** - ** keyword NONE could not be used as SQL role name - ** - *************************************************/ + // keyword NONE could not be used as SQL role name DYN_error(false, 195, SafeArg() << role_name.c_str()); ERR_punt(); } @@ -3226,22 +3210,14 @@ void DYN_define_role( Global* gbl, const UCHAR** ptr) try { if (is_it_user_name(gbl, role_name, tdbb)) { - /************************************************ - ** - ** user name could not be used for SQL role - ** - *************************************************/ + // user name could not be used for SQL role DYN_error(false, 193, SafeArg() << role_name.c_str()); goto do_err_punt; } Firebird::MetaName dummy_name; if (DYN_is_it_sql_role(gbl, role_name, dummy_name, tdbb)) { - /************************************************ - ** - ** SQL role already exist - ** - *************************************************/ + // SQL role @1 already exists DYN_error(false, 194, SafeArg() << role_name.c_str()); goto do_err_punt; } @@ -3281,7 +3257,7 @@ void DYN_define_role( Global* gbl, const UCHAR** ptr) DYN_rundown_request(request, drq_role_gens); } DYN_error_punt(true, 8); - /* msg 8: "DEFINE ROLE failed" */ + // msg 8: "DEFINE ROLE failed" } DdlNode::executeDdlTrigger(tdbb, gbl->gbl_transaction, DdlNode::DTW_AFTER, @@ -3295,7 +3271,7 @@ do_err_punt: do_error_punt_9: DYN_error_punt(true, 9); - /* msg 9: "DEFINE ROLE unexpected dyn verb" */ + // msg 9: "DEFINE ROLE unexpected dyn verb" } @@ -3359,7 +3335,7 @@ void DYN_define_security_class( Global* gbl, const UCHAR** ptr) if (b_ending_store) { DYN_rundown_request(request, drq_s_classes); DYN_error_punt(true, 27); - /* msg 27: "STORE RDB$RELATIONS failed" */ + // msg 27: "STORE RDB$RELATIONS failed" } throw; } @@ -3394,7 +3370,7 @@ void DYN_define_sql_field(Global* gbl, if (sql_field_name.length() == 0) { DYN_error_punt(false, 212); - /* msg 212: "Zero length identifiers not allowed" */ + // msg 212: "Zero length identifiers not allowed" } jrd_req* request = NULL; @@ -3602,11 +3578,10 @@ void DYN_define_sql_field(Global* gbl, break; case isc_dyn_fld_collation: - /* Note: the global field's collation is not set, just - * the local field. There is no full "domain" - * created for the local field. - * This is the same decision for items like NULL_FLAG - */ + // Note: the global field's collation is not set, just + // the local field. There is no full "domain" + // created for the local field. + // This is the same decision for items like NULL_FLAG RFR.RDB$COLLATION_ID = DYN_get_number(ptr); RFR.RDB$COLLATION_ID.NULL = FALSE; break; @@ -3661,12 +3636,12 @@ void DYN_define_sql_field(Global* gbl, if (id == drq_s_sql_lfld) { DYN_rundown_request(request, id); DYN_error_punt(true, 29); - /* msg 29: "STORE RDB$RELATION_FIELDS failed" */ + // msg 29: "STORE RDB$RELATION_FIELDS failed" } else { DYN_rundown_request(request, id); DYN_error_punt(true, 28); - /* msg 28: "STORE RDB$FIELDS failed" */ + // msg 28: "STORE RDB$FIELDS failed" } } } @@ -3692,8 +3667,7 @@ void DYN_define_shadow( Global* gbl, const UCHAR** ptr) const SLONG shadow_number = DYN_get_number(ptr); -/* If a shadow set identified by the - shadow number already exists return error. */ + // If a shadow set identified by the shadow number already exists return error. jrd_req* request = CMP_find_request(tdbb, drq_l_shadow, DYN_REQUESTS); @@ -3712,12 +3686,12 @@ void DYN_define_shadow( Global* gbl, const UCHAR** ptr) Firebird::stuff_exception(tdbb->tdbb_status_vector, ex); DYN_rundown_request(request, drq_l_shadow); DYN_error_punt(true, 164); - /* msg 164: "Shadow lookup failed" */ + // msg 164: "Shadow lookup failed" } if (found) { DYN_error_punt(false, 165, SafeArg() << shadow_number); - /* msg 165: "Shadow %ld already exists" */ + // msg 165: "Shadow %ld already exists" } SLONG start = 0; @@ -3776,7 +3750,7 @@ void DYN_define_trigger(Global* gbl, if (t.length() == 0) { DYN_error_punt(false, 212); - /* msg 212: "Zero length identifiers not allowed" */ + // msg 212: "Zero length identifiers not allowed" } if (trigger_name) { @@ -3803,12 +3777,12 @@ void DYN_define_trigger(Global* gbl, X.RDB$ENTRYPOINT.NULL = TRUE; X.RDB$ENGINE_NAME.NULL = TRUE; - /* currently, we make no difference between ignoring permissions in - order to define this trigger and ignoring permissions checks when the - trigger fires. The RDB$FLAGS is used to indicate permissions checks - when the trigger fires. Later, if we need to make a difference - between these, then the caller should pass the required value - of RDB$FLAGS as an extra argument to this func. */ + // Currently, we make no difference between ignoring permissions in + // order to define this trigger and ignoring permissions checks when the + // trigger fires. The RDB$FLAGS is used to indicate permissions checks + // when the trigger fires. Later, if we need to make a difference + // between these, then the caller should pass the required value + // of RDB$FLAGS as an extra argument to this func. X.RDB$FLAGS = ignore_perm ? TRG_ignore_perm : 0; X.RDB$FLAGS.NULL = FALSE; @@ -3879,8 +3853,8 @@ void DYN_define_trigger(Global* gbl, case isc_dyn_system_flag: X.RDB$SYSTEM_FLAG = DYN_get_number(ptr); X.RDB$SYSTEM_FLAG.NULL = FALSE; - /* fb_assert(!ignore_perm || ignore_perm && - X.RDB$SYSTEM_FLAG == fb_sysflag_referential_constraint); */ + // fb_assert(!ignore_perm || ignore_perm && + // X.RDB$SYSTEM_FLAG == fb_sysflag_referential_constraint); break; case isc_dyn_debug_info: @@ -3912,12 +3886,12 @@ void DYN_define_trigger(Global* gbl, b_ending_store = true; -/* the END_STORE_SPECIAL adds the foll. lines of code to the END_STORE - if (ignore_perm) - request->req_flags |= req_ignore_perm; - after the request is compiled and before the request is sent. - It makes the current request (to define the trigger) go through - without checking any permissions lower in the engine */ + // the END_STORE_SPECIAL adds the foll. lines of code to the END_STORE + // if (ignore_perm) + // request->req_flags |= req_ignore_perm; + // after the request is compiled and before the request is sent. + // It makes the current request (to define the trigger) go through + // without checking any permissions lower in the engine END_STORE_SPECIAL; @@ -3954,7 +3928,7 @@ void DYN_define_trigger(Global* gbl, if (b_ending_store) { DYN_rundown_request(request, drq_s_triggers); DYN_error_punt(true, 31); - /* msg 31: "DEFINE TRIGGER failed" */ + // msg 31: "DEFINE TRIGGER failed" } throw; } @@ -4028,7 +4002,7 @@ void DYN_define_trigger_msg(Global* gbl, const UCHAR** ptr, const Firebird::Meta if (b_ending_store) { DYN_rundown_request(request, drq_s_trg_msgs); DYN_error_punt(true, 33); - /* msg 33: "DEFINE TRIGGER MESSAGE failed" */ + // msg 33: "DEFINE TRIGGER MESSAGE failed" } throw; } @@ -4054,7 +4028,7 @@ void DYN_define_view_relation( Global* gbl, const UCHAR** ptr, const Firebird::M fb_assert(view); if (view->length() == 0) { DYN_error_punt(false, 212); - /* msg 212: "Zero length identifiers not allowed" */ + // msg 212: "Zero length identifiers not allowed" } jrd_req* request = CMP_find_request(tdbb, drq_s_view_rels, DYN_REQUESTS); @@ -4063,11 +4037,11 @@ void DYN_define_view_relation( Global* gbl, const UCHAR** ptr, const Firebird::M bool b_ending_store = false; try { -/* - * The below code has been added for ALTER VIEW support, - * but implementation was definitely wrong, - * so it's commented our till the better times - * + // The below code has been added for ALTER VIEW support, + // but implementation was definitely wrong, + // so it's commented our till the better times + + /* const SSHORT old_id = id; jrd_req* old_request = request; @@ -4088,7 +4062,8 @@ void DYN_define_view_relation( Global* gbl, const UCHAR** ptr, const Firebird::M request = old_request; id = old_id; -*/ + */ + STORE(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction) VRL IN RDB$VIEW_RELATIONS strcpy(VRL.RDB$VIEW_NAME, view->c_str()); @@ -4137,12 +4112,12 @@ void DYN_define_view_relation( Global* gbl, const UCHAR** ptr, const Firebird::M if (id == drq_s_view_rels) { DYN_error_punt(true, 34); - /* msg 34: "STORE RDB$VIEW_RELATIONS failed" */ + // msg 34: "STORE RDB$VIEW_RELATIONS failed" } else if (id == drq_e_view_rels) { DYN_error_punt(true, 59); - /* msg 59: "ERASE RDB$VIEW_RELATIONS failed" */ + // msg 59: "ERASE RDB$VIEW_RELATIONS failed" } } throw; @@ -4211,8 +4186,8 @@ bool is_it_user_name(Global* gbl, const Firebird::MetaName& role_name, thread_db try { -/* If there is a user with privilege or a grantor on a relation we - can infer there is a user with this name */ + // If there is a user with privilege or a grantor on a relation we + // can infer there is a user with this name request_id = drq_get_user_priv; request = CMP_find_request(tdbb, request_id, DYN_REQUESTS); @@ -4234,9 +4209,9 @@ bool is_it_user_name(Global* gbl, const Firebird::MetaName& role_name, thread_db return found; } -/* We can infer that 'role_name' is a user name if it owns any relations - Note we can only get here if a user creates a table and revokes all - his privileges on the table */ + // We can infer that 'role_name' is a user name if it owns any relations + // Note we can only get here if a user creates a table and revokes all + // his privileges on the table request_id = drq_get_rel_owner; request = CMP_find_request(tdbb, request_id, DYN_REQUESTS); diff --git a/src/jrd/dyn_del.epp b/src/jrd/dyn_del.epp index 4cf6da1337..9e27d11747 100644 --- a/src/jrd/dyn_del.epp +++ b/src/jrd/dyn_del.epp @@ -247,22 +247,20 @@ void DYN_delete_constraint (Global* gbl, const UCHAR** ptr, const Firebird::Meta **************************************/ Firebird::MetaName rel_name, constraint; -/* GET name of the constraint to be deleted */ + // Get name of the constraint to be deleted GET_STRING(ptr, constraint); if (relation) rel_name = *relation; else if (*(*ptr)++ != isc_dyn_rel_name) { - DYN_error_punt(false, 128); - /* msg 128: "No relation specified in delete_constraint" */ + DYN_error_punt(false, 128); // msg 128: "No relation specified in delete_constraint" } else GET_STRING(ptr, rel_name); if (!delete_constraint_records(gbl, constraint, rel_name)) - DYN_error_punt(false, 130, constraint.c_str()); - /* msg 130: "CONSTRAINT %s does not exist." */ + DYN_error_punt(false, 130, constraint.c_str()); // msg 130: "CONSTRAINT %s does not exist." } @@ -348,7 +346,7 @@ void DYN_delete_exception( Global* gbl, const UCHAR** ptr) Firebird::stuff_exception(tdbb->tdbb_status_vector, ex); DYN_rundown_request(request, -1); DYN_error_punt(true, 143); - /* msg 143: "ERASE EXCEPTION failed" */ + // msg 143: "ERASE EXCEPTION failed" } if (found) @@ -359,7 +357,7 @@ void DYN_delete_exception( Global* gbl, const UCHAR** ptr) else { DYN_error_punt(false, 144); - /* msg 144: "Exception not found" */ + // msg 144: "Exception not found" } if (*(*ptr)++ != isc_dyn_end) { @@ -409,12 +407,12 @@ void DYN_delete_filter( Global* gbl, const UCHAR** ptr) Firebird::stuff_exception(tdbb->tdbb_status_vector, ex); DYN_rundown_request(request, -1); DYN_error_punt(true, 36); - /* msg 36: "ERASE BLOB FILTER failed" */ + // msg 36: "ERASE BLOB FILTER failed" } if (!found) { DYN_error_punt(false, 37, f.c_str()); - /* msg 37: "Blob Filter %s not found" */ + // msg 37: "Blob Filter %s not found" } if (*(*ptr)++ != isc_dyn_end) { @@ -472,7 +470,7 @@ void DYN_delete_generator(Global* gbl, const UCHAR**ptr) Firebird::stuff_exception(tdbb->tdbb_status_vector, ex); DYN_rundown_request(request, -1); DYN_error_punt(true, 213); - /* msg 213: "ERASE GENERATOR failed" */ + // msg 213: "ERASE GENERATOR failed" } if (found) @@ -483,7 +481,7 @@ void DYN_delete_generator(Global* gbl, const UCHAR**ptr) else { DYN_error_punt(false, 214, t.c_str()); - /* msg 214: "Generator %s not found" */ + // msg 214: "Generator %s not found" } } @@ -574,7 +572,7 @@ void DYN_delete_global_field( Global* gbl, const UCHAR** ptr) Firebird::stuff_exception(tdbb->tdbb_status_vector, ex); DYN_rundown_request(request, -1); DYN_error_punt(true, 44); - /* msg 44: "ERASE RDB$FIELDS failed" */ + // msg 44: "ERASE RDB$FIELDS failed" } if (found) @@ -644,7 +642,7 @@ void DYN_delete_index( Global* gbl, const UCHAR** ptr) Firebird::stuff_exception(tdbb->tdbb_status_vector, ex); DYN_rundown_request(request, -1); DYN_error_punt(true, 47); - /* msg 47: "ERASE RDB$INDICES failed" */ + // msg 47: "ERASE RDB$INDICES failed" } if (found) @@ -655,14 +653,14 @@ void DYN_delete_index( Global* gbl, const UCHAR** ptr) else { DYN_error_punt(false, 48); - /* msg 48: "Index not found" */ + // msg 48: "Index not found" } if (!is_expression) if (!delete_index_segment_records(gbl, idx_name)) { DYN_error_punt(false, 50); - /* msg 50: "No segments found for index" */ + // msg 50: "No segments found for index" } while (*(*ptr)++ != isc_dyn_end) { @@ -723,7 +721,7 @@ void DYN_delete_local_field(Global* gbl, tbl_nm = *relation_name; else if (*(*ptr)++ != isc_dyn_rel_name) { DYN_error_punt(false, 51); - /* msg 51: "No relation specified in ERASE RFR" */ + // msg 51: "No relation specified in ERASE RFR" } else GET_STRING(ptr, tbl_nm); @@ -735,13 +733,8 @@ void DYN_delete_local_field(Global* gbl, try { -/* -** ================================================================ -** == -** == make sure that column is not referenced in any views -** == -** ================================================================ -*/ + // make sure that column is not referenced in any views + FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction) X IN RDB$RELATION_FIELDS CROSS Y IN RDB$RELATION_FIELDS CROSS Z IN RDB$VIEW_RELATIONS WITH @@ -757,21 +750,16 @@ void DYN_delete_local_field(Global* gbl, DYN_rundown_request(request, -1); DYN_error_punt(false, 52, SafeArg() << col_nm.c_str() << tbl_nm.c_str() << Y.RDB$RELATION_NAME); - /* msg 52: "field %s from relation %s is referenced in view %s" */ + // msg 52: "field %s from relation %s is referenced in view %s" END_FOR; if (!DYN_REQUEST(drq_l_dep_flds)) DYN_REQUEST(drq_l_dep_flds) = request; -/* -** =============================================================== -** == -** == If the column to be dropped is being used as a foreign key -** == and the column was not part of any compound foreign key, -** == then we can drop the column. But we have to drop the foreign key -** == constraint first. -** == -** =============================================================== -*/ + + // If the column to be dropped is being used as a foreign key + // and the column was not part of any compound foreign key, + // then we can drop the column. But we have to drop the foreign key + // constraint first. request = CMP_find_request(tdbb, drq_g_rel_constr_nm, DYN_REQUESTS); id = drq_g_rel_constr_nm; @@ -799,7 +787,7 @@ void DYN_delete_local_field(Global* gbl, DYN_rundown_request(request, -1); DYN_error_punt(false, 187, SafeArg() << col_nm.c_str() << tbl_nm.c_str() << IDX.RDB$INDEX_NAME); - /* msg 187: "field %s from relation %s is referenced in index %s" */ + // msg 187: "field %s from relation %s is referenced in index %s" } END_FOR; @@ -807,17 +795,11 @@ void DYN_delete_local_field(Global* gbl, if (!DYN_REQUEST(drq_g_rel_constr_nm)) DYN_REQUEST(drq_g_rel_constr_nm) = request; -/* -** ================================================================ -** == -** == make sure that column is not referenced in any user-defined indexes -** == -** == NOTE: You still could see the system generated indices even though -** == they were already been deleted when dropping column that was -** == used as foreign key before "commit". -** == -** ================================================================ -*/ + // make sure that column is not referenced in any user-defined indexes + + // NOTE: You still could see the system generated indices even though + // they were already been deleted when dropping column that was + // used as foreign key before "commit". request = CMP_find_request(tdbb, drq_e_l_idx, DYN_REQUESTS); id = drq_e_l_idx; @@ -1238,7 +1220,7 @@ void DYN_delete_relation( Global* gbl, const UCHAR** ptr, const Firebird::MetaNa dyn_punt_61: DYN_error_punt(false, 61); - /* msg 61: "Relation not found" */ + // msg 61: "Relation not found" } @@ -1321,8 +1303,8 @@ void DYN_delete_role( Global* gbl, const UCHAR** ptr) id = drq_del_role_1; - /* The first OR clause Finds all members of the role - The 2nd OR clause Finds all privileges granted to the role */ + // The first OR clause finds all members of the role. + // The 2nd OR clause finds all privileges granted to the role FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction) PRIV IN RDB$USER_PRIVILEGES WITH (PRIV.RDB$RELATION_NAME EQ role_name.c_str() AND @@ -1397,7 +1379,7 @@ void DYN_delete_security_class( Global* gbl, const UCHAR** ptr) if (!DYN_delete_security_class2(gbl->gbl_transaction, security_class)) { DYN_error_punt(false, 75); - /* msg 75: "Security class not found" */ + // msg 75: "Security class not found" } while (*(*ptr)++ != isc_dyn_end) { @@ -1449,7 +1431,7 @@ void DYN_delete_shadow( Global* gbl, const UCHAR** ptr) Firebird::stuff_exception(tdbb->tdbb_status_vector, ex); DYN_rundown_request(request, -1); DYN_error_punt(true, 63); - /* msg 63: "ERASE RDB$FILES failed" */ + // msg 63: "ERASE RDB$FILES failed" } if (*(*ptr)++ != isc_dyn_end) { @@ -1503,7 +1485,7 @@ static bool delete_constraint_records(Global* gbl, Firebird::stuff_exception(tdbb->tdbb_status_vector, ex); DYN_rundown_request(request, -1); DYN_error_punt(true, 129); - /* msg 129: "ERASE RDB$RELATION_CONSTRAINTS failed" */ + // msg 129: "ERASE RDB$RELATION_CONSTRAINTS failed" } return found; @@ -1552,7 +1534,7 @@ static bool delete_dimension_records(Global* gbl, Firebird::stuff_exception(tdbb->tdbb_status_vector, ex); DYN_rundown_request(request, -1); DYN_error_punt(true, 35); - /* msg 35: "ERASE RDB$FIELDS failed" */ + // msg 35: "ERASE RDB$FIELDS failed" } return found; @@ -1623,14 +1605,14 @@ static void delete_f_key_constraint(thread_db* tdbb, if (!found) { DYN_error_punt(false, 130, constraint_nm.c_str()); - /* msg 130: "CONSTRAINT %s does not exist." */ + // msg 130: "CONSTRAINT %s does not exist." } } catch (const Firebird::Exception& ex) { Firebird::stuff_exception(tdbb->tdbb_status_vector, ex); DYN_rundown_request(request, -1); DYN_error_punt(true, 129); - /* msg 49: "ERASE RDB$RELATION_CONSTRAINTS failed" */ + // msg 49: "ERASE RDB$RELATION_CONSTRAINTS failed" } } @@ -1717,7 +1699,7 @@ static bool delete_index_segment_records(Global* gbl, Firebird::stuff_exception(tdbb->tdbb_status_vector, ex); DYN_rundown_request(request, -1); DYN_error_punt(true, 49); - /* msg 49: "ERASE RDB$INDEX_SEGMENTS failed" */ + // msg 49: "ERASE RDB$INDEX_SEGMENTS failed" } return found; @@ -1768,7 +1750,7 @@ bool DYN_delete_security_class2(jrd_tra* transaction, const Firebird::MetaName& Firebird::stuff_exception(tdbb->tdbb_status_vector, ex); DYN_rundown_request(request, -1); DYN_error_punt(true, 74); - /* msg 74: "ERASE RDB$SECURITY_CLASSES failed" */ + // msg 74: "ERASE RDB$SECURITY_CLASSES failed" } return found; diff --git a/src/jrd/dyn_mod.epp b/src/jrd/dyn_mod.epp index a4b9d37896..8c1105d30b 100644 --- a/src/jrd/dyn_mod.epp +++ b/src/jrd/dyn_mod.epp @@ -722,7 +722,7 @@ void DYN_modify_global_field(Global* gbl, orig_dom.dyn_collation = FLD.RDB$COLLATION_ID; orig_dom.dyn_null_flag = FLD.RDB$NULL_FLAG != 0; - /* If the original field type is an array, force its blr type to blr_blob */ + // If the original field type is an array, force its blr type to blr_blob bool has_dimensions = false; if (FLD.RDB$DIMENSIONS != 0) { @@ -750,7 +750,7 @@ void DYN_modify_global_field(Global* gbl, FLD.RDB$FIELD_NAME.NULL = FALSE; jrd_req* old_request = request; request = NULL; - /* CVC: Let's update the dimensions, too. */ + // CVC: Let's update the dimensions, too. if (has_dimensions) { FOR (REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction) @@ -764,7 +764,7 @@ void DYN_modify_global_field(Global* gbl, CMP_release (tdbb, request); request = NULL; } - /* CVC: End modification. */ + // 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() @@ -785,13 +785,13 @@ void DYN_modify_global_field(Global* gbl, { 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. */ + // msg 204: Cannot rename domain %s to %s. A domain with that name already exists. } } else { DYN_error_punt(false, 212); - /* msg 212: "Zero length identifiers not allowed" */ + // msg 212: "Zero length identifiers not allowed" } break; } @@ -800,9 +800,9 @@ void DYN_modify_global_field(Global* gbl, GET_STRING(ptr, new_dom.dyn_rel_name); break; - /* CVC: The syntax for DDL alter domain was accepting multiple - changes in one command even to the same features, IE two length alterations. - This repetitive type change will cause havoc so it should be stopped in the future. */ + // CVC: The syntax for DDL alter domain was accepting multiple + // changes in one command even to the same features, IE two length alterations. + // This repetitive type change will cause havoc so it should be stopped in the future. case isc_dyn_fld_length: fldlen = true; @@ -939,7 +939,7 @@ void DYN_modify_global_field(Global* gbl, if (single_validate) { EXE_unwind(tdbb, request); DYN_error_punt(false, 160); - /* msg 160: "Only one constraint allowed for a domain" */ + // msg 160: "Only one constraint allowed for a domain" break; } @@ -950,7 +950,7 @@ void DYN_modify_global_field(Global* gbl, if (single_validate && (!FLD.RDB$VALIDATION_BLR.NULL)) { EXE_unwind(tdbb, request); DYN_error_punt(false, 160); - /* msg 160: "Only one constraint allowed for a domain" */ + // msg 160: "Only one constraint allowed for a domain" break; } @@ -1006,9 +1006,8 @@ void DYN_modify_global_field(Global* gbl, new_dom.dyn_dtype = blr_blob; break; - /* These should only be defined for BLOB types and should not come through with - * any other types. Do nothing with them. - */ + // These should only be defined for BLOB types and should not come through with + // any other types. Do nothing with them. case isc_dyn_fld_segment_length: DYN_get_number(ptr); @@ -1021,9 +1020,8 @@ void DYN_modify_global_field(Global* gbl, } - /* Now that we have all of the information needed, let's check to see if the field type can be modifed. - * Only do this, however, if we are actually modifying the datatype of the domain. - */ + // Now that we have all of the information needed, let's check to see if the field type can be modifed. + // Only do this, however, if we are actually modifying the datatype of the domain. if (dtype) { DSC_make_descriptor(&new_dom.dyn_dsc, @@ -1043,7 +1041,7 @@ void DYN_modify_global_field(Global* gbl, FLD.RDB$FIELD_TYPE = new_dom.dyn_dtype; FLD.RDB$FIELD_TYPE.NULL = FALSE; - /* If the datatype was changed, update any indexes that involved the domain */ + // If the datatype was changed, update any indexes that involved the domain jrd_req* old_request = request; request = NULL; @@ -1091,7 +1089,7 @@ void DYN_modify_global_field(Global* gbl, } if (fldlen) { - /* CVC: Rescue from the wrong field_length with a helper. */ + // CVC: Rescue from the wrong field_length with a helper. if (new_dom.dyn_dsc.dsc_dtype <= dtype_varying && new_dom.dyn_charbytelen) FLD.RDB$FIELD_LENGTH = new_dom.dyn_charbytelen; else @@ -1185,7 +1183,7 @@ void DYN_modify_global_field(Global* gbl, stuff_exception(tdbb->tdbb_status_vector, ex); DYN_rundown_request(request, -1); DYN_error_punt(true, 87); - /* msg 87: "MODIFY RDB$FIELDS failed" */ + // msg 87: "MODIFY RDB$FIELDS failed" } if (found) @@ -1196,7 +1194,7 @@ void DYN_modify_global_field(Global* gbl, else { DYN_error_punt(false, 89); - /* msg 89: "Global field not found" */ + // msg 89: "Global field not found" } } @@ -1258,7 +1256,7 @@ void DYN_modify_index( Global* gbl, const UCHAR** ptr) IDX.RDB$DESCRIPTION.NULL = TRUE; break; - /* For V4 index selectivity can be set only to -1 */ + // For V4 index selectivity can be set only to -1 case isc_dyn_idx_statistic: IDX.RDB$STATISTICS = -1.0; @@ -1290,7 +1288,7 @@ void DYN_modify_index( Global* gbl, const UCHAR** ptr) else { DYN_error_punt(false, 48); - /* msg 48: "Index not found" */ + // msg 48: "Index not found" } } @@ -1440,7 +1438,7 @@ void DYN_modify_local_field(Global* gbl, if (new_fld.length() == 0) { DYN_error_punt(false, 212); - /* msg 212: "Zero length identifiers not allowed" */ + // msg 212: "Zero length identifiers not allowed" } check_view_dependency(tdbb, gbl, r, f); @@ -1452,7 +1450,7 @@ void DYN_modify_local_field(Global* gbl, else { DYN_error_punt(false, 205, SafeArg() << f.c_str() << new_fld.c_str() << r.c_str()); - /* msg 205: Cannot rename field %s to %s. A field with that name already exists in table %s. */ + // msg 205: Cannot rename field %s to %s. A field with that name already exists in table %s. } } @@ -1500,7 +1498,7 @@ void DYN_modify_local_field(Global* gbl, stuff_exception(tdbb->tdbb_status_vector, ex); DYN_rundown_request(request, -1); DYN_error_punt(true, 95); - /* msg 95: "MODIFY RDB$RELATION_FIELDS failed" */ + // msg 95: "MODIFY RDB$RELATION_FIELDS failed" } if (!found) @@ -1569,12 +1567,12 @@ void DYN_modify_relation( Global* gbl, const UCHAR** ptr) if (REL.RDB$EXTERNAL_FILE.NULL) { DYN_rundown_request(request, -1); DYN_error_punt(false, 97); - /* msg 97: "add EXTERNAL FILE not allowed" */ + // msg 97: "add EXTERNAL FILE not allowed" } if (!GET_STRING(ptr, REL.RDB$EXTERNAL_FILE)) { DYN_rundown_request(request, -1); DYN_error_punt(false, 98); - /* msg 98: "drop EXTERNAL FILE not allowed" */ + // msg 98: "drop EXTERNAL FILE not allowed" } break; @@ -1600,7 +1598,7 @@ void DYN_modify_relation( Global* gbl, const UCHAR** ptr) stuff_exception(tdbb->tdbb_status_vector, ex); DYN_rundown_request(request, -1); DYN_error_punt(true, 99); - /* msg 99: "MODIFY RDB$RELATIONS failed" */ + // msg 99: "MODIFY RDB$RELATIONS failed" } if (found) @@ -1611,7 +1609,7 @@ void DYN_modify_relation( Global* gbl, const UCHAR** ptr) else { DYN_error_punt(false, 101); - /* msg 101: "Relation field not found" */ + // msg 101: "Relation field not found" } } @@ -1713,8 +1711,7 @@ void DYN_modify_trigger_msg( Global* gbl, const UCHAR** ptr, MetaName* trigger_n else if (*(*ptr)++ == isc_dyn_trg_name) GET_STRING(ptr, t); else - DYN_error_punt(false, 103); - /* msg 103: "TRIGGER NAME expected" */ + DYN_error_punt(false, 103); // msg 103: "TRIGGER NAME expected" FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction) X IN RDB$TRIGGER_MESSAGES @@ -1752,7 +1749,7 @@ void DYN_modify_trigger_msg( Global* gbl, const UCHAR** ptr, MetaName* trigger_n stuff_exception(tdbb->tdbb_status_vector, ex); DYN_rundown_request(request, -1); DYN_error_punt(true, 105); - /* msg 105: "MODIFY TRIGGER MESSAGE failed" */ + // msg 105: "MODIFY TRIGGER MESSAGE failed" } } @@ -1778,7 +1775,7 @@ void DYN_modify_view( Global* gbl, const UCHAR** ptr) if (view_name.length() == 0) { DYN_error_punt(false, 212); - /* msg 212: "Zero length identifiers not allowed" */ + // msg 212: "Zero length identifiers not allowed" } jrd_req* request = NULL; @@ -1900,7 +1897,7 @@ void DYN_modify_view( Global* gbl, const UCHAR** ptr) stuff_exception(tdbb->tdbb_status_vector, ex); DYN_rundown_request(request, -1); DYN_error_punt(true, 99); - /* msg 99: "MODIFY RDB$RELATIONS failed" */ + // msg 99: "MODIFY RDB$RELATIONS failed" } if (found) @@ -1911,7 +1908,7 @@ void DYN_modify_view( Global* gbl, const UCHAR** ptr) else { DYN_error_punt(false, 54, view_name.c_str()); - /* msg 54: "View %s not found" */ + // msg 54: "View %s not found" } } @@ -1993,7 +1990,7 @@ static void change_backup_mode( Global* gbl, UCHAR verb) stuff_exception(tdbb->tdbb_status_vector, ex); DYN_rundown_request(request, drq_d_difference); DYN_error_punt(true, 63); - /* msg 63: ERASE RDB$FILE failed */ + // msg 63: ERASE RDB$FILE failed } if (!found && verb == isc_dyn_begin_backup) { @@ -2021,21 +2018,21 @@ static void change_backup_mode( Global* gbl, UCHAR verb) stuff_exception(tdbb->tdbb_status_vector, ex); DYN_rundown_request(request, drq_s2_difference); DYN_error_punt(true, 150); - /* msg 150: STORE RDB$FILES failed */ + // msg 150: STORE RDB$FILES failed } } if (invalid_state) { DYN_error_punt(false, verb == isc_dyn_begin_backup ? 217 : 218); - /* msg 217: "Database is already in the physical backup mode" */ - /* msg 218: "Database is not in the physical backup mode" */ + // msg 217: "Database is already in the physical backup mode" + // msg 218: "Database is not in the physical backup mode" } if (!found) { DYN_error_punt(false, verb == isc_dyn_end_backup ? 218 : 215); - /* msg 218: "Database is not in the physical backup mode" */ - /* msg 215: "Difference file is not defined" */ + // msg 218: "Database is not in the physical backup mode" + // msg 215: "Difference file is not defined" } } @@ -2077,22 +2074,20 @@ static void modify_lfield_position(thread_db* tdbb, try { -/* Find the position of the last field in the relation */ + // Find the position of the last field in the relation SLONG max_position = -1; DYN_UTIL_generate_field_position(tdbb, gbl, relation_name, &max_position); -/* if the existing position of the field is less than the new position of - * the field, subtract 1 to move the fields to their new positions otherwise, - * increase the value in RDB$FIELD_POSITION by one - */ + // If the existing position of the field is less than the new position of + // the field, subtract 1 to move the fields to their new positions otherwise, + // increase the value in RDB$FIELD_POSITION by one bool move_down = false; if (existing_position < new_position) move_down = true; -/* Retrieve the records for the fields which have a position between the - * existing field position and the new field position - */ + // Retrieve the records for the fields which have a position between the + // existing field position and the new field position FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction) FLD IN RDB$RELATION_FIELDS @@ -2100,13 +2095,11 @@ static void modify_lfield_position(thread_db* tdbb, FLD.RDB$FIELD_POSITION >= MIN(new_position, existing_position) AND FLD.RDB$FIELD_POSITION <= MAX(new_position, existing_position) MODIFY FLD USING - /* If the field is the one we want, change the position, otherwise - * increase the value of RDB$FIELD_POSITION - */ + // If the field is the one we want, change the position, otherwise + // increase the value of RDB$FIELD_POSITION if (field_name == FLD.RDB$FIELD_NAME) { if (new_position > max_position) - /* This prevents gaps in the position sequence of the - * fields */ + // This prevents gaps in the position sequence of the fields FLD.RDB$FIELD_POSITION = max_position; else FLD.RDB$FIELD_POSITION = new_position; @@ -2125,9 +2118,9 @@ static void modify_lfield_position(thread_db* tdbb, CMP_release(tdbb, request); request = NULL; -/* Once the field position has been changed, make sure that there are no - * duplicate field positions and no gaps in the position sequence (this can - * not be guaranteed by the query above */ + // Once the field position has been changed, make sure that there are no + // duplicate field positions and no gaps in the position sequence (this can + // not be guaranteed by the query above USHORT new_pos = 0; FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction) @@ -2147,7 +2140,7 @@ static void modify_lfield_position(thread_db* tdbb, catch (const Exception& ex) { stuff_exception(tdbb->tdbb_status_vector, ex); DYN_error_punt(true, 95); - /* msg 95: "MODIFY RDB$RELATION_FIELDS failed" */ + // msg 95: "MODIFY RDB$RELATION_FIELDS failed" } } @@ -2192,7 +2185,7 @@ static bool check_view_dependency(thread_db* tdbb, if (retval) DYN_error_punt(false, 206, SafeArg() << field_name.c_str() << relation_name.c_str() << view_name.c_str()); - /* msg 206: Column %s from table %s is referenced in %s. */ + // msg 206: Column %s from table %s is referenced in %s. return retval; } @@ -2231,7 +2224,7 @@ static bool check_sptrig_dependency(thread_db* tdbb, if (retval) DYN_error_punt(false, 206, SafeArg() << field_name.c_str() << relation_name.c_str() << dep_name.c_str()); - /* msg 206: Column %s from table %s is referenced in %s. */ + // msg 206: Column %s from table %s is referenced in %s. return retval; } @@ -2260,12 +2253,12 @@ static void modify_lfield_index(thread_db* tdbb, IDX.RDB$INDEX_NAME EQ IDXS.RDB$INDEX_NAME AND IDX.RDB$RELATION_NAME EQ relation_name.c_str() AND IDXS.RDB$FIELD_NAME EQ field_name.c_str() - /* Change the name of the field in the index */ + // Change the name of the field in the index MODIFY IDXS USING memcpy(IDXS.RDB$FIELD_NAME, new_fld_name.c_str(), sizeof(IDXS.RDB$FIELD_NAME)); END_MODIFY; - /* Set the index name to itself to tell the index to rebuild */ + // Set the index name to itself to tell the index to rebuild MODIFY IDX USING // This is to fool both gpre and gcc. char* p = IDX.RDB$INDEX_NAME; @@ -3229,10 +3222,10 @@ static ULONG check_update_fld_type(const dyn_fld& orig_fld, **************************************/ -/* Check to make sure that the old and new types are compatible */ + // Check to make sure that the old and new types are compatible switch (orig_fld.dyn_dtype) { -/* CHARACTER types */ + // CHARACTER types case blr_text: case blr_varying: case blr_cstring: @@ -3241,8 +3234,8 @@ static ULONG check_update_fld_type(const dyn_fld& orig_fld, case blr_blob: case blr_blob_id: return isc_dyn_dtype_invalid; - /* Cannot change datatype for column %s. - The operation cannot be performed on BLOB, or ARRAY columns. */ + // Cannot change datatype for column %s. + // The operation cannot be performed on BLOB, or ARRAY columns. break; case blr_sql_date: @@ -3255,22 +3248,22 @@ static ULONG check_update_fld_type(const dyn_fld& orig_fld, case blr_double: case blr_float: return isc_dyn_dtype_conv_invalid; - /* Cannot convert column %s from character to non-character data. */ + // Cannot convert column %s from character to non-character data. break; - /* If the original field is a character field and the new field is a character field, - * is there enough space in the new field? */ + // If the original field is a character field and the new field is a character field, + // is there enough space in the new field? case blr_text: case blr_varying: case blr_cstring: { - /* CVC: Because our caller invoked DSC_make_descriptor() on new_fld previously, - we should have the added bytes for varchar. For cstring, we are done, since - DSC_make_descriptor(DSC_string_length) != DSC_string_length(DSC_make_descriptor). */ + // CVC: Because our caller invoked DSC_make_descriptor() on new_fld previously, + // we should have the added bytes for varchar. For cstring, we are done, since + // DSC_make_descriptor(DSC_string_length) != DSC_string_length(DSC_make_descriptor). const USHORT maxflen = DSC_string_length(&orig_fld.dyn_dsc); - /* We can have this assertion since this case is for both string fields. */ + // We can have this assertion since this case is for both string fields. const ULONG new_len = DSC_string_length(&new_fld.dyn_dsc); fb_assert(new_len - maxflen == (ULONG) new_fld.dyn_charbytelen - orig_fld.dyn_charbytelen); // if (new_fld.dyn_dsc.dsc_length < maxflen) @@ -3282,18 +3275,18 @@ static ULONG check_update_fld_type(const dyn_fld& orig_fld, default: fb_assert(FALSE); - return 87; /* MODIFY RDB$FIELDS FAILED */ + return 87; // MODIFY RDB$FIELDS FAILED } break; -/* BLOB and ARRAY types */ + // BLOB and ARRAY types case blr_blob: case blr_blob_id: return isc_dyn_dtype_invalid; - /* Cannot change datatype for column %s. - The operation cannot be performed on BLOB, or ARRAY columns. */ + // Cannot change datatype for column %s. + // The operation cannot be performed on BLOB, or ARRAY columns. -/* DATE types */ + // DATE types case blr_sql_date: case blr_sql_time: case blr_timestamp: @@ -3302,23 +3295,23 @@ static ULONG check_update_fld_type(const dyn_fld& orig_fld, case blr_sql_date: if (orig_fld.dyn_dtype == blr_sql_time) return isc_dyn_invalid_dtype_conversion; - /* Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. */ + // Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. break; case blr_sql_time: if (orig_fld.dyn_dtype == blr_sql_date) return isc_dyn_invalid_dtype_conversion; - /* Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. */ + // Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. break; case blr_timestamp: if (orig_fld.dyn_dtype == blr_sql_time) return isc_dyn_invalid_dtype_conversion; - /* Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. */ + // Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. break; - /* If the original field is a date field and the new field is a character field, - * is there enough space in the new field? */ + // If the original field is a date field and the new field is a character field, + // is there enough space in the new field? case blr_text: case blr_text2: case blr_varying: @@ -3339,11 +3332,11 @@ static ULONG check_update_fld_type(const dyn_fld& orig_fld, default: return isc_dyn_invalid_dtype_conversion; - /* Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. */ + // Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. } break; -/* NUMERIC types */ + // NUMERIC types case blr_int64: case blr_long: case blr_short: @@ -3355,17 +3348,17 @@ static ULONG check_update_fld_type(const dyn_fld& orig_fld, case blr_blob: case blr_blob_id: return isc_dyn_dtype_invalid; - /* Cannot change datatype for column %s. - The operation cannot be performed on BLOB, or ARRAY columns. */ + // Cannot change datatype for column %s. + // The operation cannot be performed on BLOB, or ARRAY columns. case blr_sql_date: case blr_sql_time: case blr_timestamp: return isc_dyn_invalid_dtype_conversion; - /* Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. */ + // Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. - /* If the original field is a numeric field and the new field is a numeric field, - * is there enough space in the new field (do not allow the base type to decrease) */ + // If the original field is a numeric field and the new field is a numeric field, + // is there enough space in the new field (do not allow the base type to decrease) case blr_short: switch (orig_fld.dyn_dtype) @@ -3375,7 +3368,7 @@ static ULONG check_update_fld_type(const dyn_fld& orig_fld, default: return isc_dyn_invalid_dtype_conversion; - /* Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. */ + // Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. } break; @@ -3388,7 +3381,7 @@ static ULONG check_update_fld_type(const dyn_fld& orig_fld, default: return isc_dyn_invalid_dtype_conversion; - /* Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. */ + // Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. } break; @@ -3401,7 +3394,7 @@ static ULONG check_update_fld_type(const dyn_fld& orig_fld, default: return isc_dyn_invalid_dtype_conversion; - /* Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. */ + // Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. } break; @@ -3415,7 +3408,7 @@ static ULONG check_update_fld_type(const dyn_fld& orig_fld, default: return isc_dyn_invalid_dtype_conversion; - /* Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. */ + // Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. } break; @@ -3432,12 +3425,12 @@ static ULONG check_update_fld_type(const dyn_fld& orig_fld, default: return isc_dyn_invalid_dtype_conversion; - /* Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. */ + // Cannot change datatype for column %s. Conversion from base type %s to base type %s is not supported. } break; - /* If the original field is a numeric field and the new field is a character field, - * is there enough space in the new field? */ + // If the original field is a numeric field and the new field is a character field, + // is there enough space in the new field? case blr_text: case blr_varying: case blr_cstring: @@ -3454,13 +3447,13 @@ static ULONG check_update_fld_type(const dyn_fld& orig_fld, default: fb_assert(FALSE); - return 87; /* MODIFY RDB$FIELDS FAILED */ + return 87; // MODIFY RDB$FIELDS FAILED } break; default: fb_assert(FALSE); - return 87; /* MODIFY RDB$FIELDS FAILED */ + return 87; // MODIFY RDB$FIELDS FAILED } return FB_SUCCESS; } @@ -3520,12 +3513,12 @@ static void modify_err_punt(thread_db* /*tdbb*/, { case isc_dyn_dtype_invalid: DYN_error_punt(false, errorcode, orig_fld_def.dyn_fld_name.c_str()); - /* Cannot change datatype for column %s.The operation cannot be performed on DATE, BLOB, or ARRAY columns. */ + // Cannot change datatype for column %s.The operation cannot be performed on DATE, BLOB, or ARRAY columns. break; case isc_dyn_dtype_conv_invalid: DYN_error_punt(false, errorcode, orig_fld_def.dyn_fld_name.c_str()); - /* Cannot convert column %s from character to non-character data. */ + // Cannot convert column %s from character to non-character data. break; case isc_dyn_char_fld_too_small: @@ -3571,6 +3564,6 @@ static void modify_err_punt(thread_db* /*tdbb*/, default: DYN_error_punt(true, 95); - /* msg 95: "MODIFY RDB$RELATION_FIELDS failed" */ + // msg 95: "MODIFY RDB$RELATION_FIELDS failed" } }