8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 22:43:03 +01:00

Fix #7168 - Ignore missing UDR libraries during restore.

This commit is contained in:
Adriano dos Santos Fernandes 2022-04-11 22:50:27 -03:00
parent 3c5a5afb9f
commit bbd12925b1
5 changed files with 55 additions and 17 deletions

View File

@ -3198,6 +3198,12 @@ void ExecProcedureNode::executeProcedure(thread_db* tdbb, jrd_req* request) cons
Arg::Gds(isc_proc_pack_not_implemented) <<
Arg::Str(procedure->getName().identifier) << Arg::Str(procedure->getName().package));
}
else if (!procedure->isDefined())
{
status_exception::raise(
Arg::Gds(isc_prcnotdef) <<
Arg::Str(procedure->getName().toString()));
}
const_cast<jrd_prc*>(procedure.getObject())->checkReload(tdbb);

View File

@ -1298,6 +1298,9 @@ void ExtEngineManager::makeFunction(thread_db* tdbb, CompilerScratch* csb, Jrd::
metadata->inputParameters.assignRefNoIncr(Routine::createMetadata(udf->getInputFields(), true));
metadata->outputParameters.assignRefNoIncr(Routine::createMetadata(udf->getOutputFields(), true));
udf->setInputFormat(Routine::createFormat(pool, metadata->inputParameters, false));
udf->setOutputFormat(Routine::createFormat(pool, metadata->outputParameters, true));
FbLocalStatus status;
RefPtr<IMetadataBuilder> inBuilder(REF_NO_INCR, metadata->inputParameters->getBuilder(&status));
@ -1314,12 +1317,23 @@ void ExtEngineManager::makeFunction(thread_db* tdbb, CompilerScratch* csb, Jrd::
externalFunction = attInfo->engine->makeFunction(&status, attInfo->context, metadata,
inBuilder, outBuilder);
status.check();
if (!externalFunction)
try
{
status_exception::raise(
Arg::Gds(isc_eem_func_not_returned) << udf->getName().toString() << engine);
status.check();
if (!externalFunction)
{
status_exception::raise(
Arg::Gds(isc_eem_func_not_returned) << udf->getName().toString() << engine);
}
}
catch (const Exception&)
{
if (tdbb->getAttachment()->isGbak())
return;
else
throw;
}
extInputParameters.assignRefNoIncr(inBuilder->getMetadata(&status));
@ -1329,9 +1343,6 @@ void ExtEngineManager::makeFunction(thread_db* tdbb, CompilerScratch* csb, Jrd::
status.check();
}
udf->setInputFormat(Routine::createFormat(pool, metadata->inputParameters, false));
udf->setOutputFormat(Routine::createFormat(pool, metadata->outputParameters, true));
const Format* extInputFormat = Routine::createFormat(pool, extInputParameters, false);
const Format* extOutputFormat = Routine::createFormat(pool, extOutputParameters, true);
@ -1423,6 +1434,9 @@ void ExtEngineManager::makeProcedure(thread_db* tdbb, CompilerScratch* csb, jrd_
metadata->inputParameters.assignRefNoIncr(Routine::createMetadata(prc->getInputFields(), true));
metadata->outputParameters.assignRefNoIncr(Routine::createMetadata(prc->getOutputFields(), true));
prc->setInputFormat(Routine::createFormat(pool, metadata->inputParameters, false));
prc->setOutputFormat(Routine::createFormat(pool, metadata->outputParameters, true));
FbLocalStatus status;
RefPtr<IMetadataBuilder> inBuilder(REF_NO_INCR, metadata->inputParameters->getBuilder(&status));
@ -1439,13 +1453,24 @@ void ExtEngineManager::makeProcedure(thread_db* tdbb, CompilerScratch* csb, jrd_
externalProcedure = attInfo->engine->makeProcedure(&status, attInfo->context, metadata,
inBuilder, outBuilder);
status.check();
if (!externalProcedure)
try
{
status_exception::raise(
Arg::Gds(isc_eem_proc_not_returned) <<
prc->getName().toString() << engine);
status.check();
if (!externalProcedure)
{
status_exception::raise(
Arg::Gds(isc_eem_proc_not_returned) <<
prc->getName().toString() << engine);
}
}
catch (const Exception&)
{
if (tdbb->getAttachment()->isGbak())
return;
else
throw;
}
extInputParameters.assignRefNoIncr(inBuilder->getMetadata(&status));
@ -1455,9 +1480,6 @@ void ExtEngineManager::makeProcedure(thread_db* tdbb, CompilerScratch* csb, jrd_
status.check();
}
prc->setInputFormat(Routine::createFormat(pool, metadata->inputParameters, false));
prc->setOutputFormat(Routine::createFormat(pool, metadata->outputParameters, true));
const Format* extInputFormat = Routine::createFormat(pool, extInputParameters, false);
const Format* extOutputFormat = Routine::createFormat(pool, extOutputParameters, true);

View File

@ -460,7 +460,7 @@ Function* Function::loadMetadata(thread_db* tdbb, USHORT id, bool noscan, USHORT
throw;
}
fb_assert(function->getStatement()->function == function);
fb_assert(!function->isDefined() || function->getStatement()->function == function);
}
else
{

View File

@ -3402,6 +3402,7 @@ jrd_prc* MET_procedure(thread_db* tdbb, USHORT id, bool noscan, USHORT flags)
procedure->invoker = attachment->getUserId(procedure->owner);
procedure->setImplemented(true);
procedure->setDefined(true);
procedure->getInputFields().resize(P.RDB$PROCEDURE_INPUTS);
procedure->getOutputFields().resize(P.RDB$PROCEDURE_OUTPUTS);
procedure->setDefaultCount(0);
@ -3526,6 +3527,9 @@ jrd_prc* MET_procedure(thread_db* tdbb, USHORT id, bool noscan, USHORT flags)
dbb->dbb_extManager->makeProcedure(tdbb, csb, procedure, P.RDB$ENGINE_NAME,
(P.RDB$ENTRYPOINT.NULL ? "" : P.RDB$ENTRYPOINT), body.begin());
if (!procedure->getExternal())
procedure->setDefined(false);
}
else
{
@ -3554,7 +3558,7 @@ jrd_prc* MET_procedure(thread_db* tdbb, USHORT id, bool noscan, USHORT flags)
throw;
}
fb_assert(procedure->getStatement()->procedure == procedure);
fb_assert(!procedure->isDefined() || procedure->getStatement()->procedure == procedure);
}
else
{

View File

@ -61,6 +61,12 @@ void ProcedureScan::open(thread_db* tdbb) const
Arg::Gds(isc_proc_pack_not_implemented) <<
Arg::Str(m_procedure->getName().identifier) << Arg::Str(m_procedure->getName().package));
}
else if (!m_procedure->isDefined())
{
status_exception::raise(
Arg::Gds(isc_prcnotdef) <<
Arg::Str(m_procedure->getName().toString()));
}
const_cast<jrd_prc*>(m_procedure)->checkReload(tdbb);