Skip to content

Array: Wrong work with VARCHAR elements [CORE1588] #2008

Open
@firebird-automations

Description

@firebird-automations

Submitted by: @ibprovider

Votes: 1

All know servers (FB / IB) incorrect work with VARCHAR arrays - they always do not use first two bytes with length of string.

The problem exists in sdl.cpp - static const UCHAR* sdl_desc(const UCHAR* ptr, DSC* desc):
blr_varying and blr_varying2 convert to incorrect dtype_cstring

-------- [code from FB2.1 sources]
case blr_varying2:
desc->dsc_dtype = dtype_cstring;
INTL_ASSIGN_TTYPE(desc, get_word(sdl));
desc->dsc_length = sizeof(USHORT);
break;

case blr\_varying:
	desc\-\>dsc\_dtype = dtype\_cstring;
	INTL\_ASSIGN\_TTYPE\(desc, ttype\_dynamic\);
	desc\-\>dsc\_length = sizeof\(USHORT\);
	desc\-\>dsc\_flags \|= DSC\_no\_subtype;
	break;

--------

I think, correction of this bug will be include
- new ODS
- some changes in gbak

Connection component can detect the new ODS and use true algorithms for VARCHAR arrays.

For old ODS - current cstring-algorithm