MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / setupCollationAttributes

Method setupCollationAttributes

src/jrd/IntlManager.cpp:703–765  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

701
702
703bool IntlManager::setupCollationAttributes(
704 const string& collationName, const string& charSetName,
705 const string& specificAttributes, string& newSpecificAttributes)
706{
707 ExternalInfo charSetExternalInfo;
708 ExternalInfo collationExternalInfo;
709
710 newSpecificAttributes = specificAttributes;
711
712 if (charSetCollations->get(charSetName + ":" + charSetName, charSetExternalInfo) &&
713 charSetCollations->get(charSetName + ":" + collationName, collationExternalInfo))
714 {
715 pfn_INTL_setup_attributes attributesFunction = NULL;
716
717 if (collationExternalInfo.moduleName.isEmpty())
718 attributesFunction = INTL_builtin_setup_attributes;
719 else
720 {
721 ModuleLoader::Module* module;
722
723 if (modules->get(collationExternalInfo.moduleName, module) && module)
724 module->findSymbol(NULL, STRINGIZE(INTL_SETUP_ATTRIBUTES_ENTRYPOINT), attributesFunction);
725 }
726
727 if (attributesFunction)
728 {
729 HalfStaticArray<UCHAR, BUFFER_MEDIUM> buffer;
730
731 // first try with the static buffer
732 ULONG len = (*attributesFunction)(collationExternalInfo.name.c_str(),
733 charSetExternalInfo.name.c_str(), collationExternalInfo.configInfo.c_str(),
734 specificAttributes.length(), (const UCHAR*) specificAttributes.begin(),
735 buffer.getCapacity(), buffer.begin());
736
737 if (len == INTL_BAD_STR_LENGTH)
738 {
739 // ask the right buffer size
740 len = (*attributesFunction)(collationExternalInfo.name.c_str(),
741 charSetExternalInfo.name.c_str(), collationExternalInfo.configInfo.c_str(),
742 specificAttributes.length(), (const UCHAR*) specificAttributes.begin(),
743 0, NULL);
744
745 if (len != INTL_BAD_STR_LENGTH)
746 {
747 // try again
748 len = (*attributesFunction)(collationExternalInfo.name.c_str(),
749 charSetExternalInfo.name.c_str(), collationExternalInfo.configInfo.c_str(),
750 specificAttributes.length(), (const UCHAR*) specificAttributes.begin(),
751 len, buffer.getBuffer(len));
752 }
753 }
754
755 if (len != INTL_BAD_STR_LENGTH)
756 newSpecificAttributes.assign((const char*) buffer.begin(), len);
757 else
758 return false;
759 }
760

Callers

nothing calls this directly

Calls 9

getMethod · 0.45
isEmptyMethod · 0.45
findSymbolMethod · 0.45
c_strMethod · 0.45
lengthMethod · 0.45
beginMethod · 0.45
getCapacityMethod · 0.45
getBufferMethod · 0.45
assignMethod · 0.45

Tested by

no test coverage detected