Skip to content

Commit

Permalink
Fix #7045 - International characters in table or alias names causes q…
Browse files Browse the repository at this point in the history
…ueries of MON$STATEMENTS to fail.
  • Loading branch information
asfernandes committed Nov 15, 2021
1 parent 301768f commit 3e48814
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
3 changes: 2 additions & 1 deletion src/dsql/dsql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2196,7 +2196,8 @@ static void sql_info(thread_db* tdbb,
case isc_info_sql_explain_plan:
{
const bool detailed = (item == isc_info_sql_explain_plan);
string plan = OPT_get_plan(tdbb, request->req_request, detailed);
string plan = tdbb->getAttachment()->stringToUserCharSet(tdbb,
OPT_get_plan(tdbb, request->req_request, detailed));

if (plan.hasData())
{
Expand Down
19 changes: 1 addition & 18 deletions src/jrd/recsrc/RecordSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,7 @@ using namespace Jrd;

string RecordSource::printName(thread_db* tdbb, const string& name, bool quote)
{
const UCHAR* namePtr = (const UCHAR*) name.c_str();
ULONG nameLength = (ULONG) name.length();

MoveBuffer nameBuffer;

const CHARSET_ID charset = tdbb->getCharSet();
if (charset != CS_METADATA && charset != CS_NONE)
{
const ULONG bufferLength = INTL_convert_bytes(tdbb, charset, NULL, 0,
CS_METADATA, namePtr, nameLength, ERR_post);
nameBuffer.getBuffer(bufferLength);
nameLength = INTL_convert_bytes(tdbb, charset, nameBuffer.begin(), bufferLength,
CS_METADATA, namePtr, nameLength, ERR_post);

namePtr = nameBuffer.begin();
}

const string result(namePtr, nameLength);
const string result(name.c_str(), name.length());
return quote ? "\"" + result + "\"" : result;
}

Expand Down

0 comments on commit 3e48814

Please sign in to comment.