aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMeng-Ying Yang <garfield@dexon.org>2019-05-08 17:08:17 +0800
committerMeng-Ying Yang <garfield@dexon.org>2019-05-09 09:29:30 +0800
commite204570b758e5348aed14f37b7f2886d2686def1 (patch)
treeee6941b99a0ee14ce50e17b52a081c41448873e9
parent6e5507c499d14c08da612c4d18047954a85cb84c (diff)
downloaddexon-e204570b758e5348aed14f37b7f2886d2686def1.tar.gz
dexon-e204570b758e5348aed14f37b7f2886d2686def1.tar.zst
dexon-e204570b758e5348aed14f37b7f2886d2686def1.zip
fixup! core: vm: sqlvm: add built-in function SUBSTRING()
-rw-r--r--core/vm/sqlvm/runtime/functions.go8
1 files changed, 1 insertions, 7 deletions
diff --git a/core/vm/sqlvm/runtime/functions.go b/core/vm/sqlvm/runtime/functions.go
index 45d6cec65..3c8b51eba 100644
--- a/core/vm/sqlvm/runtime/functions.go
+++ b/core/vm/sqlvm/runtime/functions.go
@@ -448,12 +448,6 @@ func fnSubString(ctx *common.Context, ops []*Operand, length uint64) (result *Op
return
}
- if len(ops[0].Data) != len(ops[1].Data) ||
- len(ops[0].Data) != len(ops[2].Data) {
- err = se.ErrorCodeIndexOutOfRange
- return
- }
-
op := ops[0]
if !metaAllDynBytes(op) {
@@ -473,7 +467,7 @@ func fnSubString(ctx *common.Context, ops []*Operand, length uint64) (result *Op
starts, ends := ops[1], ops[2]
var start, end uint64
- for i := 0; i < len(op.Data); i++ {
+ for i := uint64(0); i < length; i++ {
result.Data[i] = make(Tuple, len(op.Data[i]))
if starts.IsImmediate {