Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/common/CvtFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,18 @@ namespace

const Format::Patterns pattern = mapFormatStrToFormatPattern(patternStr);
if (pattern == Format::NONE)
invalidPatternException(patternStr, cb);
{
// An invalid `patternStr` may be incomplete, so just parse it from the beginning up to the separator.
// Since patterns can be combined without separators, we can print multiple patterns, but it's fine.
const FB_SIZE_T patternBeginPos = i - patternStr.length();
for (; i < formatLength; i++)
{
if (isSeparator(formatUpper[i]))
break;
}
std::string_view errorPattern(formatUpper.data() + patternBeginPos, i - patternBeginPos);
invalidPatternException(errorPattern, cb);
}
if (outFormatPatterns & pattern)
cb->err(Arg::Gds(isc_can_not_use_same_pattern_twice) << patternStr);
if (!patternIsCompatibleWithDscType(desc, pattern))
Expand Down
Loading