diff --git a/src/dsql/DdlNodes.epp b/src/dsql/DdlNodes.epp index 9bfea9c8da..010ec1bd66 100644 --- a/src/dsql/DdlNodes.epp +++ b/src/dsql/DdlNodes.epp @@ -447,7 +447,7 @@ void CommentOnNode::print(string& text, Array& /*nodes*/) const void CommentOnNode::execute(thread_db* tdbb, jrd_tra* transaction) { Attachment* attachment = transaction->tra_attachment; - Database* dbb = attachment->att_database; + //Database* dbb = attachment->att_database; string table; string column; @@ -505,9 +505,7 @@ void CommentOnNode::execute(thread_db* tdbb, jrd_tra* transaction) status << Arg::Gds(isc_dyn_proc_not_found) << Arg::Str(objName); } - if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_12_0) - addWhere = "rdb$package_name is null"; - + addWhere = "rdb$package_name is null"; column = "rdb$procedure_name"; break; @@ -520,10 +518,7 @@ void CommentOnNode::execute(thread_db* tdbb, jrd_tra* transaction) case ddl_udf: table = "rdb$functions"; column = "rdb$function_name"; - - if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_12_0) - addWhere = "rdb$package_name is null"; - + addWhere = "rdb$package_name is null"; status << Arg::Gds(isc_dyn_func_not_found) << Arg::Str(objName); break; @@ -570,7 +565,7 @@ void CommentOnNode::execute(thread_db* tdbb, jrd_tra* transaction) break; case ddl_package: - dbb->checkOdsForDsql(ODS_12_0); + //dbb->checkOdsForDsql(ODS_12_0); table = "rdb$packages"; column = "rdb$package_name"; @@ -698,13 +693,13 @@ void CreateAlterFunctionNode::execute(thread_db* tdbb, jrd_tra* transaction) void CreateAlterFunctionNode::executeCreate(thread_db* tdbb, jrd_tra* transaction) { - Database* dbb = tdbb->getDatabase(); + //Database* dbb = tdbb->getDatabase(); MetaName metaName(nameInMetaCharSet(tdbb, name)); if (package.isEmpty()) executeDdlTrigger(tdbb, transaction, DTW_BEFORE, DDL_TRIGGER_CREATE_FUNCTION, metaName); - dbb->checkOdsForDsql(ODS_12_0); + //dbb->checkOdsForDsql(ODS_12_0); AutoCacheRequest requestHandle(tdbb, drq_s_funcs2, DYN_REQUESTS); @@ -779,7 +774,7 @@ void CreateAlterFunctionNode::executeCreate(thread_db* tdbb, jrd_tra* transactio bool CreateAlterFunctionNode::executeAlter(thread_db* tdbb, jrd_tra* transaction) { - Database* dbb = tdbb->getDatabase(); + //Database* dbb = tdbb->getDatabase(); MetaName metaName(nameInMetaCharSet(tdbb, name)); bool modified = false; @@ -793,7 +788,7 @@ bool CreateAlterFunctionNode::executeAlter(thread_db* tdbb, jrd_tra* transaction if (package.isEmpty()) executeDdlTrigger(tdbb, transaction, DTW_BEFORE, DDL_TRIGGER_ALTER_FUNCTION, metaName); - dbb->checkOdsForDsql(ODS_12_0); + //dbb->checkOdsForDsql(ODS_12_0); MODIFY FUN FUN.RDB$MODULE_NAME.NULL = TRUE; @@ -1341,7 +1336,7 @@ void CreateAlterProcedureNode::executeCreate(thread_db* tdbb, jrd_tra* transacti bool CreateAlterProcedureNode::executeAlter(thread_db* tdbb, jrd_tra* transaction, bool secondPass, bool runTriggers) { - Database* dbb = tdbb->getDatabase(); + //Database* dbb = tdbb->getDatabase(); MetaName metaName(nameInMetaCharSet(tdbb, name)); AutoCacheRequest requestHandle(tdbb, drq_m_prcs2, DYN_REQUESTS); @@ -1388,7 +1383,7 @@ bool CreateAlterProcedureNode::executeAlter(thread_db* tdbb, jrd_tra* transactio if (external) { - dbb->checkOdsForDsql(ODS_12_0); + //dbb->checkOdsForDsql(ODS_12_0); if (secondPass) { @@ -1469,7 +1464,7 @@ void CreateAlterProcedureNode::storeParameter(thread_db* tdbb, jrd_tra* transact { checkEmptyName(parameter.name); - Database* dbb = tdbb->getDatabase(); + //Database* dbb = tdbb->getDatabase(); AutoCacheRequest requestHandle(tdbb, drq_s_prms4, DYN_REQUESTS); STORE (REQUEST_HANDLE requestHandle TRANSACTION_HANDLE transaction) @@ -1503,14 +1498,14 @@ void CreateAlterProcedureNode::storeParameter(thread_db* tdbb, jrd_tra* transact PRM.RDB$PARAMETER_MECHANISM = (USHORT) (parameter.fullDomain ? prm_mech_normal : prm_mech_type_of); - if (parameter.notNull) - dbb->checkOdsForDsql(ODS_11_1); + //if (parameter.notNull) + // dbb->checkOdsForDsql(ODS_11_1); PRM.RDB$NULL_FLAG.NULL = !parameter.notNull; PRM.RDB$NULL_FLAG = parameter.notNull; - if (parameter.typeOfTable.hasData()) - dbb->checkOdsForDsql(ODS_11_2); + //if (parameter.typeOfTable.hasData()) + // dbb->checkOdsForDsql(ODS_11_2); PRM.RDB$RELATION_NAME.NULL = parameter.typeOfTable.isEmpty(); PRM.RDB$FIELD_NAME.NULL = PRM.RDB$RELATION_NAME.NULL || parameter.typeOfName.isEmpty(); @@ -1809,7 +1804,7 @@ void CreateAlterProcedureNode::compile(thread_db* tdbb, jrd_tra* /*transaction*/ void DropProcedureNode::dropParameters(thread_db* tdbb, jrd_tra* transaction, const Firebird::MetaName& procedureName, const Firebird::MetaName& packageName) { - Database* dbb = tdbb->getDatabase(); + //Database* dbb = tdbb->getDatabase(); AutoCacheRequest requestHandle(tdbb, drq_e_prms2, DYN_REQUESTS); FOR (REQUEST_HANDLE requestHandle TRANSACTION_HANDLE transaction) @@ -1830,8 +1825,8 @@ void DropProcedureNode::dropParameters(thread_db* tdbb, jrd_tra* transaction, { bool erase = true; - if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_2) - { + // Can this loop be merged with the previous? + { // scope AutoCacheRequest requestHandle3(tdbb, drq_d_gfields4, DYN_REQUESTS); FOR (REQUEST_HANDLE requestHandle3 TRANSACTION_HANDLE transaction) @@ -1845,7 +1840,7 @@ void DropProcedureNode::dropParameters(thread_db* tdbb, jrd_tra* transaction, erase = false; } END_FOR - } + } // end scope if (erase) ERASE FLD; @@ -2111,13 +2106,13 @@ void CreateAlterTriggerNode::execute(thread_db* tdbb, jrd_tra* transaction) void CreateAlterTriggerNode::executeCreate(thread_db* tdbb, jrd_tra* transaction) { - Database* dbb = tdbb->getDatabase(); + //Database* dbb = tdbb->getDatabase(); const MetaName metaName(nameInMetaCharSet(tdbb, name)); executeDdlTrigger(tdbb, transaction, DTW_BEFORE, DDL_TRIGGER_CREATE_TRIGGER, metaName); - if (type.specified && (type.value & unsigned(TRIGGER_TYPE_MASK)) == unsigned(TRIGGER_TYPE_DDL)) - dbb->checkOdsForDsql(ODS_12_0); + //if (type.specified && (type.value & unsigned(TRIGGER_TYPE_MASK)) == unsigned(TRIGGER_TYPE_DDL)) + // dbb->checkOdsForDsql(ODS_12_0); AutoCacheRequest requestHandle(tdbb, drq_s_triggers2, DYN_REQUESTS); @@ -2147,7 +2142,7 @@ void CreateAlterTriggerNode::executeCreate(thread_db* tdbb, jrd_tra* transaction bool CreateAlterTriggerNode::executeAlter(thread_db* tdbb, jrd_tra* transaction, bool runTriggers) { - Database* dbb = tdbb->getDatabase(); + //Database* dbb = tdbb->getDatabase(); MetaName metaName(nameInMetaCharSet(tdbb, name)); bool modified = false; @@ -2168,8 +2163,8 @@ bool CreateAlterTriggerNode::executeAlter(thread_db* tdbb, jrd_tra* transaction, Arg::Gds(isc_dsql_db_trigger_type_cant_change)); } - if (type.specified && (type.value & unsigned(TRIGGER_TYPE_MASK)) == unsigned(TRIGGER_TYPE_DDL)) - dbb->checkOdsForDsql(ODS_12_0); + //if (type.specified && (type.value & unsigned(TRIGGER_TYPE_MASK)) == unsigned(TRIGGER_TYPE_DDL)) + // dbb->checkOdsForDsql(ODS_12_0); if (!TRG.RDB$SYSTEM_FLAG.NULL) { @@ -2218,7 +2213,7 @@ bool CreateAlterTriggerNode::executeAlter(thread_db* tdbb, jrd_tra* transaction, if (external) { - dbb->checkOdsForDsql(ODS_12_0); + //dbb->checkOdsForDsql(ODS_12_0); // ODS_12_0 TRG.RDB$ENGINE_NAME.NULL = FALSE; diff --git a/src/dsql/PackageNodes.epp b/src/dsql/PackageNodes.epp index fa57b2b753..4715e17216 100644 --- a/src/dsql/PackageNodes.epp +++ b/src/dsql/PackageNodes.epp @@ -427,7 +427,7 @@ void CreateAlterPackageNode::execute(thread_db* tdbb, jrd_tra* transaction) Database* dbb = tdbb->getDatabase(); - dbb->checkOdsForDsql(ODS_12_0); + //dbb->checkOdsForDsql(ODS_12_0); // run all statements under savepoint control AutoSavePoint savePoint(tdbb, transaction); @@ -600,7 +600,7 @@ void DropPackageNode::execute(thread_db* tdbb, jrd_tra* transaction) Database* dbb = tdbb->getDatabase(); MetaName metaName(nameInMetaCharSet(tdbb, name)); - dbb->checkOdsForDsql(ODS_12_0); + //dbb->checkOdsForDsql(ODS_12_0); // run all statements under savepoint control AutoSavePoint savePoint(tdbb, transaction); @@ -836,7 +836,7 @@ void CreatePackageBodyNode::execute(thread_db* tdbb, jrd_tra* transaction) Database* dbb = tdbb->getDatabase(); const MetaName metaName(nameInMetaCharSet(tdbb, name)); - dbb->checkOdsForDsql(ODS_12_0); + //dbb->checkOdsForDsql(ODS_12_0); // run all statements under savepoint control AutoSavePoint savePoint(tdbb, transaction); @@ -1017,7 +1017,7 @@ void DropPackageBodyNode::execute(thread_db* tdbb, jrd_tra* transaction) Database* dbb = tdbb->getDatabase(); const MetaName metaName(nameInMetaCharSet(tdbb, name)); - dbb->checkOdsForDsql(ODS_12_0); + //dbb->checkOdsForDsql(ODS_12_0); // run all statements under savepoint control AutoSavePoint savePoint(tdbb, transaction); diff --git a/src/dsql/ddl.cpp b/src/dsql/ddl.cpp index 6ea2100dff..8987dfc8af 100644 --- a/src/dsql/ddl.cpp +++ b/src/dsql/ddl.cpp @@ -462,7 +462,7 @@ void DDL_resolve_intl_type2(CompiledStatement* statement, if (field->fld_type_of_name.hasData()) { - statement->req_dbb->dbb_database->checkOdsForDsql(ODS_11_1); + //statement->req_dbb->dbb_database->checkOdsForDsql(ODS_11_1); if (field->fld_type_of_table) { diff --git a/src/dsql/dsql.cpp b/src/dsql/dsql.cpp index 397fd5d640..59dab3239b 100644 --- a/src/dsql/dsql.cpp +++ b/src/dsql/dsql.cpp @@ -1995,10 +1995,10 @@ static dsql_dbb* init(Jrd::Attachment* attachment) case isc_info_ods_version: database->dbb_ods_version = gds__vax_integer(data, l); - if (database->dbb_ods_version < 8) + if (database->dbb_ods_version < 12) { ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) << - Arg::Gds(isc_dsql_too_old_ods) << Arg::Num(8)); + Arg::Gds(isc_dsql_too_old_ods) << Arg::Num(12)); } break; @@ -2006,22 +2006,6 @@ static dsql_dbb* init(Jrd::Attachment* attachment) database->dbb_minor_version = gds__vax_integer(data, l); break; - // This flag indicates the version level of the engine - // itself, so we can tell what capabilities the engine - // code itself (as opposed to the on-disk structure). - // Apparently the base level up to now indicated the major - // version number, but for 4.1 the base level is being - // incremented, so the base level indicates an engine version - // as follows: - // 1 == v1.x - // 2 == v2.x - // 3 == v3.x - // 4 == v4.0 only - // 5 == v4.1. (v5, too?) - // 6 == v6, FB1 - // Note: this info item is so old it apparently uses an - // archaic format, not a standard vax integer format. - case isc_info_db_read_only: fb_assert(l == 1); database->dbb_read_only = (USHORT) data[0] ? true : false; diff --git a/src/dsql/gen.cpp b/src/dsql/gen.cpp index c105e301da..502caf88e1 100644 --- a/src/dsql/gen.cpp +++ b/src/dsql/gen.cpp @@ -716,9 +716,7 @@ void GEN_port(CompiledStatement* statement, dsql_msg* message) parameter->par_desc.dsc_length += adjust; } - else if (ENCODE_ODS(statement->req_dbb->dbb_ods_version, - statement->req_dbb->dbb_minor_version) >= ODS_11_1 && - parameter->par_desc.dsc_dtype == dtype_blob && + else if (parameter->par_desc.dsc_dtype == dtype_blob && parameter->par_desc.dsc_sub_type == isc_blob_text && tdbb->getCharSet() != CS_NONE && tdbb->getCharSet() != CS_BINARY) { diff --git a/src/dsql/metd.epp b/src/dsql/metd.epp index 1d545aafe5..c05187b86c 100644 --- a/src/dsql/metd.epp +++ b/src/dsql/metd.epp @@ -1237,11 +1237,7 @@ dsql_prc* METD_get_procedure(CompiledStatement* statement, const dsql_str* name, for (int type = 0; type < 2; type++) { - dsql_fld** ptr; - if (type) - ptr = &procedure->prc_outputs; - else - ptr = &procedure->prc_inputs; + dsql_fld** const ptr = type ? &procedure->prc_outputs : &procedure->prc_inputs; SSHORT count = 0, defaults = 0; @@ -1266,37 +1262,34 @@ dsql_prc* METD_get_procedure(CompiledStatement* statement, const dsql_str* name, SSHORT pr_null_flag; bool pr_type_of = false; - if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1) - { - jrd_req* handle3 = CMP_find_request(tdbb, irq_parameters2, IRQ_REQUESTS); + jrd_req* handle3 = CMP_find_request(tdbb, irq_parameters2, IRQ_REQUESTS); - const MetaName packageName(PR.RDB$PACKAGE_NAME.NULL ? NULL : PR.RDB$PACKAGE_NAME); + const MetaName packageName(PR.RDB$PACKAGE_NAME.NULL ? NULL : PR.RDB$PACKAGE_NAME); - FOR(REQUEST_HANDLE handle3 TRANSACTION_HANDLE statement->req_transaction) - PR2 IN RDB$PROCEDURE_PARAMETERS - WITH PR2.RDB$PROCEDURE_NAME EQ PR.RDB$PROCEDURE_NAME AND - PR2.RDB$PACKAGE_NAME EQUIV NULLIF(packageName.c_str(), '') AND - PR2.RDB$PARAMETER_NAME EQ PR.RDB$PARAMETER_NAME - - if (!DSQL_REQUEST(irq_parameters2)) - DSQL_REQUEST(irq_parameters2) = handle3; - - pr_collation_id_null = PR2.RDB$COLLATION_ID.NULL; - pr_collation_id = PR2.RDB$COLLATION_ID; - - pr_default_value_null = PR2.RDB$DEFAULT_VALUE.NULL; - - pr_null_flag_null = PR2.RDB$NULL_FLAG.NULL; - pr_null_flag = PR2.RDB$NULL_FLAG; - - if (!PR2.RDB$PARAMETER_MECHANISM.NULL && PR2.RDB$PARAMETER_MECHANISM == prm_mech_type_of) - pr_type_of = true; - - END_FOR + FOR(REQUEST_HANDLE handle3 TRANSACTION_HANDLE statement->req_transaction) + PR2 IN RDB$PROCEDURE_PARAMETERS + WITH PR2.RDB$PROCEDURE_NAME EQ PR.RDB$PROCEDURE_NAME AND + PR2.RDB$PACKAGE_NAME EQUIV NULLIF(packageName.c_str(), '') AND + PR2.RDB$PARAMETER_NAME EQ PR.RDB$PARAMETER_NAME if (!DSQL_REQUEST(irq_parameters2)) DSQL_REQUEST(irq_parameters2) = handle3; - } + + pr_collation_id_null = PR2.RDB$COLLATION_ID.NULL; + pr_collation_id = PR2.RDB$COLLATION_ID; + + pr_default_value_null = PR2.RDB$DEFAULT_VALUE.NULL; + + pr_null_flag_null = PR2.RDB$NULL_FLAG.NULL; + pr_null_flag = PR2.RDB$NULL_FLAG; + + if (!PR2.RDB$PARAMETER_MECHANISM.NULL && PR2.RDB$PARAMETER_MECHANISM == prm_mech_type_of) + pr_type_of = true; + + END_FOR + + if (!DSQL_REQUEST(irq_parameters2)) + DSQL_REQUEST(irq_parameters2) = handle3; count++; // allocate the field block diff --git a/src/jrd/DatabaseSnapshot.cpp b/src/jrd/DatabaseSnapshot.cpp index 87b4fa4021..07dd06b627 100644 --- a/src/jrd/DatabaseSnapshot.cpp +++ b/src/jrd/DatabaseSnapshot.cpp @@ -409,27 +409,16 @@ DatabaseSnapshot::DatabaseSnapshot(thread_db* tdbb, MemoryPool& pool) Database* const dbb = tdbb->getDatabase(); fb_assert(dbb); - const USHORT ods_version = ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version); - // Initialize record buffers - RecordBuffer* const dbb_buffer = - ods_version >= ODS_11_1 ? allocBuffer(tdbb, pool, rel_mon_database) : NULL; - RecordBuffer* const att_buffer = - ods_version >= ODS_11_1 ? allocBuffer(tdbb, pool, rel_mon_attachments) : NULL; - RecordBuffer* const tra_buffer = - ods_version >= ODS_11_1 ? allocBuffer(tdbb, pool, rel_mon_transactions) : NULL; - RecordBuffer* const stmt_buffer = - ods_version >= ODS_11_1 ? allocBuffer(tdbb, pool, rel_mon_statements) : NULL; - RecordBuffer* const call_buffer = - ods_version >= ODS_11_1 ? allocBuffer(tdbb, pool, rel_mon_calls) : NULL; - RecordBuffer* const io_stat_buffer = - ods_version >= ODS_11_1 ? allocBuffer(tdbb, pool, rel_mon_io_stats) : NULL; - RecordBuffer* const rec_stat_buffer = - ods_version >= ODS_11_1 ? allocBuffer(tdbb, pool, rel_mon_rec_stats) : NULL; - RecordBuffer* const ctx_var_buffer = - ods_version >= ODS_11_2 ? allocBuffer(tdbb, pool, rel_mon_ctx_vars) : NULL; - RecordBuffer* const mem_usage_buffer = - ods_version >= ODS_11_2 ? allocBuffer(tdbb, pool, rel_mon_mem_usage) : NULL; + RecordBuffer* const dbb_buffer = allocBuffer(tdbb, pool, rel_mon_database); + RecordBuffer* const att_buffer = allocBuffer(tdbb, pool, rel_mon_attachments); + RecordBuffer* const tra_buffer = allocBuffer(tdbb, pool, rel_mon_transactions); + RecordBuffer* const stmt_buffer = allocBuffer(tdbb, pool, rel_mon_statements); + RecordBuffer* const call_buffer = allocBuffer(tdbb, pool, rel_mon_calls); + RecordBuffer* const io_stat_buffer = allocBuffer(tdbb, pool, rel_mon_io_stats); + RecordBuffer* const rec_stat_buffer = allocBuffer(tdbb, pool, rel_mon_rec_stats); + RecordBuffer* const ctx_var_buffer = allocBuffer(tdbb, pool, rel_mon_ctx_vars); + RecordBuffer* const mem_usage_buffer = allocBuffer(tdbb, pool, rel_mon_mem_usage); // Release our own lock LCK_release(tdbb, dbb->dbb_monitor_lock); diff --git a/src/jrd/blb.cpp b/src/jrd/blb.cpp index 7e0c0c84b2..02d8de925f 100644 --- a/src/jrd/blb.cpp +++ b/src/jrd/blb.cpp @@ -1389,7 +1389,7 @@ blb* BLB_open2(thread_db* tdbb, UCharBuffer new_bpb; - if (external_call && ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1) + if (external_call) { if (!from_type_specified) from = blob->blb_sub_type; diff --git a/src/jrd/btr.cpp b/src/jrd/btr.cpp index 6562532ce5..c1b8b8851b 100644 --- a/src/jrd/btr.cpp +++ b/src/jrd/btr.cpp @@ -1534,7 +1534,7 @@ void BTR_make_null_key(thread_db* tdbb, index_desc* idx, temporary_key* key) fb_assert(idx != NULL); fb_assert(key != NULL); - fb_assert(tdbb->getDatabase()->dbb_ods_version >= ODS_VERSION11) + fb_assert(tdbb->getDatabase()->dbb_ods_version >= ODS_VERSION12) key->key_flags = key_all_nulls; @@ -2304,8 +2304,8 @@ static void compress(thread_db* tdbb, if (isNull) { - // dbb->dbb_ods_version < ODS_VERSION11 cannot happen, see PAG_header_init() - fb_assert(dbb->dbb_ods_version >= ODS_VERSION11); + // dbb->dbb_ods_version < ODS_VERSION12 cannot happen, see PAG_header_init() + fb_assert(dbb->dbb_ods_version >= ODS_VERSION12); UCHAR pad = 0; key->key_flags &= ~key_empty; diff --git a/src/jrd/dfw.epp b/src/jrd/dfw.epp index ab998aee09..abfd479c4c 100644 --- a/src/jrd/dfw.epp +++ b/src/jrd/dfw.epp @@ -2142,8 +2142,6 @@ static bool modify_index(thread_db* tdbb, SSHORT phase, DeferredWork* work, jrd_ SET_TDBB(tdbb); Database* dbb = tdbb->getDatabase(); - const bool have_gtt = (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1); - bool is_create = true; dfw_task_routine task_routine = NULL; @@ -2171,45 +2169,42 @@ static bool modify_index(thread_db* tdbb, SSHORT phase, DeferredWork* work, jrd_ more = (*task_routine)(tdbb, phase, work, transaction); } - if (have_gtt) + bool gtt_preserve = false; + jrd_rel* relation = NULL; + + if (is_create) { - bool gtt_preserve = false; - jrd_rel* relation = NULL; + jrd_req* request = NULL; - if (is_create) - { - jrd_req* request = NULL; + FOR(REQUEST_HANDLE request) + IDX IN RDB$INDICES CROSS + REL IN RDB$RELATIONS OVER RDB$RELATION_NAME WITH + IDX.RDB$INDEX_NAME EQ work->dfw_name.c_str() + gtt_preserve = (REL.RDB$RELATION_TYPE == rel_global_temp_preserve); + relation = MET_lookup_relation(tdbb, REL.RDB$RELATION_NAME); + END_FOR; - FOR(REQUEST_HANDLE request) - IDX IN RDB$INDICES CROSS - REL IN RDB$RELATIONS OVER RDB$RELATION_NAME WITH - IDX.RDB$INDEX_NAME EQ work->dfw_name.c_str() - gtt_preserve = (REL.RDB$RELATION_TYPE == rel_global_temp_preserve); - relation = MET_lookup_relation(tdbb, REL.RDB$RELATION_NAME); - END_FOR; + CMP_release(tdbb, request); + } + else + { + relation = MET_lookup_relation_id(tdbb, work->dfw_id, false); + gtt_preserve = (relation) && (relation->rel_flags & REL_temp_conn); + } - CMP_release(tdbb, request); - } - else - { - relation = MET_lookup_relation_id(tdbb, work->dfw_id, false); - gtt_preserve = (relation) && (relation->rel_flags & REL_temp_conn); - } - - if (gtt_preserve && relation) - { - tdbb->tdbb_flags &= ~TDBB_use_db_page_space; - try { - if (relation->getPages(tdbb, -1, false)) { - more2 = (*task_routine) (tdbb, phase, work, transaction); - } - tdbb->tdbb_flags |= TDBB_use_db_page_space; - } - catch (...) - { - tdbb->tdbb_flags |= TDBB_use_db_page_space; - throw; + if (gtt_preserve && relation) + { + tdbb->tdbb_flags &= ~TDBB_use_db_page_space; + try { + if (relation->getPages(tdbb, -1, false)) { + more2 = (*task_routine) (tdbb, phase, work, transaction); } + tdbb->tdbb_flags |= TDBB_use_db_page_space; + } + catch (...) + { + tdbb->tdbb_flags |= TDBB_use_db_page_space; + throw; } } @@ -4789,44 +4784,38 @@ static Format* make_format(thread_db* tdbb, jrd_rel* relation, USHORT* version, HalfStaticArray buffer; - if (dbb->dbb_ods_version >= ODS_VERSION12) - { - buffer.add(UCHAR(format->fmt_count)); - buffer.add(UCHAR(format->fmt_count >> 8)); - } + buffer.add(UCHAR(format->fmt_count)); + buffer.add(UCHAR(format->fmt_count >> 8)); buffer.add((UCHAR*) odsDescs.begin(), odsDescs.getCount() * sizeof(Ods::Descriptor)); - if (dbb->dbb_ods_version >= ODS_VERSION12) + const size_t pos = buffer.getCount(); + buffer.add(0); + buffer.add(0); + + USHORT i = 0, dflCount = 0; + for (Format::fmt_defaults_iterator impure = format->fmt_defaults.begin(); + impure != format->fmt_defaults.end(); ++impure, ++i) { - size_t pos = buffer.getCount(); - buffer.add(0); - buffer.add(0); - - USHORT i = 0, dflCount = 0; - for (Format::fmt_defaults_iterator impure = format->fmt_defaults.begin(); - impure != format->fmt_defaults.end(); ++impure, ++i) + if (!impure->vlu_desc.isUnknown()) { - if (!impure->vlu_desc.isUnknown()) - { - dsc desc = impure->vlu_desc; - desc.dsc_address = NULL; + dsc desc = impure->vlu_desc; + desc.dsc_address = NULL; - Ods::Descriptor odsDflDesc = desc; + Ods::Descriptor odsDflDesc = desc; - buffer.add(UCHAR(i)); - buffer.add(UCHAR(i >> 8)); - buffer.add((UCHAR*) &odsDflDesc, sizeof(odsDflDesc)); - buffer.add(impure->vlu_desc.dsc_address, impure->vlu_desc.dsc_length); + buffer.add(UCHAR(i)); + buffer.add(UCHAR(i >> 8)); + buffer.add((UCHAR*) &odsDflDesc, sizeof(odsDflDesc)); + buffer.add(impure->vlu_desc.dsc_address, impure->vlu_desc.dsc_length); - ++dflCount; - } + ++dflCount; } - - buffer[pos] = UCHAR(dflCount); - buffer[pos + 1] = UCHAR(dflCount >> 8); } + buffer[pos] = UCHAR(dflCount); + buffer[pos + 1] = UCHAR(dflCount >> 8); + BLB_put_segment(tdbb, blob, buffer.begin(), buffer.getCount()); BLB_close(tdbb, blob); END_STORE; @@ -5419,8 +5408,7 @@ static bool modify_procedure(thread_db* tdbb, SSHORT phase, DeferredWork* work, return true; case 5: - if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1) - { + { // scope const DeferredWork* arg = work->findArg(dfw_arg_check_blr); if (arg) { @@ -5460,7 +5448,7 @@ static bool modify_procedure(thread_db* tdbb, SSHORT phase, DeferredWork* work, if (!REQUEST(irq_prc_validate)) REQUEST(irq_prc_validate) = request; } - } + } // scope break; } @@ -5521,8 +5509,7 @@ static bool modify_trigger(thread_db* tdbb, SSHORT phase, DeferredWork* work, jr } } - if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1) - { + { // scope const DeferredWork* arg = work->findArg(dfw_arg_check_blr); if (arg) { @@ -5595,7 +5582,7 @@ static bool modify_trigger(thread_db* tdbb, SSHORT phase, DeferredWork* work, jr if (!REQUEST(irq_trg_validate)) REQUEST(irq_trg_validate) = request; } - } + } // scope break; } diff --git a/src/jrd/dpm.epp b/src/jrd/dpm.epp index 9b23c933e6..07c2b24c69 100644 --- a/src/jrd/dpm.epp +++ b/src/jrd/dpm.epp @@ -1227,15 +1227,7 @@ SINT64 DPM_gen_id(thread_db* tdbb, SLONG generator, bool initialize, SINT64 val) * decided that the V6 engine would only access an ODS-10 database. * (and uncommented 2000-05-05, also by ChrisJ, when minds changed.) */ - SINT64* ptr = NULL; - - if (dbb->dbb_ods_version >= ODS_VERSION12) - ptr = ((SINT64*) (page->gpg_values)) + offset; - else - { - fb_assert(dbb->dbb_ods_version == ODS_VERSION11); - ptr = ((SINT64*) (((old_gen_page*) page)->gpg_values)) + offset; - } + SINT64* const ptr = ((SINT64*) (page->gpg_values)) + offset; if (val || initialize) { @@ -1426,8 +1418,7 @@ ULONG DPM_get_blob(thread_db* tdbb, blob->blb_max_segment = header->blh_max_segment; blob->blb_level = header->blh_level; blob->blb_sub_type = header->blh_sub_type; - if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1) - blob->blb_charset = header->blh_charset; + blob->blb_charset = header->blh_charset; // Unless this is the only attachment, don't allow the sequential scan // of very large blobs to flush pages used by other attachments. @@ -2018,8 +2009,7 @@ RecordNumber DPM_store_blob(thread_db* tdbb, blb* blob, Record* record) header->blh_length = blob->blb_length; header->blh_level = blob->blb_level; header->blh_sub_type = blob->blb_sub_type; - if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1) - header->blh_charset = blob->blb_charset; + header->blh_charset = blob->blb_charset; if (length) memcpy(header->blh_page, q, length); diff --git a/src/jrd/dyn.epp b/src/jrd/dyn.epp index dc1d493366..a1cbd397e0 100644 --- a/src/jrd/dyn.epp +++ b/src/jrd/dyn.epp @@ -889,45 +889,41 @@ USHORT DYN_put_text_blob(Global* gbl, const UCHAR** ptr, bid* blob_id) return length; } - // make the code die at some place if DYN_error_punt doesn't jump far away. - const UCHAR* end = NULL; + const UCHAR* const end = p + length; try { - UCharBuffer bpb; - Database* dbb = tdbb->getDatabase(); - if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1) - { - const size_t convSize = 15; - bpb.resize(convSize); - UCHAR* p = bpb.begin(); - *p++ = isc_bpb_version1; + UCharBuffer bpb; + const size_t convSize = 15; + bpb.resize(convSize); - *p++ = isc_bpb_source_type; - *p++ = 2; - put_vax_short(p, isc_blob_text); - p += 2; - *p++ = isc_bpb_source_interp; - *p++ = 1; - *p++ = tdbb->getCharSet(); + UCHAR* bpbPtr = bpb.begin(); + *bpbPtr++ = isc_bpb_version1; - *p++ = isc_bpb_target_type; - *p++ = 2; - put_vax_short(p, isc_blob_text); - p += 2; - *p++ = isc_bpb_target_interp; - *p++ = 1; - *p++ = CS_METADATA; - fb_assert(size_t(p - bpb.begin()) <= convSize); + *bpbPtr++ = isc_bpb_source_type; + *bpbPtr++ = 2; + put_vax_short(bpbPtr, isc_blob_text); + bpbPtr += 2; + *bpbPtr++ = isc_bpb_source_interp; + *bpbPtr++ = 1; + *bpbPtr++ = tdbb->getCharSet(); - // set the array count to the number of bytes we used - bpb.shrink(p - bpb.begin()); - } + *bpbPtr++ = isc_bpb_target_type; + *bpbPtr++ = 2; + put_vax_short(bpbPtr, isc_blob_text); + bpbPtr += 2; + *bpbPtr++ = isc_bpb_target_interp; + *bpbPtr++ = 1; + *bpbPtr++ = CS_METADATA; + fb_assert(size_t(bpbPtr - bpb.begin()) <= convSize); + + // set the array count to the number of bytes we used + bpb.shrink(bpbPtr - bpb.begin()); blb* blob = BLB_create2(tdbb, gbl->gbl_transaction, blob_id, bpb.getCount(), bpb.begin()); - for (end = p + length; p < end; p += TEXT_BLOB_LENGTH) + for (; p < end; p += TEXT_BLOB_LENGTH) { length = (p + TEXT_BLOB_LENGTH <= end) ? TEXT_BLOB_LENGTH : end - p; BLB_put_segment(tdbb, blob, p, length); diff --git a/src/jrd/dyn_def.epp b/src/jrd/dyn_def.epp index 1b009a5d62..50ce820e87 100644 --- a/src/jrd/dyn_def.epp +++ b/src/jrd/dyn_def.epp @@ -3002,12 +3002,6 @@ void DYN_define_relation(Global* gbl, const UCHAR** ptr, bool view) break; case isc_dyn_rel_temporary: - if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) < ODS_11_1) - { - // msg 248: "Feature ''@1'' is not supported in ODS @2.@3" - DYN_error_punt(false, 248, SafeArg() << "GLOBAL TEMPORARY TABLE" << - dbb->dbb_ods_version << dbb->dbb_minor_version); - } switch (DYN_get_number(ptr)) { case isc_dyn_rel_temp_global_preserve: @@ -3028,7 +3022,8 @@ void DYN_define_relation(Global* gbl, const UCHAR** ptr, bool view) MetaTmp(REL.RDB$RELATION_NAME) DYN_execute(gbl, ptr, &tmp, &field_name, NULL, NULL, NULL); } - } + } // while + SSHORT old_id = id; id = drq_l_rel_info2; @@ -3092,21 +3087,18 @@ void DYN_define_relation(Global* gbl, const UCHAR** ptr, bool view) if (!DYN_REQUEST(drq_s_rels)) DYN_REQUEST(drq_s_rels) = request; - if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1) - { - jrd_req* sub_request = NULL; + jrd_req* sub_request = NULL; - FOR(REQUEST_HANDLE sub_request TRANSACTION_HANDLE gbl->gbl_transaction) - REL IN RDB$RELATIONS WITH REL.RDB$RELATION_NAME EQ relation_name.c_str() + FOR(REQUEST_HANDLE sub_request TRANSACTION_HANDLE gbl->gbl_transaction) + REL IN RDB$RELATIONS WITH REL.RDB$RELATION_NAME EQ relation_name.c_str() - MODIFY REL USING - REL.RDB$RELATION_TYPE = rel_type; - REL.RDB$RELATION_TYPE.NULL = FALSE; - END_MODIFY; - END_FOR; + MODIFY REL USING + REL.RDB$RELATION_TYPE = rel_type; + REL.RDB$RELATION_TYPE.NULL = FALSE; + END_MODIFY; + END_FOR; - CMP_release(tdbb, sub_request); - } + CMP_release(tdbb, sub_request); if (sql_prot) { @@ -3914,25 +3906,22 @@ void DYN_define_trigger(Global* gbl, DYN_REQUEST(drq_s_triggers) = request; } - if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1) - { - jrd_req* sub_request = NULL; + jrd_req* sub_request = NULL; - FOR(REQUEST_HANDLE sub_request TRANSACTION_HANDLE gbl->gbl_transaction) - TRG IN RDB$TRIGGERS WITH TRG.RDB$TRIGGER_NAME EQ t.c_str() + FOR(REQUEST_HANDLE sub_request TRANSACTION_HANDLE gbl->gbl_transaction) + TRG IN RDB$TRIGGERS WITH TRG.RDB$TRIGGER_NAME EQ t.c_str() - MODIFY TRG USING - TRG.RDB$VALID_BLR = TRUE; - TRG.RDB$VALID_BLR.NULL = FALSE; + MODIFY TRG USING + TRG.RDB$VALID_BLR = TRUE; + TRG.RDB$VALID_BLR.NULL = FALSE; - TRG.RDB$DEBUG_INFO.NULL = (debug_info_ptr == NULL) ? TRUE : FALSE; - if (debug_info_ptr) - DYN_put_blr_blob(gbl, &debug_info_ptr, &TRG.RDB$DEBUG_INFO); - END_MODIFY; - END_FOR; + TRG.RDB$DEBUG_INFO.NULL = (debug_info_ptr == NULL) ? TRUE : FALSE; + if (debug_info_ptr) + DYN_put_blr_blob(gbl, &debug_info_ptr, &TRG.RDB$DEBUG_INFO); + END_MODIFY; + END_FOR; - CMP_release(tdbb, sub_request); - } + CMP_release(tdbb, sub_request); } catch (const Firebird::Exception& ex) @@ -4102,10 +4091,6 @@ void DYN_define_view_relation( Global* gbl, const UCHAR** ptr, const Firebird::M case isc_dyn_view_context_name: GET_STRING(ptr, VRL.RDB$CONTEXT_NAME); VRL.RDB$CONTEXT_NAME.NULL = FALSE; - - if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) < ODS_11_2) { - VRL.RDB$CONTEXT_NAME[31] = 0; - } break; default: @@ -4263,30 +4248,24 @@ static rel_t get_relation_type(thread_db* tdbb, Global* gbl, const Firebird::Met { Database* dbb = tdbb->getDatabase(); - const USHORT major_version = dbb->dbb_ods_version; - const USHORT minor_version = dbb->dbb_minor_version; - rel_t rel_type = rel_persistent; - if (ENCODE_ODS(major_version, minor_version) >= ODS_11_1) - { - jrd_req* request = CMP_find_request(tdbb, drq_l_rel_type, DYN_REQUESTS); + jrd_req* request = CMP_find_request(tdbb, drq_l_rel_type, DYN_REQUESTS); - FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction) - REL IN RDB$RELATIONS - WITH REL.RDB$RELATION_NAME EQ rel_name.c_str() - AND REL.RDB$RELATION_TYPE NOT MISSING - - if (!DYN_REQUEST(drq_l_rel_type)) - DYN_REQUEST(drq_l_rel_type) = request; - - rel_type = (rel_t) REL.RDB$RELATION_TYPE; - - END_FOR; + FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction) + REL IN RDB$RELATIONS + WITH REL.RDB$RELATION_NAME EQ rel_name.c_str() + AND REL.RDB$RELATION_TYPE NOT MISSING if (!DYN_REQUEST(drq_l_rel_type)) DYN_REQUEST(drq_l_rel_type) = request; - } + + rel_type = (rel_t) REL.RDB$RELATION_TYPE; + + END_FOR; + + if (!DYN_REQUEST(drq_l_rel_type)) + DYN_REQUEST(drq_l_rel_type) = request; return rel_type; } diff --git a/src/jrd/dyn_mod.epp b/src/jrd/dyn_mod.epp index b1a96bf83f..1fa8ef4c28 100644 --- a/src/jrd/dyn_mod.epp +++ b/src/jrd/dyn_mod.epp @@ -2796,21 +2796,18 @@ void DYN_modify_sql_field(Global* gbl, const UCHAR** ptr, const MetaName* relati first_request = request; request = NULL; - if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_2) - { - FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction) - PRM IN RDB$PROCEDURE_PARAMETERS - WITH PRM.RDB$RELATION_NAME = relation_name->c_str() AND - PRM.RDB$FIELD_NAME = orig_fld.dyn_fld_name.c_str() + FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction) + PRM IN RDB$PROCEDURE_PARAMETERS + WITH PRM.RDB$RELATION_NAME = relation_name->c_str() AND + PRM.RDB$FIELD_NAME = orig_fld.dyn_fld_name.c_str() - MODIFY PRM USING - strcpy(PRM.RDB$FIELD_SOURCE, dom_fld.dyn_fld_source.c_str()); - END_MODIFY; - END_FOR; + MODIFY PRM USING + strcpy(PRM.RDB$FIELD_SOURCE, dom_fld.dyn_fld_source.c_str()); + END_MODIFY; + END_FOR; - CMP_release(tdbb, request); - request = NULL; - } + CMP_release(tdbb, request); + request = NULL; } else { @@ -2959,21 +2956,18 @@ void DYN_modify_sql_field(Global* gbl, const UCHAR** ptr, const MetaName* relati CMP_release(tdbb, request); request = NULL; - if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_2) - { - FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction) - PRM IN RDB$PROCEDURE_PARAMETERS - WITH PRM.RDB$RELATION_NAME = relation_name->c_str() AND - PRM.RDB$FIELD_NAME = orig_fld.dyn_fld_name.c_str() + FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction) + PRM IN RDB$PROCEDURE_PARAMETERS + WITH PRM.RDB$RELATION_NAME = relation_name->c_str() AND + PRM.RDB$FIELD_NAME = orig_fld.dyn_fld_name.c_str() - MODIFY PRM USING - strcpy(PRM.RDB$FIELD_SOURCE, new_fld.dyn_fld_source.c_str()); - END_MODIFY; - END_FOR; + MODIFY PRM USING + strcpy(PRM.RDB$FIELD_SOURCE, new_fld.dyn_fld_source.c_str()); + END_MODIFY; + END_FOR; - CMP_release(tdbb, request); - request = NULL; - } + CMP_release(tdbb, request); + request = NULL; } else if (changeDefault) { diff --git a/src/jrd/evl.cpp b/src/jrd/evl.cpp index af94f3d5ea..4f8846d47b 100644 --- a/src/jrd/evl.cpp +++ b/src/jrd/evl.cpp @@ -1252,134 +1252,21 @@ bool EVL_field(jrd_rel* relation, Record* record, USHORT id, dsc* desc) thread_db* tdbb = JRD_get_thread_data(); Database* dbb = tdbb->getDatabase(); - if (dbb->dbb_ods_version >= ODS_VERSION12) + while (format && + (id >= format->fmt_defaults.getCount() || + format->fmt_defaults[id].vlu_desc.isUnknown())) { - while (format && - (id >= format->fmt_defaults.getCount() || - format->fmt_defaults[id].vlu_desc.isUnknown())) + if (format->fmt_version >= relation->rel_current_format->fmt_version) { - if (format->fmt_version >= relation->rel_current_format->fmt_version) - { - format = NULL; - break; - } - - format = MET_format(tdbb, relation, format->fmt_version + 1); + format = NULL; + break; } - return format && !(*desc = format->fmt_defaults[id].vlu_desc).isUnknown(); + format = MET_format(tdbb, relation, format->fmt_version + 1); } - // Legacy ODS logic + return format && !(*desc = format->fmt_defaults[id].vlu_desc).isUnknown(); - // A database sweep does not scan a relation's metadata. However - // the change to substitute a default value for a missing "not null" - // field makes it necessary to reference the field block. - if (!relation->rel_fields) - { - thread_db* tdbb = NULL; - - SET_TDBB(tdbb); - MET_scan_relation(tdbb, relation); - } - - // CVC: With a corrupt db, the engine crashed doing backup. - jrd_fld* temp_field = NULL; - if (id < relation->rel_fields->count()) - temp_field = (*relation->rel_fields)[id]; - - if (temp_field && temp_field->fld_default_value && temp_field->fld_not_null) - { - const nod_t temp_nod_type = temp_field->fld_default_value->nod_type; - - switch (temp_nod_type) - { - case nod_user_name: - { - desc->dsc_dtype = dtype_text; - desc->dsc_sub_type = 0; - desc->dsc_scale = 0; - INTL_ASSIGN_TTYPE(desc, ttype_metadata); - Firebird::MetaName& owner_name = relation->rel_owner_name; - desc->dsc_address = (UCHAR*) owner_name.c_str(); // throwing away const. - desc->dsc_length = owner_name.length(); - } - break; - case nod_current_role: - { - // CVC: Revisiting the current_role to fill default values: - // If the current user is the same as the table creator, - // return the current role for that user, otherwise return NONE. - desc->dsc_dtype = dtype_text; - desc->dsc_sub_type = 0; - desc->dsc_scale = 0; - INTL_ASSIGN_TTYPE(desc, ttype_metadata); - thread_db* tdbb = NULL; - SET_TDBB(tdbb); - const char* rc_role = 0; - const UserId* att_user = tdbb->getAttachment()->att_user; - const char* cur_user = att_user ? att_user->usr_user_name.c_str() : 0; - if (cur_user && relation->rel_owner_name == cur_user) - rc_role = att_user->usr_sql_role_name.c_str(); - else - rc_role = NULL_ROLE; - - desc->dsc_address = reinterpret_cast(const_cast(rc_role)); - desc->dsc_length = strlen(rc_role); - } - break; - case nod_current_date: - case nod_current_time: - case nod_current_timestamp: - { - static const GDS_TIMESTAMP temp_timestamp = { 0, 0 }; - desc->dsc_dtype = dtype_timestamp; - desc->dsc_scale = 0; - desc->dsc_flags = 0; - desc->dsc_address = - reinterpret_cast(const_cast(&temp_timestamp)); - desc->dsc_length = sizeof(temp_timestamp); - } - break; - case nod_internal_info: - { - static const SLONG temp_long = 0; - desc->dsc_dtype = dtype_long; - desc->dsc_scale = 0; - desc->dsc_flags = 0; - desc->dsc_address = (UCHAR*) const_cast(&temp_long); - desc->dsc_length = sizeof(temp_long); - } - break; - default: - { - const Literal* default_literal = - reinterpret_cast(temp_field->fld_default_value); - - if (default_literal->nod_type == nod_null) - { - ERR_post(Arg::Gds(isc_not_valid) << Arg::Str(temp_field->fld_name) << - Arg::Str(NULL_STRING_MARK)); - } - - fb_assert(default_literal->nod_type == nod_literal); - - const dsc* default_desc = &default_literal->lit_desc; - // CVC: This could be a bitwise copy in one line - /* - desc->dsc_dtype = default_desc->dsc_dtype; - desc->dsc_scale = default_desc->dsc_scale; - desc->dsc_length = default_desc->dsc_length; - desc->dsc_sub_type = default_desc->dsc_sub_type; - desc->dsc_flags = default_desc->dsc_flags; - desc->dsc_address = default_desc->dsc_address; - */ - *desc = *default_desc; - } - } - - return true; - } } desc->dsc_dtype = dtype_text; @@ -1387,7 +1274,7 @@ bool EVL_field(jrd_rel* relation, Record* record, USHORT id, dsc* desc) desc->dsc_sub_type = 0; desc->dsc_scale = 0; desc->dsc_ttype() = ttype_ascii; - desc->dsc_address = (UCHAR *) " "; + desc->dsc_address = (UCHAR*) " "; return false; } diff --git a/src/jrd/ini.epp b/src/jrd/ini.epp index 3491b29e72..7082a934d7 100644 --- a/src/jrd/ini.epp +++ b/src/jrd/ini.epp @@ -652,38 +652,8 @@ void INI_init2(thread_db* tdbb) { if (n-- > 0) { - // In ODS 12.0, RDB$TRIGGER_TYPE was changed from SHORTINT to BIGINT - if (fld[RFLD_F_NAME] == nam_trg_type && major_version < ODS_12_0) - { - desc->dsc_dtype = dtype_short; - desc->dsc_length = sizeof(SSHORT); - } - - format->fmt_length = (USHORT)MET_align(dbb, &(*desc), format->fmt_length); + format->fmt_length = (USHORT) MET_align(dbb, &(*desc), format->fmt_length); desc->dsc_address = (UCHAR*) (IPTR) format->fmt_length; - - // In ODS prior to 11.2 all varchar columns were actually - // two bytes shorter than defined in fields.h - if (desc->dsc_dtype == dtype_varying && - ENCODE_ODS(major_version, minor_version) < ODS_11_2) - { - desc->dsc_length -= sizeof(USHORT); - } - - // In ODS11.2 length of RDB$CONTEXT_NAME was enlarged from 31 to 255 bytes - if ((fld[RFLD_F_NAME] == nam_context) && - ENCODE_ODS(major_version, minor_version) < ODS_11_2) - { - desc->dsc_length = 31; - } - else if (fld[RFLD_F_NAME] == nam_entry && - ENCODE_ODS(major_version, minor_version) < ODS_12_0) - { - // In ODS12.0 length of RDB$EXTERNAL_NAME are enlarged from - // 31 to 255 bytes - desc->dsc_length = 31; - } - format->fmt_length += desc->dsc_length; } } diff --git a/src/jrd/met.epp b/src/jrd/met.epp index 3d09d6aa14..57c82d873a 100644 --- a/src/jrd/met.epp +++ b/src/jrd/met.epp @@ -829,170 +829,167 @@ DeferredWork* MET_change_fields(thread_db* tdbb, jrd_tra* transaction, const dsc if (!REQUEST(irq_m_fields)) REQUEST(irq_m_fields) = request; - if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1) - { - request = CMP_find_request(tdbb, irq_m_fields2, IRQ_REQUESTS); + request = CMP_find_request(tdbb, irq_m_fields2, IRQ_REQUESTS); - FOR(REQUEST_HANDLE request) - DEP IN RDB$DEPENDENCIES CROSS - PRC IN RDB$PROCEDURES - WITH DEP.RDB$DEPENDED_ON_NAME EQ field_source->dsc_address AND - DEP.RDB$DEPENDED_ON_TYPE EQ obj_field AND - DEP.RDB$DEPENDENT_TYPE EQ obj_procedure AND - DEP.RDB$DEPENDENT_NAME EQ PRC.RDB$PROCEDURE_NAME AND - PRC.RDB$PACKAGE_NAME MISSING - - if (!REQUEST(irq_m_fields2)) - REQUEST(irq_m_fields2) = request; - - Firebird::MetaName proc_name(PRC.RDB$PROCEDURE_NAME); - - dsc desc; - desc.dsc_dtype = dtype_text; - INTL_ASSIGN_DSC(&desc, CS_METADATA, COLLATE_NONE); - desc.dsc_length = proc_name.length(); - desc.dsc_address = (UCHAR*) proc_name.c_str(); - - DeferredWork* dw2 = - DFW_post_work(transaction, dfw_modify_procedure, &desc, PRC.RDB$PROCEDURE_ID); - DFW_post_work_arg(transaction, dw2, NULL, 0, dfw_arg_check_blr); - END_FOR; + FOR(REQUEST_HANDLE request) + DEP IN RDB$DEPENDENCIES CROSS + PRC IN RDB$PROCEDURES + WITH DEP.RDB$DEPENDED_ON_NAME EQ field_source->dsc_address AND + DEP.RDB$DEPENDED_ON_TYPE EQ obj_field AND + DEP.RDB$DEPENDENT_TYPE EQ obj_procedure AND + DEP.RDB$DEPENDENT_NAME EQ PRC.RDB$PROCEDURE_NAME AND + PRC.RDB$PACKAGE_NAME MISSING if (!REQUEST(irq_m_fields2)) REQUEST(irq_m_fields2) = request; - request = CMP_find_request(tdbb, irq_m_fields6, IRQ_REQUESTS); + Firebird::MetaName proc_name(PRC.RDB$PROCEDURE_NAME); - FOR(REQUEST_HANDLE request) - DEP IN RDB$DEPENDENCIES CROSS - PRC IN RDB$PROCEDURES - WITH DEP.RDB$DEPENDED_ON_NAME EQ field_source->dsc_address AND - DEP.RDB$DEPENDED_ON_TYPE EQ obj_field AND - (DEP.RDB$DEPENDENT_TYPE EQ obj_package_header OR - DEP.RDB$DEPENDENT_TYPE EQ obj_package_body) AND - DEP.RDB$DEPENDENT_NAME EQ PRC.RDB$PACKAGE_NAME + dsc desc; + desc.dsc_dtype = dtype_text; + INTL_ASSIGN_DSC(&desc, CS_METADATA, COLLATE_NONE); + desc.dsc_length = proc_name.length(); + desc.dsc_address = (UCHAR*) proc_name.c_str(); - if (!REQUEST(irq_m_fields6)) - REQUEST(irq_m_fields6) = request; + DeferredWork* dw2 = + DFW_post_work(transaction, dfw_modify_procedure, &desc, PRC.RDB$PROCEDURE_ID); + DFW_post_work_arg(transaction, dw2, NULL, 0, dfw_arg_check_blr); + END_FOR; - Firebird::MetaName proc_name(PRC.RDB$PROCEDURE_NAME); + if (!REQUEST(irq_m_fields2)) + REQUEST(irq_m_fields2) = request; - dsc desc; - desc.dsc_dtype = dtype_text; - INTL_ASSIGN_DSC(&desc, CS_METADATA, COLLATE_NONE); - desc.dsc_length = proc_name.length(); - desc.dsc_address = (UCHAR*) proc_name.c_str(); + request = CMP_find_request(tdbb, irq_m_fields6, IRQ_REQUESTS); - DeferredWork* dw2 = DFW_post_work(transaction, dfw_modify_procedure, &desc, - PRC.RDB$PROCEDURE_ID, PRC.RDB$PACKAGE_NAME); - DFW_post_work_arg(transaction, dw2, NULL, 0, dfw_arg_check_blr); - END_FOR; + FOR(REQUEST_HANDLE request) + DEP IN RDB$DEPENDENCIES CROSS + PRC IN RDB$PROCEDURES + WITH DEP.RDB$DEPENDED_ON_NAME EQ field_source->dsc_address AND + DEP.RDB$DEPENDED_ON_TYPE EQ obj_field AND + (DEP.RDB$DEPENDENT_TYPE EQ obj_package_header OR + DEP.RDB$DEPENDENT_TYPE EQ obj_package_body) AND + DEP.RDB$DEPENDENT_NAME EQ PRC.RDB$PACKAGE_NAME if (!REQUEST(irq_m_fields6)) REQUEST(irq_m_fields6) = request; - request = CMP_find_request(tdbb, irq_m_fields3, IRQ_REQUESTS); + Firebird::MetaName proc_name(PRC.RDB$PROCEDURE_NAME); - FOR(REQUEST_HANDLE request) - DEP IN RDB$DEPENDENCIES CROSS - TRG IN RDB$TRIGGERS - WITH DEP.RDB$DEPENDED_ON_NAME EQ field_source->dsc_address AND - DEP.RDB$DEPENDED_ON_TYPE EQ obj_field AND - DEP.RDB$DEPENDENT_TYPE EQ obj_trigger AND - DEP.RDB$DEPENDENT_NAME EQ TRG.RDB$TRIGGER_NAME + dsc desc; + desc.dsc_dtype = dtype_text; + INTL_ASSIGN_DSC(&desc, CS_METADATA, COLLATE_NONE); + desc.dsc_length = proc_name.length(); + desc.dsc_address = (UCHAR*) proc_name.c_str(); - if (!REQUEST(irq_m_fields3)) - REQUEST(irq_m_fields3) = request; + DeferredWork* dw2 = DFW_post_work(transaction, dfw_modify_procedure, &desc, + PRC.RDB$PROCEDURE_ID, PRC.RDB$PACKAGE_NAME); + DFW_post_work_arg(transaction, dw2, NULL, 0, dfw_arg_check_blr); + END_FOR; - Firebird::MetaName trigger_name(TRG.RDB$TRIGGER_NAME); - Firebird::MetaName trigger_relation_name(TRG.RDB$RELATION_NAME); + if (!REQUEST(irq_m_fields6)) + REQUEST(irq_m_fields6) = request; - dsc desc; - desc.dsc_dtype = dtype_text; - INTL_ASSIGN_DSC(&desc, CS_METADATA, COLLATE_NONE); - desc.dsc_length = trigger_name.length(); - desc.dsc_address = (UCHAR*) trigger_name.c_str(); + request = CMP_find_request(tdbb, irq_m_fields3, IRQ_REQUESTS); - DeferredWork* dw2 = DFW_post_work(transaction, dfw_modify_trigger, &desc, 0); - DFW_post_work_arg(transaction, dw2, NULL, TRG.RDB$TRIGGER_TYPE, dfw_arg_trg_type); - - desc.dsc_length = trigger_relation_name.length(); - desc.dsc_address = (UCHAR*) trigger_relation_name.c_str(); - DFW_post_work_arg(transaction, dw2, &desc, 0, dfw_arg_check_blr); - END_FOR; + FOR(REQUEST_HANDLE request) + DEP IN RDB$DEPENDENCIES CROSS + TRG IN RDB$TRIGGERS + WITH DEP.RDB$DEPENDED_ON_NAME EQ field_source->dsc_address AND + DEP.RDB$DEPENDED_ON_TYPE EQ obj_field AND + DEP.RDB$DEPENDENT_TYPE EQ obj_trigger AND + DEP.RDB$DEPENDENT_NAME EQ TRG.RDB$TRIGGER_NAME if (!REQUEST(irq_m_fields3)) REQUEST(irq_m_fields3) = request; - request = CMP_find_request(tdbb, irq_m_fields4, IRQ_REQUESTS); + Firebird::MetaName trigger_name(TRG.RDB$TRIGGER_NAME); + Firebird::MetaName trigger_relation_name(TRG.RDB$RELATION_NAME); - FOR(REQUEST_HANDLE request) - RFL IN RDB$RELATION_FIELDS CROSS - DEP IN RDB$DEPENDENCIES CROSS - PRC IN RDB$PROCEDURES - WITH RFL.RDB$FIELD_SOURCE EQ field_source->dsc_address AND - DEP.RDB$DEPENDED_ON_NAME EQ RFL.RDB$RELATION_NAME AND - DEP.RDB$FIELD_NAME EQ RFL.RDB$FIELD_NAME AND - DEP.RDB$DEPENDED_ON_TYPE EQ obj_relation AND - DEP.RDB$DEPENDENT_TYPE EQ obj_procedure AND - DEP.RDB$DEPENDENT_NAME EQ PRC.RDB$PROCEDURE_NAME AND - PRC.RDB$PACKAGE_NAME MISSING + dsc desc; + desc.dsc_dtype = dtype_text; + INTL_ASSIGN_DSC(&desc, CS_METADATA, COLLATE_NONE); + desc.dsc_length = trigger_name.length(); + desc.dsc_address = (UCHAR*) trigger_name.c_str(); - if (!REQUEST(irq_m_fields4)) - REQUEST(irq_m_fields4) = request; + DeferredWork* dw2 = DFW_post_work(transaction, dfw_modify_trigger, &desc, 0); + DFW_post_work_arg(transaction, dw2, NULL, TRG.RDB$TRIGGER_TYPE, dfw_arg_trg_type); - Firebird::MetaName proc_name(PRC.RDB$PROCEDURE_NAME); + desc.dsc_length = trigger_relation_name.length(); + desc.dsc_address = (UCHAR*) trigger_relation_name.c_str(); + DFW_post_work_arg(transaction, dw2, &desc, 0, dfw_arg_check_blr); + END_FOR; - dsc desc; - desc.dsc_dtype = dtype_text; - INTL_ASSIGN_DSC(&desc, CS_METADATA, COLLATE_NONE); - desc.dsc_length = proc_name.length(); - desc.dsc_address = (UCHAR*) proc_name.c_str(); + if (!REQUEST(irq_m_fields3)) + REQUEST(irq_m_fields3) = request; - DeferredWork* dw2 = - DFW_post_work(transaction, dfw_modify_procedure, &desc, PRC.RDB$PROCEDURE_ID); - DFW_post_work_arg(transaction, dw2, NULL, 0, dfw_arg_check_blr); - END_FOR; + request = CMP_find_request(tdbb, irq_m_fields4, IRQ_REQUESTS); + + FOR(REQUEST_HANDLE request) + RFL IN RDB$RELATION_FIELDS CROSS + DEP IN RDB$DEPENDENCIES CROSS + PRC IN RDB$PROCEDURES + WITH RFL.RDB$FIELD_SOURCE EQ field_source->dsc_address AND + DEP.RDB$DEPENDED_ON_NAME EQ RFL.RDB$RELATION_NAME AND + DEP.RDB$FIELD_NAME EQ RFL.RDB$FIELD_NAME AND + DEP.RDB$DEPENDED_ON_TYPE EQ obj_relation AND + DEP.RDB$DEPENDENT_TYPE EQ obj_procedure AND + DEP.RDB$DEPENDENT_NAME EQ PRC.RDB$PROCEDURE_NAME AND + PRC.RDB$PACKAGE_NAME MISSING if (!REQUEST(irq_m_fields4)) REQUEST(irq_m_fields4) = request; - request = CMP_find_request(tdbb, irq_m_fields5, IRQ_REQUESTS); + Firebird::MetaName proc_name(PRC.RDB$PROCEDURE_NAME); - FOR(REQUEST_HANDLE request) - RFL IN RDB$RELATION_FIELDS CROSS - DEP IN RDB$DEPENDENCIES CROSS - TRG IN RDB$TRIGGERS - WITH RFL.RDB$FIELD_SOURCE EQ field_source->dsc_address AND - DEP.RDB$DEPENDED_ON_NAME EQ RFL.RDB$RELATION_NAME AND - DEP.RDB$FIELD_NAME EQ RFL.RDB$FIELD_NAME AND - DEP.RDB$DEPENDED_ON_TYPE EQ obj_relation AND - DEP.RDB$DEPENDENT_TYPE EQ obj_trigger AND - DEP.RDB$DEPENDENT_NAME EQ TRG.RDB$TRIGGER_NAME + dsc desc; + desc.dsc_dtype = dtype_text; + INTL_ASSIGN_DSC(&desc, CS_METADATA, COLLATE_NONE); + desc.dsc_length = proc_name.length(); + desc.dsc_address = (UCHAR*) proc_name.c_str(); - if (!REQUEST(irq_m_fields5)) - REQUEST(irq_m_fields5) = request; + DeferredWork* dw2 = + DFW_post_work(transaction, dfw_modify_procedure, &desc, PRC.RDB$PROCEDURE_ID); + DFW_post_work_arg(transaction, dw2, NULL, 0, dfw_arg_check_blr); + END_FOR; - Firebird::MetaName trigger_name(TRG.RDB$TRIGGER_NAME); - Firebird::MetaName trigger_relation_name(TRG.RDB$RELATION_NAME); + if (!REQUEST(irq_m_fields4)) + REQUEST(irq_m_fields4) = request; - dsc desc; - desc.dsc_dtype = dtype_text; - INTL_ASSIGN_DSC(&desc, CS_METADATA, COLLATE_NONE); - desc.dsc_length = trigger_name.length(); - desc.dsc_address = (UCHAR*) trigger_name.c_str(); + request = CMP_find_request(tdbb, irq_m_fields5, IRQ_REQUESTS); - DeferredWork* dw2 = DFW_post_work(transaction, dfw_modify_trigger, &desc, 0); - DFW_post_work_arg(transaction, dw2, NULL, TRG.RDB$TRIGGER_TYPE, dfw_arg_trg_type); - - desc.dsc_length = trigger_relation_name.length(); - desc.dsc_address = (UCHAR*) trigger_relation_name.c_str(); - DFW_post_work_arg(transaction, dw2, &desc, 0, dfw_arg_check_blr); - END_FOR; + FOR(REQUEST_HANDLE request) + RFL IN RDB$RELATION_FIELDS CROSS + DEP IN RDB$DEPENDENCIES CROSS + TRG IN RDB$TRIGGERS + WITH RFL.RDB$FIELD_SOURCE EQ field_source->dsc_address AND + DEP.RDB$DEPENDED_ON_NAME EQ RFL.RDB$RELATION_NAME AND + DEP.RDB$FIELD_NAME EQ RFL.RDB$FIELD_NAME AND + DEP.RDB$DEPENDED_ON_TYPE EQ obj_relation AND + DEP.RDB$DEPENDENT_TYPE EQ obj_trigger AND + DEP.RDB$DEPENDENT_NAME EQ TRG.RDB$TRIGGER_NAME if (!REQUEST(irq_m_fields5)) REQUEST(irq_m_fields5) = request; - } + + Firebird::MetaName trigger_name(TRG.RDB$TRIGGER_NAME); + Firebird::MetaName trigger_relation_name(TRG.RDB$RELATION_NAME); + + dsc desc; + desc.dsc_dtype = dtype_text; + INTL_ASSIGN_DSC(&desc, CS_METADATA, COLLATE_NONE); + desc.dsc_length = trigger_name.length(); + desc.dsc_address = (UCHAR*) trigger_name.c_str(); + + DeferredWork* dw2 = DFW_post_work(transaction, dfw_modify_trigger, &desc, 0); + DFW_post_work_arg(transaction, dw2, NULL, TRG.RDB$TRIGGER_TYPE, dfw_arg_trg_type); + + desc.dsc_length = trigger_relation_name.length(); + desc.dsc_address = (UCHAR*) trigger_relation_name.c_str(); + DFW_post_work_arg(transaction, dw2, &desc, 0, dfw_arg_check_blr); + END_FOR; + + if (!REQUEST(irq_m_fields5)) + REQUEST(irq_m_fields5) = request; return dw; } @@ -1209,16 +1206,8 @@ Format* MET_format(thread_db* tdbb, jrd_rel* relation, USHORT number) HalfStaticArray buffer; BLB_get_data(tdbb, blob, buffer.getBuffer(blob->blb_length), blob->blb_length); - unsigned bufferPos = 0; - USHORT count; - - if (dbb->dbb_ods_version >= ODS_VERSION12) - { - count = buffer[0] | (buffer[1] << 8); - bufferPos = 2; - } - else - count = buffer.getCount() / sizeof(Ods::Descriptor); + unsigned bufferPos = 2; + USHORT count = buffer[0] | (buffer[1] << 8); format = Format::newFormat(*dbb->dbb_permanent, count); @@ -1234,38 +1223,35 @@ Format* MET_format(thread_db* tdbb, jrd_rel* relation, USHORT number) format->fmt_length = odsDesc->dsc_offset + desc->dsc_length; } - if (dbb->dbb_ods_version >= ODS_VERSION12) + const UCHAR* p = buffer.begin() + bufferPos + count * sizeof(Ods::Descriptor); + count = p[0] | (p[1] << 8); + p += 2; + + while (count-- > 0) { - const UCHAR* p = buffer.begin() + bufferPos + count * sizeof(Ods::Descriptor); - count = p[0] | (p[1] << 8); + USHORT offset = p[0] | (p[1] << 8); p += 2; - while (count-- > 0) + const Ods::Descriptor* odsDflDesc = (Ods::Descriptor*) p; + p = (UCHAR*) (odsDflDesc + 1); + + dsc& desc = format->fmt_defaults[offset].vlu_desc; + desc = *odsDflDesc; + + if (desc.dsc_dtype == dtype_text) { - USHORT offset = p[0] | (p[1] << 8); - p += 2; - - const Ods::Descriptor* odsDflDesc = (Ods::Descriptor*) p; - p = (UCHAR*) (odsDflDesc + 1); - - dsc& desc = format->fmt_defaults[offset].vlu_desc; - desc = *odsDflDesc; - - if (desc.dsc_dtype == dtype_text) - { - VaryingString* vluString = FB_NEW_RPT(*dbb->dbb_permanent, - desc.dsc_length) VaryingString(); - vluString->str_length = desc.dsc_length; - format->fmt_defaults[offset].vlu_string = vluString; - desc.dsc_address = format->fmt_defaults[offset].vlu_string->str_data; - } - else - desc.dsc_address = (UCHAR*) &format->fmt_defaults[offset].vlu_misc; - - memcpy(desc.dsc_address, p, desc.dsc_length); - - p += desc.dsc_length; + VaryingString* vluString = FB_NEW_RPT(*dbb->dbb_permanent, + desc.dsc_length) VaryingString(); + vluString->str_length = desc.dsc_length; + format->fmt_defaults[offset].vlu_string = vluString; + desc.dsc_address = format->fmt_defaults[offset].vlu_string->str_data; } + else + desc.dsc_address = (UCHAR*) &format->fmt_defaults[offset].vlu_misc; + + memcpy(desc.dsc_address, p, desc.dsc_length); + + p += desc.dsc_length; } END_FOR; @@ -3226,28 +3212,25 @@ jrd_prc* MET_procedure(thread_db* tdbb, int id, bool noscan, USHORT flags) SSHORT pa_default_value_null = true; bid pa_default_value; - if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1) - { - jrd_req* request3 = CMP_find_request(tdbb, irq_r_params2, IRQ_REQUESTS); + jrd_req* request3 = CMP_find_request(tdbb, irq_r_params2, IRQ_REQUESTS); - FOR (REQUEST_HANDLE request3) - PA2 IN RDB$PROCEDURE_PARAMETERS - WITH PA2.RDB$PROCEDURE_NAME EQ PA.RDB$PROCEDURE_NAME AND - PA2.RDB$PARAMETER_NAME EQ PA.RDB$PARAMETER_NAME AND - PA2.RDB$PACKAGE_NAME EQUIV NULLIF(packageName.c_str(), '') - - if (!REQUEST(irq_r_params2)) - REQUEST(irq_r_params2) = request3; - - pa_collation_id_null = PA2.RDB$COLLATION_ID.NULL; - pa_collation_id = PA2.RDB$COLLATION_ID; - pa_default_value_null = PA2.RDB$DEFAULT_VALUE.NULL; - pa_default_value = PA2.RDB$DEFAULT_VALUE; - END_FOR + FOR (REQUEST_HANDLE request3) + PA2 IN RDB$PROCEDURE_PARAMETERS + WITH PA2.RDB$PROCEDURE_NAME EQ PA.RDB$PROCEDURE_NAME AND + PA2.RDB$PARAMETER_NAME EQ PA.RDB$PARAMETER_NAME AND + PA2.RDB$PACKAGE_NAME EQUIV NULLIF(packageName.c_str(), '') if (!REQUEST(irq_r_params2)) REQUEST(irq_r_params2) = request3; - } + + pa_collation_id_null = PA2.RDB$COLLATION_ID.NULL; + pa_collation_id = PA2.RDB$COLLATION_ID; + pa_default_value_null = PA2.RDB$DEFAULT_VALUE.NULL; + pa_default_value = PA2.RDB$DEFAULT_VALUE; + END_FOR + + if (!REQUEST(irq_r_params2)) + REQUEST(irq_r_params2) = request3; if (PA.RDB$PARAMETER_TYPE) { paramVector = procedure->prc_output_fields; @@ -3334,30 +3317,27 @@ jrd_prc* MET_procedure(thread_db* tdbb, int id, bool noscan, USHORT flags) Jrd::ContextPoolHolder context(tdbb, csb_pool); CompilerScratch* csb = CompilerScratch::newCsb(*tdbb->getDefaultPool(), 5); - if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1) - { - jrd_req* request4 = CMP_find_request(tdbb, irq_p_type, IRQ_REQUESTS); + jrd_req* request4 = CMP_find_request(tdbb, irq_p_type, IRQ_REQUESTS); - FOR(REQUEST_HANDLE request4) - PT IN RDB$PROCEDURES - WITH PT.RDB$PROCEDURE_ID EQ procedure->prc_id + FOR(REQUEST_HANDLE request4) + PT IN RDB$PROCEDURES + WITH PT.RDB$PROCEDURE_ID EQ procedure->prc_id - if (!REQUEST(irq_p_type)) - { - REQUEST(irq_p_type) = request4; - } - - if (!PT.RDB$PROCEDURE_TYPE.NULL) - prc_type = (prc_t) PT.RDB$PROCEDURE_TYPE; - - if (!PT.RDB$DEBUG_INFO.NULL) - DBG_parse_debug_info(tdbb, &PT.RDB$DEBUG_INFO, csb->csb_dbg_info); - - END_FOR; - - if (!REQUEST(irq_p_type)) { + if (!REQUEST(irq_p_type)) + { REQUEST(irq_p_type) = request4; } + + if (!PT.RDB$PROCEDURE_TYPE.NULL) + prc_type = (prc_t) PT.RDB$PROCEDURE_TYPE; + + if (!PT.RDB$DEBUG_INFO.NULL) + DBG_parse_debug_info(tdbb, &PT.RDB$DEBUG_INFO, csb->csb_dbg_info); + + END_FOR; + + if (!REQUEST(irq_p_type)) { + REQUEST(irq_p_type) = request4; } procedure->prc_type = prc_type; @@ -3434,8 +3414,7 @@ jrd_prc* MET_procedure(thread_db* tdbb, int id, bool noscan, USHORT flags) procedure->prc_flags |= PRC_scanned; // CVC: This condition is always false because valid_blr is always true. - if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1 && - !(dbb->dbb_flags & DBB_read_only) && !valid_blr) + if (!(dbb->dbb_flags & DBB_read_only) && !valid_blr) { // if the BLR was marked as invalid but the procedure was compiled, // mark the BLR as valid @@ -4070,47 +4049,44 @@ void MET_scan_relation(thread_db* tdbb, jrd_rel* relation) delete csb; - if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1) - { - jrd_req* sub_request = CMP_find_request(tdbb, irq_r_type, IRQ_REQUESTS); + jrd_req* sub_request = CMP_find_request(tdbb, irq_r_type, IRQ_REQUESTS); - FOR(REQUEST_HANDLE sub_request) - REL IN RDB$RELATIONS WITH REL.RDB$RELATION_ID EQ relation->rel_id - - if (!REQUEST(irq_r_type)) - REQUEST(irq_r_type) = sub_request; - - if (!REL.RDB$RELATION_TYPE.NULL) - { - switch (REL.RDB$RELATION_TYPE) - { - case rel_persistent: - break; - case rel_external: - fb_assert(relation->rel_file); - break; - case rel_view: - fb_assert(relation->rel_view_rse); - break; - case rel_virtual: - relation->rel_flags |= REL_virtual; - break; - case rel_global_temp_preserve: - relation->rel_flags |= REL_temp_conn; - break; - case rel_global_temp_delete: - relation->rel_flags |= REL_temp_tran; - break; - default: - fb_assert(false); - } - } - - END_FOR; + FOR(REQUEST_HANDLE sub_request) + REL IN RDB$RELATIONS WITH REL.RDB$RELATION_ID EQ relation->rel_id if (!REQUEST(irq_r_type)) REQUEST(irq_r_type) = sub_request; - } + + if (!REL.RDB$RELATION_TYPE.NULL) + { + switch (REL.RDB$RELATION_TYPE) + { + case rel_persistent: + break; + case rel_external: + fb_assert(relation->rel_file); + break; + case rel_view: + fb_assert(relation->rel_view_rse); + break; + case rel_virtual: + relation->rel_flags |= REL_virtual; + break; + case rel_global_temp_preserve: + relation->rel_flags |= REL_temp_conn; + break; + case rel_global_temp_delete: + relation->rel_flags |= REL_temp_tran; + break; + default: + fb_assert(false); + } + } + + END_FOR; + + if (!REQUEST(irq_r_type)) + REQUEST(irq_r_type) = sub_request; // release any triggers in case of a rescan, but not if the rescan // hapenned while system triggers were being loaded. diff --git a/src/jrd/pag.cpp b/src/jrd/pag.cpp index d3e81f905a..4ab459fbd6 100644 --- a/src/jrd/pag.cpp +++ b/src/jrd/pag.cpp @@ -552,8 +552,6 @@ PAG PAG_allocate(thread_db* tdbb, WIN* window) // Starting from ODS 11.1 we store in pip_header.reserved number of pages // allocated from this pointer page. There is intention to create dedicated // field at page_inv_page for this purpose in ODS 12. - const bool isODS11_x = (dbb->dbb_ods_version == ODS_VERSION11 && dbb->dbb_minor_version >= 1) || - dbb->dbb_ods_version > ODS_VERSION11; // Find an allocation page with something on it @@ -586,9 +584,6 @@ PAG PAG_allocate(thread_db* tdbb, WIN* window) new_page = CCH_fake(tdbb, window, 0); // don't wait on latch if (new_page) { - if (!isODS11_x) - break; - BackupManager::StateReadGuard stateGuard(tdbb); const bool nbak_stalled = dbb->dbb_backup_manager->getState() == nbak_state_stalled; @@ -1247,19 +1242,10 @@ void PAG_init(thread_db* tdbb) pageMgr.transPerTIP = (dbb->dbb_page_size - OFFSETA(tx_inv_page*, tip_transactions)) * 4; pageSpace->ppFirst = 1; // dbb_ods_version can be 0 when a new database is being created - if ((dbb->dbb_ods_version == 0) || (dbb->dbb_ods_version >= ODS_VERSION12)) - { - pageMgr.gensPerPage = - (dbb->dbb_page_size - - OFFSETA(generator_page*, gpg_values)) / sizeof(((generator_page*) NULL)->gpg_values); - } - else - { - fb_assert(dbb->dbb_ods_version == ODS_VERSION11); - pageMgr.gensPerPage = - (dbb->dbb_page_size - - OFFSETA(old_gen_page*, gpg_values)) / sizeof(((old_gen_page*) NULL)->gpg_values); - } + fb_assert((dbb->dbb_ods_version == 0) || (dbb->dbb_ods_version >= ODS_VERSION12)); + pageMgr.gensPerPage = + (dbb->dbb_page_size - + OFFSETA(generator_page*, gpg_values)) / sizeof(((generator_page*) NULL)->gpg_values); // Compute the number of data pages per pointer page. Each data page // requires a 32 bit pointer and a 2 bit control field. @@ -2260,12 +2246,6 @@ ULONG PAG_page_count(Database* database, PageCountCallback* cb) * *********************************************/ fb_assert(cb); - const bool isODS11_x = - (database->dbb_ods_version == ODS_VERSION11 && database->dbb_minor_version >= 1) || - database->dbb_ods_version > ODS_VERSION11; - if (!isODS11_x) { - return 0; - } Firebird::Array temp; page_inv_page* pip = (Ods::page_inv_page*) // can't reinterpret_cast<> here diff --git a/src/jrd/vio.cpp b/src/jrd/vio.cpp index 627ce85f60..dd33880ece 100644 --- a/src/jrd/vio.cpp +++ b/src/jrd/vio.cpp @@ -2714,13 +2714,8 @@ void VIO_store(thread_db* tdbb, record_param* rpb, jrd_tra* transaction) work = DFW_post_work(transaction, dfw_create_procedure, &desc, id, package_name); bool check_blr = true; - - if (ENCODE_ODS(tdbb->getDatabase()->dbb_ods_version, - tdbb->getDatabase()->dbb_minor_version) >= ODS_11_1) - { - if (EVL_field(0, rpb->rpb_record, f_prc_valid_blr, &desc2)) - check_blr = MOV_get_long(&desc2, 0) != 0; - } + if (EVL_field(0, rpb->rpb_record, f_prc_valid_blr, &desc2)) + check_blr = MOV_get_long(&desc2, 0) != 0; if (check_blr) DFW_post_work_arg(transaction, work, NULL, 0, dfw_arg_check_blr);