You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-01 06:46:55 +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);
|
start = fp[1]->data()->getIntVal(row, isNull);
|
||||||
if (isNull)
|
if (isNull)
|
||||||
return "";
|
return "";
|
||||||
|
start--; // Because SQL syntax is 1 based and we want 0 based.
|
||||||
|
|
||||||
length = fp[2]->data()->getIntVal(row, isNull);
|
length = fp[2]->data()->getIntVal(row, isNull);
|
||||||
if (isNull)
|
if (isNull)
|
||||||
@ -83,14 +84,12 @@ std::string Func_insert::getStrVal(rowgroup::Row& row,
|
|||||||
int64_t strLen = cs->numchars(pos, end);
|
int64_t strLen = cs->numchars(pos, end);
|
||||||
|
|
||||||
// Return the original string if start isn't within the string.
|
// Return the original string if start isn't within the string.
|
||||||
if ((start < 1) || start >= strLen)
|
if ((start < 0) || start > strLen)
|
||||||
return src;
|
return src;
|
||||||
|
|
||||||
if ((length < 0) || (length > strLen))
|
if ((length < 0) || (length > strLen))
|
||||||
length = strLen;
|
length = strLen;
|
||||||
|
|
||||||
start--; // Because SQL syntax is 1 based and we want 0 based.
|
|
||||||
|
|
||||||
// Convert start and length from characters to bytes.
|
// Convert start and length from characters to bytes.
|
||||||
start = cs->charpos(pos, end, start);
|
start = cs->charpos(pos, end, start);
|
||||||
length = cs->charpos(pos+start, end, length);
|
length = cs->charpos(pos+start, end, length);
|
||||||
|
Reference in New Issue
Block a user