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

Backported CORE-3730: isc_dsql_exec_immed2() loses input parameter value with RETURNING clause.

This commit is contained in:
dimitr 2012-01-23 18:17:30 +00:00
parent 4ab0fafa51
commit 04401c286c

View File

@ -1739,7 +1739,8 @@ static bool_t xdr_sql_blr(
if (!(message != 0) ||
statement->rsr_format->fmt_length > statement->rsr_fmt_length)
{
REMOTE_release_messages(message);
const REM_MSG org_message = message;
const USHORT org_length = message ? statement->rsr_fmt_length : 0;
statement->rsr_fmt_length = statement->rsr_format->fmt_length;
statement->rsr_buffer = message =
(REM_MSG) ALLR_block(type_msg, statement->rsr_fmt_length);
@ -1748,6 +1749,14 @@ static bool_t xdr_sql_blr(
#ifdef SCROLLABLE_CURSORS
message->msg_prior = message;
#endif
if (org_length)
{
// dimitr: the original buffer might have something useful inside
// (filled by a prior xdr_sql_message() call, for example),
// so its contents must be preserved (see CORE-3730)
memcpy(message->msg_buffer, org_message->msg_buffer, org_length);
}
REMOTE_release_messages(org_message);
}
return TRUE;