From c6932824f7ddd4691ec9b1199851952d6547032d Mon Sep 17 00:00:00 2001 From: alexpeshkoff Date: Wed, 13 Oct 2010 09:15:48 +0000 Subject: [PATCH] Full fix for CORE-3024 --- lang_helpers/gds_codes.ftn | 4 ++- lang_helpers/gds_codes.pas | 3 +- src/include/gen/codetext.h | 3 +- src/include/gen/iberror.h | 10 ++++--- src/include/gen/msgs.h | 3 +- src/include/gen/sql_code.h | 3 +- src/include/gen/sql_state.h | 3 +- src/jrd/evl.cpp | 59 ++++++++++++++++++++----------------- src/msgs/facilities2.sql | 2 +- src/msgs/messages2.sql | 3 +- src/msgs/system_errors2.sql | 3 +- 11 files changed, 56 insertions(+), 40 deletions(-) diff --git a/lang_helpers/gds_codes.ftn b/lang_helpers/gds_codes.ftn index ffa98d038c..94a5ff8afe 100644 --- a/lang_helpers/gds_codes.ftn +++ b/lang_helpers/gds_codes.ftn @@ -1450,8 +1450,10 @@ C -- PARAMETER (GDS__private_function = 335545018) INTEGER*4 GDS__private_procedure PARAMETER (GDS__private_procedure = 335545019) + INTEGER*4 GDS__request_outdated + PARAMETER (GDS__request_outdated = 335545020) INTEGER*4 GDS__bad_events_handle - PARAMETER (GDS__bad_events_handle = 335545020) + PARAMETER (GDS__bad_events_handle = 335545021) INTEGER*4 GDS__gfix_db_name PARAMETER (GDS__gfix_db_name = 335740929) INTEGER*4 GDS__gfix_invalid_sw diff --git a/lang_helpers/gds_codes.pas b/lang_helpers/gds_codes.pas index 3c32624826..db84ec88ba 100644 --- a/lang_helpers/gds_codes.pas +++ b/lang_helpers/gds_codes.pas @@ -732,7 +732,8 @@ const gds_async_active = 335545017; gds_private_function = 335545018; gds_private_procedure = 335545019; - gds_bad_events_handle = 335545020; + gds_request_outdated = 335545020; + gds_bad_events_handle = 335545021; gds_gfix_db_name = 335740929; gds_gfix_invalid_sw = 335740930; gds_gfix_incmp_sw = 335740932; diff --git a/src/include/gen/codetext.h b/src/include/gen/codetext.h index a7d4332111..d3dd53ca09 100644 --- a/src/include/gen/codetext.h +++ b/src/include/gen/codetext.h @@ -721,7 +721,8 @@ static const struct { {"async_active", 335545017}, {"private_function", 335545018}, {"private_procedure", 335545019}, - {"bad_events_handle", 335545020}, + {"request_outdated", 335545020}, + {"bad_events_handle", 335545021}, {"gfix_db_name", 335740929}, {"gfix_invalid_sw", 335740930}, {"gfix_incmp_sw", 335740932}, diff --git a/src/include/gen/iberror.h b/src/include/gen/iberror.h index d2c1c7eda2..44646d5ce9 100644 --- a/src/include/gen/iberror.h +++ b/src/include/gen/iberror.h @@ -755,7 +755,8 @@ const ISC_STATUS isc_formatted_exception = 335545016L; const ISC_STATUS isc_async_active = 335545017L; const ISC_STATUS isc_private_function = 335545018L; const ISC_STATUS isc_private_procedure = 335545019L; -const ISC_STATUS isc_bad_events_handle = 335545020L; +const ISC_STATUS isc_request_outdated = 335545020L; +const ISC_STATUS isc_bad_events_handle = 335545021L; const ISC_STATUS isc_gfix_db_name = 335740929L; const ISC_STATUS isc_gfix_invalid_sw = 335740930L; const ISC_STATUS isc_gfix_incmp_sw = 335740932L; @@ -1174,7 +1175,7 @@ const ISC_STATUS isc_trace_switch_user_only = 337182757L; const ISC_STATUS isc_trace_switch_param_miss = 337182758L; const ISC_STATUS isc_trace_param_act_notcompat = 337182759L; const ISC_STATUS isc_trace_mandatory_switch_miss = 337182760L; -const ISC_STATUS isc_err_max = 1118; +const ISC_STATUS isc_err_max = 1119; #else /* c definitions */ @@ -1899,7 +1900,8 @@ const ISC_STATUS isc_err_max = 1118; #define isc_async_active 335545017L #define isc_private_function 335545018L #define isc_private_procedure 335545019L -#define isc_bad_events_handle 335545020L +#define isc_request_outdated 335545020L +#define isc_bad_events_handle 335545021L #define isc_gfix_db_name 335740929L #define isc_gfix_invalid_sw 335740930L #define isc_gfix_incmp_sw 335740932L @@ -2318,7 +2320,7 @@ const ISC_STATUS isc_err_max = 1118; #define isc_trace_switch_param_miss 337182758L #define isc_trace_param_act_notcompat 337182759L #define isc_trace_mandatory_switch_miss 337182760L -#define isc_err_max 1118 +#define isc_err_max 1119 #endif diff --git a/src/include/gen/msgs.h b/src/include/gen/msgs.h index 51d4c268b7..eaa18c4d96 100644 --- a/src/include/gen/msgs.h +++ b/src/include/gen/msgs.h @@ -724,7 +724,8 @@ Data source : @4"}, /* eds_statement */ {335545017, "Asynchronous call is already running for this attachment"}, /* async_active */ {335545018, "Function @1 is private to package @2"}, /* private_function */ {335545019, "Procedure @1 is private to package @2"}, /* private_procedure */ - {335545020, "invalid events id (handle)"}, /* bad_events_handle */ + {335545020, "Request can't access new records in relation @1 and should be recompiled"}, /* request_outdated */ + {335545021, "invalid events id (handle)"}, /* bad_events_handle */ {335740929, "data base file name (@1) already given"}, /* gfix_db_name */ {335740930, "invalid switch @1"}, /* gfix_invalid_sw */ {335740932, "incompatible switch combination"}, /* gfix_incmp_sw */ diff --git a/src/include/gen/sql_code.h b/src/include/gen/sql_code.h index 2dc26e1d85..b4ce3ace4b 100644 --- a/src/include/gen/sql_code.h +++ b/src/include/gen/sql_code.h @@ -720,7 +720,8 @@ static const struct { {335545017, -532}, /* 697 async_active */ {335545018, -901}, /* 698 private_function */ {335545019, -901}, /* 699 private_procedure */ - {335545020, -901}, /* 700 bad_events_handle */ + {335545020, -904}, /* 700 request_outdated */ + {335545021, -901}, /* 701 bad_events_handle */ {335740929, -901}, /* 1 gfix_db_name */ {335740930, -901}, /* 2 gfix_invalid_sw */ {335740932, -901}, /* 4 gfix_incmp_sw */ diff --git a/src/include/gen/sql_state.h b/src/include/gen/sql_state.h index a387607508..b3840b8f52 100644 --- a/src/include/gen/sql_state.h +++ b/src/include/gen/sql_state.h @@ -720,7 +720,8 @@ static const struct { {335545017, "HY018"}, // 697 async_active {335545018, "42000"}, // 698 private_function {335545019, "42000"}, // 699 private_procedure - {335545020, "08003"}, // 700 bad_events_handle + {335545020, "24000"}, // 700 request_outdated + {335545021, "08003"}, // 701 bad_events_handle {335740929, "00000"}, // 1 gfix_db_name {335740930, "00000"}, // 2 gfix_invalid_sw {335740932, "00000"}, // 4 gfix_incmp_sw diff --git a/src/jrd/evl.cpp b/src/jrd/evl.cpp index 24d0ea0d01..6df719c6ef 100644 --- a/src/jrd/evl.cpp +++ b/src/jrd/evl.cpp @@ -410,37 +410,42 @@ dsc* EVL_expr(thread_db* tdbb, const jrd_nod* node) // ASF: CORE-1432 - If the the record is not on the latest format, upgrade it. // AP: for fields that are missing in original format use record's one. - if (compileFormat && - record->rec_format->fmt_version != compileFormat->fmt_version && - id < compileFormat->fmt_desc.getCount() && - !DSC_EQUIV(&impure->vlu_desc, &compileFormat->fmt_desc[id], true)) + if (compileFormat && record->rec_format->fmt_version != compileFormat->fmt_version) { - dsc desc = impure->vlu_desc; - impure->vlu_desc = compileFormat->fmt_desc[id]; - - if (impure->vlu_desc.isText()) + if (record->rec_format->fmt_version > compileFormat->fmt_version) { - // Allocate a string block of sufficient size. - VaryingString* string = impure->vlu_string; - if (string && string->str_length < impure->vlu_desc.dsc_length) - { - delete string; - string = NULL; - } - - if (!string) - { - string = impure->vlu_string = FB_NEW_RPT(*tdbb->getDefaultPool(), - impure->vlu_desc.dsc_length) VaryingString(); - string->str_length = impure->vlu_desc.dsc_length; - } - - impure->vlu_desc.dsc_address = string->str_data; + ERR_post(Arg::Gds(isc_request_outdated) << rpb.rpb_relation->rel_name); } - else - impure->vlu_desc.dsc_address = (UCHAR*) &impure->vlu_misc; - MOV_move(tdbb, &desc, &impure->vlu_desc); + if (!DSC_EQUIV(&impure->vlu_desc, &compileFormat->fmt_desc[id], true)) + { + dsc desc = impure->vlu_desc; + impure->vlu_desc = compileFormat->fmt_desc[id]; + + if (impure->vlu_desc.isText()) + { + // Allocate a string block of sufficient size. + VaryingString* string = impure->vlu_string; + if (string && string->str_length < impure->vlu_desc.dsc_length) + { + delete string; + string = NULL; + } + + if (!string) + { + string = impure->vlu_string = FB_NEW_RPT(*tdbb->getDefaultPool(), + impure->vlu_desc.dsc_length) VaryingString(); + string->str_length = impure->vlu_desc.dsc_length; + } + + impure->vlu_desc.dsc_address = string->str_data; + } + else + impure->vlu_desc.dsc_address = (UCHAR*) &impure->vlu_misc; + + MOV_move(tdbb, &desc, &impure->vlu_desc); + } } } diff --git a/src/msgs/facilities2.sql b/src/msgs/facilities2.sql index ea23540943..7281fad198 100644 --- a/src/msgs/facilities2.sql +++ b/src/msgs/facilities2.sql @@ -1,7 +1,7 @@ /* MAX_NUMBER is the next number to be used, always one more than the highest message number. */ set bulk_insert INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUMBER) VALUES (?, ?, ?, ?); -- -('2010-10-11 19:51:12', 'JRD', 0, 701) +('2010-10-13 12:38:13', 'JRD', 0, 702) ('2010-03-15 06:59:09', 'QLI', 1, 531) -- --('2008-11-28 20:27:04', 'GDEF', 2, 346) diff --git a/src/msgs/messages2.sql b/src/msgs/messages2.sql index eea198d252..4816ee1092 100644 --- a/src/msgs/messages2.sql +++ b/src/msgs/messages2.sql @@ -807,7 +807,8 @@ Data source : @4', NULL, NULL) ('async_active', 'REM_cancel_operation', 'interface.cpp', NULL, 0, 697, NULL, 'Asynchronous call is already running for this attachment', NULL, NULL) ('private_function', 'METD_get_function', 'metd.epp', NULL, 0, 698, NULL, 'Function @1 is private to package @2', NULL, NULL) ('private_procedure', 'METD_get_procedure', 'metd.epp', NULL, 0, 699, NULL, 'Procedure @1 is private to package @2', NULL, NULL) -('bad_events_handle', NULL, NULL, NULL, 0, 700, NULL, 'invalid events id (handle)', NULL, NULL); +('request_outdated', 'EVL_expr', 'evl.cpp', NULL, 0, 700, NULL, 'Request can''t access new records in relation @1 and should be recompiled', NULL, NULL) +('bad_events_handle', NULL, NULL, NULL, 0, 701, NULL, 'invalid events id (handle)', NULL, NULL); -- QLI (NULL, NULL, NULL, NULL, 1, 0, NULL, 'expected type', NULL, NULL); (NULL, NULL, NULL, NULL, 1, 1, NULL, 'bad block type', NULL, NULL); diff --git a/src/msgs/system_errors2.sql b/src/msgs/system_errors2.sql index 510003c042..79b4bd737e 100644 --- a/src/msgs/system_errors2.sql +++ b/src/msgs/system_errors2.sql @@ -705,7 +705,8 @@ set bulk_insert INSERT INTO SYSTEM_ERRORS (SQL_CODE, SQL_CLASS, SQL_SUBCLASS, FA (-532, 'HY', '018', 0, 697, 'async_active', NULL, NULL) (-901, '42', '000', 0, 698, 'private_function', NULL, NULL) (-901, '42', '000', 0, 699, 'private_procedure', NULL, NULL) -(-901, '08', '003', 0, 700, 'bad_events_handle', NULL, 'ERROR') +(-904, '24', '000', 0, 700, 'request_outdated', NULL, NULL) +(-901, '08', '003', 0, 701, 'bad_events_handle', NULL, 'ERROR') -- GFIX (-901, '00', '000', 3, 1, 'gfix_db_name', NULL, NULL) (-901, '00', '000', 3, 2, 'gfix_invalid_sw', NULL, NULL)