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

Optimization for the large number of columns, basically mirroring the one inside var_info() (backport).

This commit is contained in:
dimitr 2009-10-12 06:46:32 +00:00
parent 1493cf5c27
commit 7c5117ce10

View File

@ -2293,21 +2293,27 @@ static void map_in_out( dsql_req* request,
**/
static USHORT parse_blr(USHORT blr_length,
const UCHAR* blr, const USHORT msg_length, dsql_par* parameters)
const UCHAR* blr, const USHORT msg_length, dsql_par* parameters_list)
{
Firebird::HalfStaticArray<dsql_par*, 16> parameters;
for (dsql_par* param = parameters_list; param; param = param->par_next)
{
if (param->par_index)
{
if (param->par_index > parameters.getCount())
parameters.grow(param->par_index);
fb_assert(!parameters[param->par_index - 1]);
parameters[param->par_index - 1] = param;
}
}
// If there's no blr length, then the format of the current message buffer
// is identical to the format of the previous one.
if (!blr_length)
{
USHORT par_count = 0;
for (const dsql_par* parameter = parameters; parameter; parameter = parameter->par_next)
{
if (parameter->par_index) {
++par_count;
}
}
return par_count;
return parameters.getCount();
}
if (*blr != blr_version4 && *blr != blr_version5)
@ -2453,10 +2459,9 @@ static USHORT parse_blr(USHORT blr_length,
USHORT null_offset = offset;
offset += sizeof(SSHORT);
for (dsql_par* parameter = parameters; parameter; parameter = parameter->par_next)
{
if (parameter->par_index == index)
{
dsql_par* const parameter = parameters[index - 1];
fb_assert(parameter);
parameter->par_user_desc = desc;
// ASF: Older than 2.5 engine hasn't validating strings in DSQL. After this has been
@ -2477,8 +2482,6 @@ static USHORT parse_blr(USHORT blr_length,
null->par_user_desc.dsc_address = (UCHAR*)(IPTR) null_offset;
}
}
}
}
if (*blr++ != (UCHAR) blr_end || offset != msg_length)
{