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;
Hmm, I do not see how is it related with ODS. On disk varchars are stored in vary format: 2 bytes length, after it string itself. It's sdl descriptor (tmp object) which contains dtype_cstring instead dtype_varying. Before touching this legacy code I wonder - what real problem does it cause to you, and certainly a kind of test to reproduce is highly desired.
I offer append to new version of protocol (FB4?) the two new API functions - xxxx_put_slice2 and xxxx_get_slice2 with correct processing of VARYING arrays.
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;
--------
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
The text was updated successfully, but these errors were encountered: