diff options
author | Meng-Ying Yang <garfield@dexon.org> | 2019-05-08 17:08:17 +0800 |
---|---|---|
committer | Meng-Ying Yang <garfield@dexon.org> | 2019-05-09 09:29:30 +0800 |
commit | e204570b758e5348aed14f37b7f2886d2686def1 (patch) | |
tree | ee6941b99a0ee14ce50e17b52a081c41448873e9 | |
parent | 6e5507c499d14c08da612c4d18047954a85cb84c (diff) | |
download | dexon-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.go | 8 |
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 { |