|
From: <asf...@us...> - 2013-03-27 01:34:48
|
Revision: 57840
http://sourceforge.net/p/firebird/code/57840
Author: asfernandes
Date: 2013-03-27 01:34:44 +0000 (Wed, 27 Mar 2013)
Log Message:
-----------
Fixed CORE-4068 - create package fails on creating header as soon as there is at least 1 procedure name.
Modified Paths:
--------------
firebird/trunk/builds/posix/Makefile.in.plugins_examples
firebird/trunk/src/jrd/ExtEngineManager.cpp
firebird/trunk/src/jrd/Function.epp
firebird/trunk/src/jrd/Routine.cpp
firebird/trunk/src/jrd/Routine.h
firebird/trunk/src/jrd/met.epp
Modified: firebird/trunk/builds/posix/Makefile.in.plugins_examples
===================================================================
--- firebird/trunk/builds/posix/Makefile.in.plugins_examples 2013-03-27 01:34:10 UTC (rev 57839)
+++ firebird/trunk/builds/posix/Makefile.in.plugins_examples 2013-03-27 01:34:44 UTC (rev 57840)
@@ -52,8 +52,7 @@
.PHONY: all udrcpp_example dc_example kh_example
-#all: udrcpp_example dc_example kh_example
-all: dc_example kh_example
+all: udrcpp_example dc_example kh_example
UDR_Objects = $(call makeObjects,../examples/udr,UdrCppExample.cpp)
Modified: firebird/trunk/src/jrd/ExtEngineManager.cpp
===================================================================
--- firebird/trunk/src/jrd/ExtEngineManager.cpp 2013-03-27 01:34:10 UTC (rev 57839)
+++ firebird/trunk/src/jrd/ExtEngineManager.cpp 2013-03-27 01:34:44 UTC (rev 57840)
@@ -439,7 +439,7 @@
if (relation)
{
- format = Routine::createFormat(pool, metadata->triggerFields);
+ format = Routine::createFormat(pool, metadata->triggerFields, false);
for (unsigned i = 0; i < format->fmt_count / 2; ++i)
fieldsPos.add(i);
@@ -671,8 +671,8 @@
try
{
- udf->setInputFormat(Routine::createFormat(pool, metadata->inputParameters));
- udf->setOutputFormat(Routine::createFormat(pool, metadata->outputParameters));
+ udf->setInputFormat(Routine::createFormat(pool, metadata->inputParameters, false));
+ udf->setOutputFormat(Routine::createFormat(pool, metadata->outputParameters, false));
udf->fun_external = FB_NEW(getPool()) Function(tdbb, this, attInfo->engine,
metadata.release(), externalFunction, udf);
@@ -744,8 +744,8 @@
try
{
- prc->setInputFormat(Routine::createFormat(pool, metadata->inputParameters));
- prc->setOutputFormat(Routine::createFormat(pool, metadata->outputParameters));
+ prc->setInputFormat(Routine::createFormat(pool, metadata->inputParameters, false));
+ prc->setOutputFormat(Routine::createFormat(pool, metadata->outputParameters, false));
prc->setExternal(FB_NEW(getPool()) Procedure(tdbb, this, attInfo->engine,
metadata.release(), externalProcedure, prc));
Modified: firebird/trunk/src/jrd/Function.epp
===================================================================
--- firebird/trunk/src/jrd/Function.epp 2013-03-27 01:34:10 UTC (rev 57839)
+++ firebird/trunk/src/jrd/Function.epp 2013-03-27 01:34:44 UTC (rev 57840)
@@ -374,58 +374,55 @@
function->fun_external = NULL;
function->setStatement(NULL);
- if (!X.RDB$ENGINE_NAME.NULL || !X.RDB$FUNCTION_BLR.NULL)
+ if (!X.RDB$ENGINE_NAME.NULL)
{
- if (!X.RDB$ENGINE_NAME.NULL)
+ HalfStaticArray<UCHAR, 512> body;
+
+ if (!X.RDB$FUNCTION_SOURCE.NULL)
{
- HalfStaticArray<UCHAR, 512> body;
+ blb* const blob = blb::open(tdbb, sysTransaction, &X.RDB$FUNCTION_SOURCE);
+ const ULONG len = blob->BLB_get_data(tdbb,
+ body.getBuffer(blob->blb_length + 1), blob->blb_length + 1);
+ body[MIN(blob->blb_length, len)] = 0;
+ }
+ else
+ body.getBuffer(1)[0] = 0;
- if (!X.RDB$FUNCTION_SOURCE.NULL)
- {
- blb* const blob = blb::open(tdbb, sysTransaction, &X.RDB$FUNCTION_SOURCE);
- const ULONG len = blob->BLB_get_data(tdbb,
- body.getBuffer(blob->blb_length + 1), blob->blb_length + 1);
- body[MIN(blob->blb_length, len)] = 0;
- }
- else
- body.getBuffer(1)[0] = 0;
+ dbb->dbb_extManager.makeFunction(tdbb, function, X.RDB$ENGINE_NAME,
+ (X.RDB$ENTRYPOINT.NULL ? "" : X.RDB$ENTRYPOINT), (char*) body.begin());
- dbb->dbb_extManager.makeFunction(tdbb, function, X.RDB$ENGINE_NAME,
- (X.RDB$ENTRYPOINT.NULL ? "" : X.RDB$ENTRYPOINT), (char*) body.begin());
+ if (!function->fun_external)
+ function->setDefined(false);
+ }
+ else if (!X.RDB$FUNCTION_BLR.NULL)
+ {
+ MemoryPool* const csb_pool = attachment->createPool();
+ Jrd::ContextPoolHolder context(tdbb, csb_pool);
- if (!function->fun_external)
- function->setDefined(false);
- }
- else
+ try
{
- MemoryPool* const csb_pool = attachment->createPool();
- Jrd::ContextPoolHolder context(tdbb, csb_pool);
+ AutoPtr<CompilerScratch> csb(CompilerScratch::newCsb(*csb_pool, 5));
+ if (!X.RDB$DEBUG_INFO.NULL)
+ DBG_parse_debug_info(tdbb, &X.RDB$DEBUG_INFO, *csb->csb_dbg_info);
+
try
{
- AutoPtr<CompilerScratch> csb(CompilerScratch::newCsb(*csb_pool, 5));
-
- if (!X.RDB$DEBUG_INFO.NULL)
- DBG_parse_debug_info(tdbb, &X.RDB$DEBUG_INFO, *csb->csb_dbg_info);
-
- try
- {
- MET_parse_routine_blr(tdbb, function, &X.RDB$FUNCTION_BLR, csb);
- }
- catch (const Exception&)
- {
- const string name = function->getName().toString();
- status_exception::raise(Arg::Gds(isc_bad_fun_BLR) << Arg::Str(name));
- }
+ MET_parse_routine_blr(tdbb, function, &X.RDB$FUNCTION_BLR, csb);
}
catch (const Exception&)
{
- attachment->deletePool(csb_pool);
- throw;
+ const string name = function->getName().toString();
+ status_exception::raise(Arg::Gds(isc_bad_fun_BLR) << Arg::Str(name));
}
+ }
+ catch (const Exception&)
+ {
+ attachment->deletePool(csb_pool);
+ throw;
+ }
- function->getStatement()->function = function;
- }
+ function->getStatement()->function = function;
}
else if (!X.RDB$MODULE_NAME.NULL && !X.RDB$ENTRYPOINT.NULL)
{
@@ -444,7 +441,17 @@
function->setDefined(false);
}
else
+ {
+ RefPtr<MsgMetadata> inputMetadata(createMetadata(function->getInputFields()));
+ inputMetadata->release();
+ function->setInputFormat(createFormat(function->getPool(), inputMetadata, false));
+
+ RefPtr<MsgMetadata> outputMetadata(createMetadata(function->getOutputFields()));
+ outputMetadata->release();
+ function->setOutputFormat(createFormat(function->getPool(), outputMetadata, true));
+
function->setImplemented(false);
+ }
if (X.RDB$VALID_BLR.NULL || X.RDB$VALID_BLR == FALSE)
valid_blr = false;
Modified: firebird/trunk/src/jrd/Routine.cpp
===================================================================
--- firebird/trunk/src/jrd/Routine.cpp 2013-03-27 01:34:10 UTC (rev 57839)
+++ firebird/trunk/src/jrd/Routine.cpp 2013-03-27 01:34:44 UTC (rev 57840)
@@ -48,14 +48,14 @@
}
// Create a Format based on an IMessageMetadata.
-Format* Routine::createFormat(MemoryPool& pool, IMessageMetadata* params)
+Format* Routine::createFormat(MemoryPool& pool, IMessageMetadata* params, bool addEof)
{
LocalStatus status;
unsigned count = params->getCount(&status);
status.check();
- Format* format = Format::newFormat(pool, count * 2);
+ Format* format = Format::newFormat(pool, count * 2 + (addEof ? 1 : 0));
unsigned runOffset = 0;
dsc* desc = format->fmt_desc.begin();
@@ -85,6 +85,13 @@
++desc;
}
+ if (addEof)
+ {
+ // Next item is aligned on USHORT, so as the previous one.
+ desc->makeShort(0, (SSHORT*)(IPTR) runOffset);
+ runOffset += sizeof(USHORT);
+ }
+
format->fmt_length = runOffset;
return format;
Modified: firebird/trunk/src/jrd/Routine.h
===================================================================
--- firebird/trunk/src/jrd/Routine.h 2013-03-27 01:34:10 UTC (rev 57839)
+++ firebird/trunk/src/jrd/Routine.h 2013-03-27 01:34:44 UTC (rev 57840)
@@ -62,7 +62,7 @@
public:
static Firebird::MsgMetadata* createMetadata(
const Firebird::Array<NestConst<Parameter> >& parameters);
- static Format* createFormat(MemoryPool& pool, Firebird::IMessageMetadata* params);
+ static Format* createFormat(MemoryPool& pool, Firebird::IMessageMetadata* params, bool addEof);
public:
USHORT getId() const
Modified: firebird/trunk/src/jrd/met.epp
===================================================================
--- firebird/trunk/src/jrd/met.epp 2013-03-27 01:34:10 UTC (rev 57839)
+++ firebird/trunk/src/jrd/met.epp 2013-03-27 01:34:44 UTC (rev 57840)
@@ -3062,45 +3062,64 @@
if (!external)
{
- MemoryPool* csb_pool = attachment->createPool();
+ if (!P.RDB$PROCEDURE_BLR.NULL)
+ {
+ MemoryPool* csb_pool = attachment->createPool();
- Jrd::ContextPoolHolder context(tdbb, csb_pool);
- CompilerScratch* csb = CompilerScratch::newCsb(*tdbb->getDefaultPool(), 5);
+ Jrd::ContextPoolHolder context(tdbb, csb_pool);
+ CompilerScratch* csb = CompilerScratch::newCsb(*tdbb->getDefaultPool(), 5);
- if (!P.RDB$DEBUG_INFO.NULL)
- DBG_parse_debug_info(tdbb, &P.RDB$DEBUG_INFO, *csb->csb_dbg_info);
+ if (!P.RDB$DEBUG_INFO.NULL)
+ DBG_parse_debug_info(tdbb, &P.RDB$DEBUG_INFO, *csb->csb_dbg_info);
- try
- {
- MET_parse_routine_blr(tdbb, procedure,
- (P.RDB$PROCEDURE_BLR.NULL ? NULL : &P.RDB$PROCEDURE_BLR), csb);
- }
- catch (const Exception&)
- {
- delete csb;
+ try
+ {
+ MET_parse_routine_blr(tdbb, procedure,
+ (P.RDB$PROCEDURE_BLR.NULL ? NULL : &P.RDB$PROCEDURE_BLR), csb);
+ }
+ catch (const Exception&)
+ {
+ delete csb;
- if (procedure->getStatement())
- procedure->releaseStatement(tdbb);
- else
- attachment->deletePool(csb_pool);
+ if (procedure->getStatement())
+ procedure->releaseStatement(tdbb);
+ else
+ attachment->deletePool(csb_pool);
- ERR_post(Arg::Gds(isc_bad_proc_BLR) << Arg::Str(procedure->getName().toString()));
- }
+ ERR_post(Arg::Gds(isc_bad_proc_BLR) << Arg::Str(procedure->getName().toString()));
+ }
- procedure->getStatement()->procedure = procedure;
- for (size_t i = 0; i < csb->csb_rpt.getCount(); i++)
- {
- MessageNode* node = csb->csb_rpt[i].csb_message;
+ procedure->getStatement()->procedure = procedure;
+ for (size_t i = 0; i < csb->csb_rpt.getCount(); i++)
+ {
+ MessageNode* node = csb->csb_rpt[i].csb_message;
- /***
- if (node)
- {
- if (node->messageNumber == 1)
- procedure->prc_output_msg = node;
+ /***
+ if (node)
+ {
+ if (node->messageNumber == 1)
+ procedure->prc_output_msg = node;
+ }
+ ***/
}
- ***/
+ delete csb;
}
- delete csb;
+ else
+ {
+ RefPtr<MsgMetadata> inputMetadata(
+ Routine::createMetadata(procedure->getInputFields()));
+ inputMetadata->release();
+ procedure->setInputFormat(
+ Routine::createFormat(procedure->getPool(), inputMetadata, false));
+
+ RefPtr<MsgMetadata> outputMetadata(
+ Routine::createMetadata(procedure->getOutputFields()));
+ outputMetadata->release();
+ procedure->setOutputFormat(
+ Routine::createFormat(procedure->getPool(), outputMetadata, true));
+
+ procedure->setImplemented(false);
+ }
}
if (P.RDB$VALID_BLR.NULL || P.RDB$VALID_BLR == FALSE)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|