You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
MCOL-4099 allow insert on first or last char
This commit is contained in:
@ -68,6 +68,7 @@ std::string Func_insert::getStrVal(rowgroup::Row& row,
|
||||
start = fp[1]->data()->getIntVal(row, isNull);
|
||||
if (isNull)
|
||||
return "";
|
||||
start--; // Because SQL syntax is 1 based and we want 0 based.
|
||||
|
||||
length = fp[2]->data()->getIntVal(row, isNull);
|
||||
if (isNull)
|
||||
@ -83,14 +84,12 @@ std::string Func_insert::getStrVal(rowgroup::Row& row,
|
||||
int64_t strLen = cs->numchars(pos, end);
|
||||
|
||||
// Return the original string if start isn't within the string.
|
||||
if ((start < 1) || start >= strLen)
|
||||
if ((start < 0) || start > strLen)
|
||||
return src;
|
||||
|
||||
if ((length < 0) || (length > strLen))
|
||||
length = strLen;
|
||||
|
||||
start--; // Because SQL syntax is 1 based and we want 0 based.
|
||||
|
||||
// Convert start and length from characters to bytes.
|
||||
start = cs->charpos(pos, end, start);
|
||||
length = cs->charpos(pos+start, end, length);
|
||||
|
Reference in New Issue
Block a user