From e90fc8d63f24be656e2e67b74a7723864f6ae9d9 Mon Sep 17 00:00:00 2001 From: robocop Date: Wed, 5 Aug 2009 12:30:32 +0000 Subject: [PATCH] Change the interface again. Please full rebuild (although the many recent changes to common.h almost qualify as full rebuild). --- src/dsql/dsql.cpp | 2 +- src/gpre/int_cxx.cpp | 2 +- src/jrd/cmp.cpp | 6 +++--- src/jrd/cmp_proto.h | 4 ++-- src/jrd/dyn_def.epp | 2 +- src/jrd/dyn_util.epp | 4 ++-- src/jrd/jrd.cpp | 7 ++++--- src/jrd/jrd_proto.h | 2 +- src/jrd/par.cpp | 30 +++++++++++++++++------------- src/jrd/par_proto.h | 4 ++-- 10 files changed, 34 insertions(+), 29 deletions(-) diff --git a/src/dsql/dsql.cpp b/src/dsql/dsql.cpp index 50e6212703..436133cd90 100644 --- a/src/dsql/dsql.cpp +++ b/src/dsql/dsql.cpp @@ -2647,7 +2647,7 @@ static dsql_req* prepare(thread_db* tdbb, dsql_dbb* database, jrd_tra* transacti statement->req_flags |= REQ_blr_version4; GEN_request(statement, node); - const USHORT length = statement->req_blr_data.getCount(); + const ULONG length = statement->req_blr_data.getCount(); // stop here for ddl statements diff --git a/src/gpre/int_cxx.cpp b/src/gpre/int_cxx.cpp index 4e3b1e0dc3..f4d25645d4 100644 --- a/src/gpre/int_cxx.cpp +++ b/src/gpre/int_cxx.cpp @@ -290,7 +290,7 @@ static void gen_compile( const gpre_req* request, int column) fprintf(gpreGlob.out_file, "if (!%s)", request->req_handle); align(column); fprintf(gpreGlob.out_file, - "%s = CMP_compile2 (tdbb, (UCHAR*) jrd_%"ULONGFORMAT", sizeof(jrd_%"ULONGFORMAT"), TRUE);", + "%s = CMP_compile2 (tdbb, (UCHAR*) jrd_%"ULONGFORMAT", sizeof(jrd_%"ULONGFORMAT"), true);", request->req_handle, request->req_ident, request->req_ident); } diff --git a/src/jrd/cmp.cpp b/src/jrd/cmp.cpp index 7169f405c9..ad434f71fe 100644 --- a/src/jrd/cmp.cpp +++ b/src/jrd/cmp.cpp @@ -578,7 +578,7 @@ jrd_req* CMP_clone_request(thread_db* tdbb, jrd_req* request, USHORT level, bool } -jrd_req* CMP_compile2(thread_db* tdbb, const UCHAR* blr, ULONG blr_length, USHORT internal_flag, +jrd_req* CMP_compile2(thread_db* tdbb, const UCHAR* blr, ULONG blr_length, bool internal_flag, USHORT dbginfo_length, const UCHAR* dbginfo) { /************************************** @@ -604,8 +604,8 @@ jrd_req* CMP_compile2(thread_db* tdbb, const UCHAR* blr, ULONG blr_length, USHOR { Jrd::ContextPoolHolder context(tdbb, new_pool); - CompilerScratch* csb = PAR_parse(tdbb, blr, blr_length, - internal_flag, dbginfo_length, dbginfo); + CompilerScratch* csb = + PAR_parse(tdbb, blr, blr_length, internal_flag, dbginfo_length, dbginfo); request = CMP_make_request(tdbb, csb, internal_flag); new_pool->setStatsGroup(request->req_memory_stats); diff --git a/src/jrd/cmp_proto.h b/src/jrd/cmp_proto.h index e26be88fe5..f18201c571 100644 --- a/src/jrd/cmp_proto.h +++ b/src/jrd/cmp_proto.h @@ -32,8 +32,8 @@ bool CMP_clone_is_active(const Jrd::jrd_req*); Jrd::jrd_nod* CMP_clone_node_opt(Jrd::thread_db*, Jrd::CompilerScratch*, Jrd::jrd_nod*); Jrd::jrd_nod* CMP_clone_node(Jrd::thread_db*, Jrd::CompilerScratch*, Jrd::jrd_nod*); Jrd::jrd_req* CMP_clone_request(Jrd::thread_db*, Jrd::jrd_req*, USHORT, bool); -Jrd::jrd_req* CMP_compile2(Jrd::thread_db*, const UCHAR*, ULONG, USHORT, USHORT = 0, - const UCHAR* = NULL); +Jrd::jrd_req* CMP_compile2(Jrd::thread_db*, const UCHAR* blr, ULONG blr_length, bool internal_flag, + USHORT = 0, const UCHAR* = NULL); Jrd::CompilerScratch::csb_repeat* CMP_csb_element(Jrd::CompilerScratch*, USHORT); void CMP_decrement_prc_use_count(Jrd::thread_db*, Jrd::jrd_prc*); Jrd::jrd_req* CMP_find_request(Jrd::thread_db*, USHORT, USHORT); diff --git a/src/jrd/dyn_def.epp b/src/jrd/dyn_def.epp index 8d1f3dfc65..c6dd8d3b1b 100644 --- a/src/jrd/dyn_def.epp +++ b/src/jrd/dyn_def.epp @@ -4871,7 +4871,7 @@ static bool get_who( thread_db* tdbb, Global* gbl, Firebird::MetaName& output_na try { if (!request) { - request = CMP_compile2(tdbb, who_blr, sizeof(who_blr), TRUE); + request = CMP_compile2(tdbb, who_blr, sizeof(who_blr), true); } EXE_start(tdbb, request, gbl->gbl_transaction); SqlIdentifier x; diff --git a/src/jrd/dyn_util.epp b/src/jrd/dyn_util.epp index c038301f2e..b15d7269c7 100644 --- a/src/jrd/dyn_util.epp +++ b/src/jrd/dyn_util.epp @@ -147,7 +147,7 @@ SINT64 DYN_UTIL_gen_unique_id(thread_db* tdbb, memcpy(p, gen_id_blr2, sizeof(gen_id_blr2)); p += sizeof(gen_id_blr2); - request = CMP_compile2(tdbb, blr.begin(), (ULONG) blr.getCount(), TRUE); + request = CMP_compile2(tdbb, blr.begin(), (ULONG) blr.getCount(), true); } EXE_start(tdbb, request, dbb->dbb_sys_trans); @@ -582,7 +582,7 @@ bool DYN_UTIL_get_prot(thread_db* tdbb, if (!request) { - request = CMP_compile2(tdbb, prot_blr, sizeof(prot_blr), TRUE); + request = CMP_compile2(tdbb, prot_blr, sizeof(prot_blr), true); } gds__vtov(rname, in_msg.relation_name, sizeof(in_msg.relation_name)); gds__vtov(fname, in_msg.field_name, sizeof(in_msg.field_name)); diff --git a/src/jrd/jrd.cpp b/src/jrd/jrd.cpp index 3043f4f624..80a89ffb8d 100644 --- a/src/jrd/jrd.cpp +++ b/src/jrd/jrd.cpp @@ -1712,7 +1712,8 @@ ISC_STATUS GDS_COMPILE(ISC_STATUS* user_status, TraceBlrCompile trace(tdbb, blr_length, (UCHAR*) blr); try { - JRD_compile(tdbb, attachment, req_handle, blr_length, reinterpret_cast(blr), + JRD_compile(tdbb, attachment, req_handle, + (USHORT) blr_length, reinterpret_cast(blr), RefStrPtr(), 0, NULL); fb_assert(*req_handle); @@ -6589,7 +6590,7 @@ void JRD_unwind_request(thread_db* tdbb, jrd_req* request, SSHORT level) void JRD_compile(thread_db* tdbb, Attachment* attachment, jrd_req** req_handle, - SSHORT blr_length, + ULONG blr_length, const UCHAR* blr, RefStrPtr ref_str, USHORT dbginfo_length, const UCHAR* dbginfo) @@ -6607,7 +6608,7 @@ void JRD_compile(thread_db* tdbb, if (*req_handle) status_exception::raise(Arg::Gds(isc_bad_req_handle)); - jrd_req* request = CMP_compile2(tdbb, blr, blr_length, FALSE, dbginfo_length, dbginfo); + jrd_req* request = CMP_compile2(tdbb, blr, blr_length, false, dbginfo_length, dbginfo); request->req_attachment = attachment; request->req_request = attachment->att_requests; diff --git a/src/jrd/jrd_proto.h b/src/jrd/jrd_proto.h index 2f8cb9dbd2..8db0d9dfc2 100644 --- a/src/jrd/jrd_proto.h +++ b/src/jrd/jrd_proto.h @@ -160,7 +160,7 @@ void JRD_start_multiple(Jrd::thread_db* tdbb, Jrd::jrd_tra** tra_handle, USHORT void JRD_start_transaction(Jrd::thread_db* tdbb, Jrd::jrd_tra** transaction, SSHORT count, ...); void JRD_unwind_request(Jrd::thread_db* tdbb, Jrd::jrd_req* request, SSHORT level); void JRD_compile(Jrd::thread_db* tdbb, Jrd::Attachment* attachment, Jrd::jrd_req** req_handle, - SSHORT blr_length, const UCHAR* blr, Firebird::RefStrPtr, + ULONG blr_length, const UCHAR* blr, Firebird::RefStrPtr, USHORT dbginfo_length, const UCHAR* dbginfo); bool JRD_verify_database_access(const Firebird::PathName&); diff --git a/src/jrd/par.cpp b/src/jrd/par.cpp index 23ac948fef..135b9bd58e 100644 --- a/src/jrd/par.cpp +++ b/src/jrd/par.cpp @@ -186,15 +186,18 @@ jrd_nod* PAR_blr(thread_db* tdbb, jrd_rel* relation, const UCHAR* blr, ULONG blr } const SSHORT version = csb->csb_blr_reader.getByte(); - - if (version != blr_version4 && version != blr_version5) { + switch (version) + { + case blr_version4: + csb->csb_g_flags |= csb_blr_version4; + break; + case blr_version5: + break; // nothing to do + default: error(csb, Arg::Gds(isc_metadata_corrupt) << Arg::Gds(isc_wroblrver) << Arg::Num(blr_version4) << Arg::Num(version)); } - if (version == blr_version4) - csb->csb_g_flags |= csb_blr_version4; - jrd_nod* node = PAR_parse_node(tdbb, csb, OTHER); csb->csb_node = node; @@ -665,7 +668,7 @@ jrd_nod* PAR_make_node(thread_db* tdbb, int size) CompilerScratch* PAR_parse(thread_db* tdbb, const UCHAR* blr, ULONG blr_length, - USHORT internal_flag, USHORT dbginfo_length, const UCHAR* dbginfo) + bool internal_flag, USHORT dbginfo_length, const UCHAR* dbginfo) { /************************************** * @@ -682,18 +685,19 @@ CompilerScratch* PAR_parse(thread_db* tdbb, const UCHAR* blr, ULONG blr_length, CompilerScratch* csb = CompilerScratch::newCsb(*tdbb->getDefaultPool(), 5); csb->csb_blr_reader = BlrReader(blr, blr_length); - const SSHORT version = csb->csb_blr_reader.getByte(); if (internal_flag) csb->csb_g_flags |= csb_internal; - if (version != blr_version4 && version != blr_version5) - { - error(csb, Arg::Gds(isc_wroblrver) << Arg::Num(blr_version4) << Arg::Num(version)); - } - - if (version == blr_version4) + const SSHORT version = csb->csb_blr_reader.getByte(); + switch (version) { + case blr_version4: csb->csb_g_flags |= csb_blr_version4; + break; + case blr_version5: + break; // nothing to do + default: + error(csb, Arg::Gds(isc_wroblrver) << Arg::Num(blr_version4) << Arg::Num(version)); } if (dbginfo_length > 0) diff --git a/src/jrd/par_proto.h b/src/jrd/par_proto.h index 20c5603f6a..71cb5348ad 100644 --- a/src/jrd/par_proto.h +++ b/src/jrd/par_proto.h @@ -54,8 +54,8 @@ Jrd::jrd_nod* PAR_gen_field(Jrd::thread_db*, USHORT, USHORT); Jrd::jrd_nod* PAR_make_field(Jrd::thread_db*, Jrd::CompilerScratch*, USHORT, const Firebird::MetaName&); Jrd::jrd_nod* PAR_make_list(Jrd::thread_db*, Jrd::NodeStack&); Jrd::jrd_nod* PAR_make_node(Jrd::thread_db*, int); -Jrd::CompilerScratch* PAR_parse(Jrd::thread_db*, const UCHAR*, ULONG, USHORT, - USHORT = 0, const UCHAR* = NULL); +Jrd::CompilerScratch* PAR_parse(Jrd::thread_db*, const UCHAR* blr, ULONG blr_length, + bool internal_flag, USHORT = 0, const UCHAR* = NULL); SLONG PAR_symbol_to_gdscode(const Firebird::string&);