@@ -3881,6 +3881,9 @@ ScanResult CharSetVers::scan(thread_db* tdbb, ObjectBase::Flag flags)
38813881 END_FOR
38823882 }
38833883
3884+ if (flags & CacheFlag::MINISCAN)
3885+ return ScanResult::REPEAT;
3886+
38843887 FOR(REQUEST_HANDLE handle2)
38853888 CS IN RDB$CHARACTER_SETS
38863889 CROSS COL IN RDB$COLLATIONS OVER RDB$CHARACTER_SET_ID
@@ -3927,34 +3930,49 @@ ScanResult CharSetVers::scan(thread_db* tdbb, ObjectBase::Flag flags)
39273930 }
39283931 }
39293932
3930- AutoPtr<texttype> tt = FB_NEW_POOL(perm->getPool()) texttype;
3931- memset(tt, 0, sizeof(texttype));
3932- INTL_lookup_texttype(tt, &info);
3933-
39343933 if (charset_collations.getCount() <= colId)
39353934 charset_collations.grow(colId + 1);
39363935
3937- fb_assert((tt->texttype_canonical_width == 0 && tt->texttype_fn_canonical == NULL) ||
3938- (tt->texttype_canonical_width != 0 && tt->texttype_fn_canonical != NULL));
3939-
3940- if (tt->texttype_canonical_width == 0)
3936+ try
39413937 {
3942- if (charset->isMultiByte())
3943- tt->texttype_canonical_width = sizeof(ULONG); // UTF-32
3944- else
3938+ AutoPtr<texttype> tt = FB_NEW_POOL(perm->getPool()) texttype;
3939+ memset(tt, 0, sizeof(texttype));
3940+ INTL_lookup_texttype(tt, &info);
3941+
3942+ fb_assert((tt->texttype_canonical_width == 0 && tt->texttype_fn_canonical == NULL) ||
3943+ (tt->texttype_canonical_width != 0 && tt->texttype_fn_canonical != NULL));
3944+
3945+ if (tt->texttype_canonical_width == 0)
39453946 {
3946- tt->texttype_canonical_width = charset->minBytesPerChar();
3947- // canonical is equal to string, then TEXTTYPE_DIRECT_MATCH can be turned on
3948- tt->texttype_flags |= TEXTTYPE_DIRECT_MATCH;
3947+ if (charset->isMultiByte())
3948+ tt->texttype_canonical_width = sizeof(ULONG); // UTF-32
3949+ else
3950+ {
3951+ tt->texttype_canonical_width = charset->minBytesPerChar();
3952+ // canonical is equal to string, then TEXTTYPE_DIRECT_MATCH can be turned on
3953+ tt->texttype_flags |= TEXTTYPE_DIRECT_MATCH;
3954+ }
39493955 }
3956+
3957+ Collation* collation = Collation::createInstance(perm->getPool(),
3958+ TTypeId(id, colId), tt, nullptr, info.attributes, charset);
3959+ collation->name = info.collationName;
3960+
3961+ tt.release();
3962+ charset_collations[colId] = collation;
39503963 }
3964+ catch (const Exception& ex)
3965+ {
3966+ AutoDispose<IStatus> error = MasterInterfacePtr()->getStatus();
3967+ ex.stuffException(error);
39513968
3952- Collation* collation = Collation::createInstance(perm->getPool(),
3953- TTypeId(id, colId), tt , info.attributes, charset);
3954- collation->name = info.collationName;
3969+ Collation* collation = Collation::createInstance(perm->getPool(),
3970+ TTypeId(id, colId), nullptr, error , info.attributes, charset);
3971+ collation->name = info.collationName;
39553972
3956- tt.release();
3957- charset_collations[colId] = collation;
3973+ error.release();
3974+ charset_collations[colId] = collation;
3975+ }
39583976 }
39593977 END_FOR
39603978
0 commit comments