From: Claudio V. C. <ro...@us...> - 2005-05-26 04:01:08
|
Build Version : T2.0.0.10996 Firebird 2.0 Alpha 2 (writeBuildNum.sh,v 1.11008 2005/05/26 04:00:56 robocop Exp ) Update of /cvsroot/firebird/firebird2/src/jrd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17325/src/jrd Modified Files: met.epp met_proto.h par.cpp Log Message: - Solve char/UCHAR mismatch. - Track dependencies on indices mentioned in explicit plans for procedures and vierws. Index: met.epp =================================================================== RCS file: /cvsroot/firebird/firebird2/src/jrd/met.epp,v retrieving revision 1.162 retrieving revision 1.163 diff -b -U3 -r1.162 -r1.163 --- met.epp 22 May 2005 03:11:41 -0000 1.162 +++ met.epp 26 May 2005 04:00:44 -0000 1.163 @@ -955,7 +955,7 @@ jrd_nod* MET_get_dependencies(thread_db* tdbb, jrd_rel* relation, - const TEXT* blob, + const UCHAR* blob, CompilerScratch* view_csb, bid* blob_id, jrd_req** request, @@ -986,7 +986,7 @@ { node = PAR_blr( tdbb, relation, - reinterpret_cast<const UCHAR*>(blob), + blob, view_csb, &csb, request, @@ -3346,7 +3346,7 @@ case RSR_computed_blr: field->fld_computation = (dependencies) ? - MET_get_dependencies(tdbb, relation, (const TEXT*) p, csb, + MET_get_dependencies(tdbb, relation, p, csb, NULL, NULL, NULL, field->fld_name, obj_computed, 0) : PAR_blr(tdbb, relation, p, csb, NULL, NULL, false, 0); @@ -4157,36 +4157,41 @@ jrd_rel* relation = NULL; jrd_prc* procedure = NULL; const Firebird::MetaName* dpdo_name = 0; + switch (dpdo_type) { case obj_relation: relation = (jrd_rel*) node->nod_arg[e_dep_object]; dpdo_name = &relation->rel_name; break; case obj_procedure: - procedure = (jrd_prc*) node->nod_arg [e_dep_object]; + procedure = (jrd_prc*) node->nod_arg[e_dep_object]; dpdo_name = &procedure->prc_name; break; case obj_exception: { - const SLONG number = (IPTR) node->nod_arg [e_dep_object]; + const SLONG number = (IPTR) node->nod_arg[e_dep_object]; MET_lookup_exception (tdbb, number, name, 0, 0); dpdo_name = &name; - break; } - /* CVC: Here I'm going to track those pesky things named generators and UDFs. */ + break; + // CVC: Here I'm going to track those pesky things named generators and UDFs. case obj_generator: { - const SLONG number = (IPTR) node->nod_arg [e_dep_object]; + const SLONG number = (IPTR) node->nod_arg[e_dep_object]; MET_lookup_generator_id (tdbb, number, name); dpdo_name = &name; - break; } + break; case obj_udf: { - UserFunction* udf = (UserFunction*) node->nod_arg [e_dep_object]; + UserFunction* udf = (UserFunction*) node->nod_arg[e_dep_object]; dpdo_name = &udf->fun_symbol->sym_string; } break; + case obj_index: + name = (TEXT*) node->nod_arg[e_dep_object]; + dpdo_name = &name; + break; } jrd_nod* field_node = node->nod_arg[e_dep_field]; Index: met_proto.h =================================================================== RCS file: /cvsroot/firebird/firebird2/src/jrd/met_proto.h,v retrieving revision 1.45 retrieving revision 1.46 diff -b -U3 -r1.45 -r1.46 --- met_proto.h 12 May 2005 18:28:02 -0000 1.45 +++ met_proto.h 26 May 2005 04:00:45 -0000 1.46 @@ -52,7 +52,7 @@ void MET_error(const TEXT*, ...); Jrd::Format* MET_format(Jrd::thread_db*, Jrd::jrd_rel*, USHORT); bool MET_get_char_subtype(Jrd::thread_db*, SSHORT*, const UCHAR*, USHORT); -Jrd::jrd_nod* MET_get_dependencies(Jrd::thread_db*, Jrd::jrd_rel*, const TEXT*, +Jrd::jrd_nod* MET_get_dependencies(Jrd::thread_db*, Jrd::jrd_rel*, const UCHAR*, Jrd::CompilerScratch*, Jrd::bid*, Jrd::jrd_req**, Jrd::CompilerScratch**, Firebird::MetaName&, USHORT, USHORT); class Jrd::jrd_fld* MET_get_field(Jrd::jrd_rel*, USHORT); Index: par.cpp =================================================================== RCS file: /cvsroot/firebird/firebird2/src/jrd/par.cpp,v retrieving revision 1.115 retrieving revision 1.116 diff -b -U3 -r1.115 -r1.116 --- par.cpp 17 May 2005 18:19:54 -0000 1.115 +++ par.cpp 26 May 2005 04:00:45 -0000 1.116 @@ -960,6 +960,11 @@ if (csb->csb_rpt[stream].csb_relation) { node->nod_arg[e_dep_object] = (jrd_nod*) csb->csb_rpt[stream].csb_relation; + // How do I determine reliably this is a view? + // At this time, rel_view_rse is still null. + //if (is_view) + // node->nod_arg[e_dep_object_type] = (jrd_nod*)(IPTR) obj_view; + //else node->nod_arg[e_dep_object_type] = (jrd_nod*)(IPTR) obj_relation; } else if (csb->csb_rpt[stream].csb_procedure) { @@ -1626,6 +1631,7 @@ USHORT extra_count = 0; jrd_nod* access_type = 0; Firebird::MetaName name; + TEXT* idx_name = 0; switch (node_type) { case blr_navigational: @@ -1665,7 +1671,17 @@ access_type->nod_arg[e_access_type_relation] = (jrd_nod*) (IPTR) relation_id; access_type->nod_arg[e_access_type_index] = (jrd_nod*) (IPTR) index_id; - access_type->nod_arg[e_access_type_index_name] = (jrd_nod*) ALL_cstring(tdbb->getDefaultPool(), name.c_str()); + idx_name = ALL_cstring(tdbb->getDefaultPool(), name.c_str()); + access_type->nod_arg[e_access_type_index_name] = (jrd_nod*) idx_name; + + if (csb->csb_g_flags & csb_get_dependencies) + { + jrd_nod* dep_node = PAR_make_node (tdbb, e_dep_length); + dep_node->nod_type = nod_dependency; + dep_node->nod_arg[e_dep_object] = (jrd_nod*) idx_name; + dep_node->nod_arg[e_dep_object_type] = (jrd_nod*)(IPTR) obj_index; + csb->csb_dependencies.push(dep_node); + } if (BLR_PEEK == blr_indices) // dimitr: FALL INTO, if the plan item is ORDER ... INDEX (...) @@ -1720,10 +1736,20 @@ *arg++ = (jrd_nod*) (IPTR) relation_id; *arg++ = (jrd_nod*) (IPTR) index_id; - *arg++ = (jrd_nod*) ALL_cstring(tdbb->getDefaultPool(), name.c_str()); + idx_name = ALL_cstring(tdbb->getDefaultPool(), name.c_str()); + *arg++ = (jrd_nod*) idx_name; + + if (csb->csb_g_flags & csb_get_dependencies) + { + jrd_nod* dep_node = PAR_make_node (tdbb, e_dep_length); + dep_node->nod_type = nod_dependency; + dep_node->nod_arg[e_dep_object] = (jrd_nod*) idx_name; + dep_node->nod_arg[e_dep_object_type] = (jrd_nod*)(IPTR) obj_index; + csb->csb_dependencies.push(dep_node); } - break; } + } + break; case blr_sequential: break; default: |