From ab25c33244f9cedc61d755a1f11c5a30f5492a64 Mon Sep 17 00:00:00 2001 From: asfernandes Date: Mon, 28 Dec 2009 01:06:40 +0000 Subject: [PATCH] Make packaged functions work --- src/dsql/PackageNodes.epp | 3 ++- src/isql/show.epp | 2 +- src/jrd/Function.epp | 23 ++++++++++++++--------- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/dsql/PackageNodes.epp b/src/dsql/PackageNodes.epp index 55b773ce73..8771eaa63f 100644 --- a/src/dsql/PackageNodes.epp +++ b/src/dsql/PackageNodes.epp @@ -225,7 +225,7 @@ namespace WITH FUN.RDB$PACKAGE_NAME EQ metaName.c_str() { Signature function(FUN.RDB$FUNCTION_NAME); - function.defined = !FUN.RDB$ENTRYPOINT.NULL; + function.defined = !FUN.RDB$ENTRYPOINT.NULL || !FUN.RDB$FUNCTION_BLR.NULL; if (details) { @@ -1034,6 +1034,7 @@ void DropPackageBodyNode::execute(thread_db* tdbb, jrd_tra* transaction) FUN.RDB$MODULE_NAME.NULL = TRUE; FUN.RDB$ENGINE_NAME.NULL = TRUE; FUN.RDB$ENTRYPOINT.NULL = TRUE; + FUN.RDB$FUNCTION_BLR.NULL = TRUE; END_MODIFY } } diff --git a/src/isql/show.epp b/src/isql/show.epp index b0c6787acf..ad20044009 100644 --- a/src/isql/show.epp +++ b/src/isql/show.epp @@ -3855,7 +3855,7 @@ static processing_state show_proc(const SCHAR* procname) if (i == 0) isqlGlob.printf("Global procedures:%s", NEWLINE); else - isqlGlob.printf("Packaged procedures:%s", NEWLINE); + isqlGlob.printf("%sPackaged procedures:%s", NEWLINE, NEWLINE); isqlGlob.printf( "Procedure Name Invalid Dependency, Type%s", NEWLINE); diff --git a/src/jrd/Function.epp b/src/jrd/Function.epp index 6d2e489998..4c74039794 100644 --- a/src/jrd/Function.epp +++ b/src/jrd/Function.epp @@ -478,21 +478,26 @@ Function* Function::loadMetadata(thread_db* tdbb, USHORT id, bool noscan, USHORT } else { - fb_assert(function->fun_legacy); - function->fun_external = NULL; function->setRequest(NULL); - function->fun_entrypoint = - Module::lookup(X.RDB$MODULE_NAME, X.RDB$ENTRYPOINT, dbb->dbb_modules); - - // Could not find a function with given MODULE, ENTRYPOINT. - // Try the list of internally implemented functions. - if (!function->fun_entrypoint) + if (!X.RDB$MODULE_NAME.NULL && !X.RDB$ENTRYPOINT.NULL) { + fb_assert(function->fun_legacy); + function->fun_entrypoint = - BUILTIN_entrypoint(X.RDB$MODULE_NAME, X.RDB$ENTRYPOINT); + Module::lookup(X.RDB$MODULE_NAME, X.RDB$ENTRYPOINT, dbb->dbb_modules); + + // Could not find a function with given MODULE, ENTRYPOINT. + // Try the list of internally implemented functions. + if (!function->fun_entrypoint) + { + function->fun_entrypoint = + BUILTIN_entrypoint(X.RDB$MODULE_NAME, X.RDB$ENTRYPOINT); + } } + else + function->fun_entrypoint = NULL; } if (X.RDB$VALID_BLR.NULL || X.RDB$VALID_BLR == FALSE)