Skip to content

Commit 8efa96b

Browse files
committed
Fix for #8249
1 parent e4efbdb commit 8efa96b

File tree

2 files changed

+14
-23
lines changed

2 files changed

+14
-23
lines changed

src/dsql/ExprNodes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3559,7 +3559,7 @@ ValueExprNode* CastNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
35593559
node->dsqlField = dsqlField;
35603560
node->format = format;
35613561

3562-
DDL_resolve_intl_type(dsqlScratch, node->dsqlField, NULL);
3562+
DDL_resolve_intl_type(dsqlScratch, node->dsqlField, node->dsqlField->collate);
35633563
node->setParameterType(dsqlScratch, NULL, false);
35643564

35653565
DsqlDescMaker::fromField(&node->castDesc, node->dsqlField);

src/isql/isql.epp

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,7 @@ static void readNextInputLine(const char* prompt)
11101110
#endif
11111111
{
11121112
if (fgets(buffer, sizeof(buffer), Filelist->Ifp().indev_fpointer) != NULL)
1113-
lineSize = strlen(buffer);
1113+
lineSize = static_cast<int>(strlen(buffer));
11141114
else
11151115
lineSize = -1;
11161116
}
@@ -6677,7 +6677,7 @@ static bool printUser(const char* dbName)
66776677
if (wasOut)
66786678
isqlGlob.printf("Database: %s", dbName);
66796679

6680-
for (unsigned i = 0; i < FB_NELEM(fieldInfo); ++i)
6680+
for (int i = 0; i < FB_NELEM(fieldInfo); ++i)
66816681
{
66826682
IsqlVar v;
66836683
if (ISQL_fill_var(&v, m, i, buf) == ps_ERR)
@@ -9597,33 +9597,24 @@ static const char* charset_to_string(unsigned charset)
95979597
**************************************/
95989598
static Firebird::GlobalPtr<Firebird::GenericMap<Firebird::Pair<Firebird::Right<unsigned, string> > > > csMap;
95999599

9600-
charset = TTYPE_TO_CHARSET(charset);
9601-
96029600
string* text = csMap->get(charset);
96039601
if (text)
96049602
return text->c_str();
96059603

9606-
csMap->clear();
9607-
bool err = false;
9608-
96099604
if (!frontendTransaction())
96109605
return UNKNOWN;
96119606

9607+
// There is no way to change charset or collation name so let's assume that this mapping is stable during isql instantiation
96129608
FOR CS IN RDB$CHARACTER_SETS
9613-
if (!err)
9614-
{
9615-
try
9616-
{
9617-
fb_utils::exact_name(CS.RDB$CHARACTER_SET_NAME);
9618-
csMap->put(CS.RDB$CHARACTER_SET_ID, CS.RDB$CHARACTER_SET_NAME);
9619-
}
9620-
catch (const Firebird::Exception& ex)
9621-
{
9622-
err = true;
9623-
ex.stuffException(fbStatus);
9624-
ISQL_errmsg(fbStatus);
9625-
}
9626-
}
9609+
CROSS COLL IN RDB$COLLATIONS OVER RDB$CHARACTER_SET_ID
9610+
WITH CS.RDB$CHARACTER_SET_ID EQ TTYPE_TO_CHARSET(charset)
9611+
AND COLL.RDB$COLLATION_ID EQ TTYPE_TO_COLLATION(charset)
9612+
{
9613+
fb_utils::exact_name(CS.RDB$CHARACTER_SET_NAME);
9614+
fb_utils::exact_name(COLL.RDB$COLLATION_NAME);
9615+
9616+
csMap->put(charset, string(CS.RDB$CHARACTER_SET_NAME) + ',' + COLL.RDB$COLLATION_NAME);
9617+
}
96279618
END_FOR
96289619
ON_ERROR
96299620
ISQL_errmsg(fbStatus);
@@ -9790,7 +9781,7 @@ void PerTableStats::printStats(Firebird::IAttachment* att)
97909781
}
97919782
}
97929783

9793-
for (unsigned i = 0; i < FB_NELEM(m_items) - 1; i++)
9784+
for (int i = 0; i < FB_NELEM(m_items) - 1; i++)
97949785
{
97959786
if (m_items[i] == item.statId)
97969787
{

0 commit comments

Comments
 (0)