Skip to content

Commit

Permalink
Postfix for #7168 - use same logic of errors/warnings of functions in…
Browse files Browse the repository at this point in the history
… procedures.
  • Loading branch information
asfernandes committed Apr 12, 2022
1 parent 7096f67 commit 7290d40
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 4 deletions.
24 changes: 22 additions & 2 deletions src/dsql/StmtNodes.cpp
Expand Up @@ -2925,6 +2925,7 @@ DmlNode* ExecProcedureNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScr
{
SET_TDBB(tdbb);

const auto blrStartPos = csb->csb_blr_reader.getPos();
jrd_prc* procedure = NULL;
QualifiedName name;

Expand Down Expand Up @@ -2957,6 +2958,25 @@ DmlNode* ExecProcedureNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScr

if (!procedure)
PAR_error(csb, Arg::Gds(isc_prcnotdef) << Arg::Str(name.toString()));
else
{
if (procedure->isImplemented() && !procedure->isDefined())
{
if (tdbb->getAttachment()->isGbak() || (tdbb->tdbb_flags & TDBB_replicator))
{
PAR_warning(
Arg::Warning(isc_prcnotdef) << Arg::Str(name.toString()) <<
Arg::Warning(isc_modnotfound));
}
else
{
csb->csb_blr_reader.setPos(blrStartPos);
PAR_error(csb,
Arg::Gds(isc_prcnotdef) << Arg::Str(name.toString()) <<
Arg::Gds(isc_modnotfound));
}
}
}

ExecProcedureNode* node = FB_NEW_POOL(pool) ExecProcedureNode(pool);
node->procedure = procedure;
Expand Down Expand Up @@ -3237,8 +3257,8 @@ void ExecProcedureNode::executeProcedure(thread_db* tdbb, Request* request) cons
else if (!procedure->isDefined())
{
status_exception::raise(
Arg::Gds(isc_prcnotdef) <<
Arg::Str(procedure->getName().toString()));
Arg::Gds(isc_prcnotdef) << Arg::Str(procedure->getName().toString()) <<
Arg::Gds(isc_modnotfound));
}

const_cast<jrd_prc*>(procedure.getObject())->checkReload(tdbb);
Expand Down
20 changes: 20 additions & 0 deletions src/jrd/RecordSourceNodes.cpp
Expand Up @@ -889,6 +889,7 @@ ProcedureSourceNode* ProcedureSourceNode::parse(thread_db* tdbb, CompilerScratch
{
SET_TDBB(tdbb);

const auto blrStartPos = csb->csb_blr_reader.getPos();
jrd_prc* procedure = NULL;
string* aliasString = NULL;
QualifiedName name;
Expand Down Expand Up @@ -955,6 +956,25 @@ ProcedureSourceNode* ProcedureSourceNode::parse(thread_db* tdbb, CompilerScratch

if (!procedure)
PAR_error(csb, Arg::Gds(isc_prcnotdef) << Arg::Str(name.toString()));
else
{
if (procedure->isImplemented() && !procedure->isDefined())
{
if (tdbb->getAttachment()->isGbak() || (tdbb->tdbb_flags & TDBB_replicator))
{
PAR_warning(
Arg::Warning(isc_prcnotdef) << Arg::Str(name.toString()) <<
Arg::Warning(isc_modnotfound));
}
else
{
csb->csb_blr_reader.setPos(blrStartPos);
PAR_error(csb,
Arg::Gds(isc_prcnotdef) << Arg::Str(name.toString()) <<
Arg::Gds(isc_modnotfound));
}
}
}

if (procedure->prc_type == prc_executable)
{
Expand Down
4 changes: 2 additions & 2 deletions src/jrd/recsrc/ProcedureScan.cpp
Expand Up @@ -66,8 +66,8 @@ void ProcedureScan::open(thread_db* tdbb) const
else if (!m_procedure->isDefined())
{
status_exception::raise(
Arg::Gds(isc_prcnotdef) <<
Arg::Str(m_procedure->getName().toString()));
Arg::Gds(isc_prcnotdef) << Arg::Str(m_procedure->getName().toString()) <<
Arg::Gds(isc_modnotfound));
}

const_cast<jrd_prc*>(m_procedure)->checkReload(tdbb);
Expand Down

0 comments on commit 7290d40

Please sign in to comment.