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

Fix #7167 - Incorrect transliteration of field names in constraint violation errors.

This commit is contained in:
Adriano dos Santos Fernandes 2022-04-07 14:33:23 -03:00
parent 0671b38fa7
commit fbb39ebed9
4 changed files with 9 additions and 9 deletions

View File

@ -6145,7 +6145,7 @@ string print_key(thread_db* tdbb, jrd_rel* relation, index_desc* idx, Record* re
{
bool notNull = false;
const dsc* const desc = BTR_eval_expression(tdbb, idx, record, notNull);
value = DescPrinter(tdbb, notNull ? desc : NULL, MAX_KEY_STRING_LEN).get();
value = DescPrinter(tdbb, notNull ? desc : NULL, MAX_KEY_STRING_LEN, CS_METADATA).get();
key += "<expression> = " + value;
}
else
@ -6164,7 +6164,7 @@ string print_key(thread_db* tdbb, jrd_rel* relation, index_desc* idx, Record* re
dsc desc;
const bool notNull = EVL_field(relation, record, field_id, &desc);
value = DescPrinter(tdbb, notNull ? &desc : NULL, MAX_KEY_STRING_LEN).get();
value = DescPrinter(tdbb, notNull ? &desc : NULL, MAX_KEY_STRING_LEN, CS_METADATA).get();
key += " = " + value;
if (i < idx->idx_count - 1)

View File

@ -407,7 +407,7 @@ ISC_STATUS filter_format(USHORT action, BlobControl* control)
d = desc;
d.dsc_address = pBuff;
DescPrinter val(JRD_get_thread_data(), &d, 32);
DescPrinter val(JRD_get_thread_data(), &d, 32, CS_dynamic);
str.printf(fmt2,
fieldId,

View File

@ -488,7 +488,7 @@ Int128 MOV_get_int128(Jrd::thread_db* tdbb, const dsc* desc, SSHORT scale)
namespace Jrd
{
DescPrinter::DescPrinter(thread_db* tdbb, const dsc* desc, FB_SIZE_T mLen)
DescPrinter::DescPrinter(thread_db* tdbb, const dsc* desc, FB_SIZE_T mLen, USHORT charSetId)
: maxLen(mLen)
{
const char* const NULL_KEY_STRING = "NULL";
@ -501,8 +501,8 @@ DescPrinter::DescPrinter(thread_db* tdbb, const dsc* desc, FB_SIZE_T mLen)
fb_assert(!desc->isBlob());
const bool isBinary = (desc->isText() && desc->getTextType() == ttype_binary);
value = MOV_make_string2(tdbb, desc, isBinary ? ttype_binary : ttype_dynamic);
const bool isBinary = (desc->isText() && desc->getCharSet() == CS_BINARY);
value = MOV_make_string2(tdbb, desc, isBinary ? CS_BINARY : charSetId);
const char* const str = value.c_str();
@ -510,7 +510,7 @@ DescPrinter::DescPrinter(thread_db* tdbb, const dsc* desc, FB_SIZE_T mLen)
{
if (desc->dsc_dtype == dtype_text)
{
const char* const pad = (desc->dsc_sub_type == ttype_binary) ? "\0" : " ";
const char* const pad = (desc->getCharSet() == CS_BINARY) ? "\0" : " ";
value.rtrim(pad);
}
@ -542,7 +542,7 @@ DescPrinter::DescPrinter(thread_db* tdbb, const dsc* desc, FB_SIZE_T mLen)
value.resize(maxLen);
const CharSet* const cs = INTL_charset_lookup(tdbb, desc->getCharSet());
const CharSet* const cs = INTL_charset_lookup(tdbb, charSetId);
while (value.hasData() && !cs->wellFormed(value.length(), (const UCHAR*) value.c_str()))
value.resize(value.length() - 1);

View File

@ -62,7 +62,7 @@ namespace Jrd
class DescPrinter
{
public:
DescPrinter(thread_db* tdbb, const dsc* desc, FB_SIZE_T mLen);
DescPrinter(thread_db* tdbb, const dsc* desc, FB_SIZE_T mLen, USHORT charSetId);
const Firebird::string& get() const
{