mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 04:43:03 +01:00
Fixed bug CORE-5847 : "Malformed string" instead of key value in PK violation error message
This commit is contained in:
parent
e5dc6ef8e8
commit
b9da7ba014
@ -504,9 +504,9 @@ DescPrinter::DescPrinter(thread_db* tdbb, const dsc* desc, int mLen)
|
|||||||
|
|
||||||
fb_assert(!desc->isBlob());
|
fb_assert(!desc->isBlob());
|
||||||
|
|
||||||
value = MOV_make_string2(tdbb, desc, ttype_dynamic);
|
const bool octets = (desc->isText() && desc->getTextType() == ttype_binary);
|
||||||
|
value = MOV_make_string2(tdbb, desc, octets ? ttype_binary : ttype_dynamic);
|
||||||
|
|
||||||
const int len = (int) value.length();
|
|
||||||
const char* const str = value.c_str();
|
const char* const str = value.c_str();
|
||||||
|
|
||||||
if (desc->isText() || desc->isDateTime())
|
if (desc->isText() || desc->isDateTime())
|
||||||
@ -517,9 +517,15 @@ DescPrinter::DescPrinter(thread_db* tdbb, const dsc* desc, int mLen)
|
|||||||
value.rtrim(pad);
|
value.rtrim(pad);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desc->isText() && desc->getTextType() == ttype_binary)
|
if (octets)
|
||||||
{
|
{
|
||||||
Firebird::string hex;
|
Firebird::string hex;
|
||||||
|
|
||||||
|
int len = (int) value.length();
|
||||||
|
const bool cut = (len > (maxLen - 3) / 2);
|
||||||
|
if (cut)
|
||||||
|
len = (maxLen - 5) / 2;
|
||||||
|
|
||||||
char* s = hex.getBuffer(2 * len);
|
char* s = hex.getBuffer(2 * len);
|
||||||
|
|
||||||
for (int i = 0; i < len; i++)
|
for (int i = 0; i < len; i++)
|
||||||
@ -527,14 +533,13 @@ DescPrinter::DescPrinter(thread_db* tdbb, const dsc* desc, int mLen)
|
|||||||
sprintf(s, "%02X", (int)(unsigned char) str[i]);
|
sprintf(s, "%02X", (int)(unsigned char) str[i]);
|
||||||
s += 2;
|
s += 2;
|
||||||
}
|
}
|
||||||
|
value = "x'" + hex + (cut ? "..." : "'");
|
||||||
value = "x'" + hex + "'";
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
value = "'" + value + "'";
|
value = "'" + value + "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value.length() > maxLen)
|
if (value.length() > (FB_SIZE_T) maxLen)
|
||||||
{
|
{
|
||||||
fb_assert(desc->isText());
|
fb_assert(desc->isText());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user