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

Method aux

src/jrd/Collation.cpp:690–815  ·  view source on GitHub ↗

Evaluate the "sleuth" search operator.

Source from the content-addressed store, hash-verified

688private:
689 // Evaluate the "sleuth" search operator.
690 static bool aux(Jrd::TextType* obj, USHORT flags,
691 const CharType* search, const CharType* end_search,
692 const CharType* match, const CharType* end_match)
693 {
694 fb_assert(search != NULL);
695 fb_assert(end_search != NULL);
696 fb_assert(match != NULL);
697 fb_assert(end_match != NULL);
698 fb_assert(search <= end_search);
699 fb_assert(match <= end_match);
700 fb_assert(obj->getCanonicalWidth() == sizeof(CharType));
701
702 while (match < end_match)
703 {
704 CharType c = *match++;
705 if ((c == *(CharType*) obj->getCanonicalChar(CHAR_GDML_QUOTE) && (c = *match++)) ||
706 (size_t(c) < FB_NELEM(SLEUTH_SPECIAL) && !SLEUTH_SPECIAL[c]))
707 {
708 if (match >= end_match || *match != *(CharType*) obj->getCanonicalChar(CHAR_GDML_MATCH_ANY))
709 {
710 if (search >= end_search)
711 return false;
712 const CharType d = *search++;
713 if (c != d)
714 return false;
715 }
716 else
717 {
718 ++match;
719 for (;;)
720 {
721 if (aux(obj, flags, search, end_search, match, end_match))
722 return true;
723
724 if (search < end_search)
725 {
726 const CharType d = *search++;
727 if (c != d)
728 return false;
729 }
730 else
731 return false;
732 }
733 }
734 }
735 else if (c == *(CharType*) obj->getCanonicalChar(CHAR_GDML_MATCH_ONE))
736 {
737 if (match >= end_match || *match != *(CharType*) obj->getCanonicalChar(CHAR_GDML_MATCH_ANY))
738 {
739 if (search >= end_search)
740 return false;
741
742 search++;
743 }
744 else
745 {
746 if (++match >= end_match)
747 return true;

Callers

nothing calls this directly

Calls 2

getCanonicalWidthMethod · 0.80
getCanonicalCharMethod · 0.80

Tested by

no test coverage detected