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

Fixed CORE-4237 - FB3 vs FB2.5. Different metadata for UDF return argument.

This commit is contained in:
asfernandes 2013-10-03 15:38:58 +00:00
parent b86b3e0380
commit 56c2a5fc66
2 changed files with 6 additions and 4 deletions

View File

@ -1487,6 +1487,7 @@ bool CreateAlterFunctionNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch*
Attachment* const attachment = transaction->getAttachment(); Attachment* const attachment = transaction->getAttachment();
bool modified = false; bool modified = false;
unsigned returnPos = 0;
AutoCacheRequest requestHandle(tdbb, drq_m_funcs2, DYN_REQUESTS); AutoCacheRequest requestHandle(tdbb, drq_m_funcs2, DYN_REQUESTS);
@ -1553,8 +1554,8 @@ bool CreateAlterFunctionNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch*
if (field->dtype == dtype_blob) if (field->dtype == dtype_blob)
{ {
const size_t blobPosition = parameters.getCount() + 1; returnPos = unsigned(parameters.getCount()) + 1;
if (blobPosition > MAX_UDF_ARGUMENTS) if (returnPos > MAX_UDF_ARGUMENTS)
{ {
// External functions can not have more than 10 parameters // External functions can not have more than 10 parameters
// Or 9 if the function returns a BLOB. // Or 9 if the function returns a BLOB.
@ -1564,7 +1565,7 @@ bool CreateAlterFunctionNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch*
Arg::Gds(isc_extern_func_err)); Arg::Gds(isc_extern_func_err));
} }
FUN.RDB$RETURN_ARGUMENT = (SSHORT) blobPosition; FUN.RDB$RETURN_ARGUMENT = (SSHORT) returnPos;
} }
else else
FUN.RDB$RETURN_ARGUMENT = 0; FUN.RDB$RETURN_ARGUMENT = 0;
@ -1665,7 +1666,7 @@ bool CreateAlterFunctionNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch*
// and insert the new ones // and insert the new ones
if (returnType && returnType->type) if (returnType && returnType->type)
storeArgument(tdbb, dsqlScratch, transaction, 0, returnType, NULL); storeArgument(tdbb, dsqlScratch, transaction, returnPos, returnType, NULL);
for (size_t i = 0; i < parameters.getCount(); ++i) for (size_t i = 0; i < parameters.getCount(); ++i)
{ {

View File

@ -1096,6 +1096,7 @@ udf_data_type
{ {
$$ = newNode<dsql_fld>(); $$ = newNode<dsql_fld>();
$$->dtype = dtype_blob; $$->dtype = dtype_blob;
$$->length = sizeof(bid);
} }
| CSTRING '(' pos_short_integer ')' charset_clause | CSTRING '(' pos_short_integer ')' charset_clause
{ {