aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMeng-Ying Yang <garfield@dexon.org>2019-05-09 09:32:43 +0800
committerMeng-Ying Yang <garfield@dexon.org>2019-05-09 09:32:43 +0800
commit49511b72aa5e8bca65f11c240356707b3450de75 (patch)
tree614248595373015f919fcb5a0a1f5150d06ebfaa
parente204570b758e5348aed14f37b7f2886d2686def1 (diff)
downloaddexon-49511b72aa5e8bca65f11c240356707b3450de75.tar
dexon-49511b72aa5e8bca65f11c240356707b3450de75.tar.gz
dexon-49511b72aa5e8bca65f11c240356707b3450de75.tar.bz2
dexon-49511b72aa5e8bca65f11c240356707b3450de75.tar.lz
dexon-49511b72aa5e8bca65f11c240356707b3450de75.tar.xz
dexon-49511b72aa5e8bca65f11c240356707b3450de75.tar.zst
dexon-49511b72aa5e8bca65f11c240356707b3450de75.zip
fixup! core: vm: sqlvm: add built-in function BITAND()
-rw-r--r--core/vm/sqlvm/runtime/functions.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/core/vm/sqlvm/runtime/functions.go b/core/vm/sqlvm/runtime/functions.go
index 3c8b51eba..a885c92b8 100644
--- a/core/vm/sqlvm/runtime/functions.go
+++ b/core/vm/sqlvm/runtime/functions.go
@@ -251,9 +251,9 @@ func (r *Raw) toBytes(dType ast.DataType) []byte {
case ast.DataTypeMajorUint,
ast.DataTypeMajorInt,
ast.DataTypeMajorFixed:
- bytes, err := ast.DecimalEncode(dType, r.Value)
- if err != nil {
- panic(err)
+ bytes, ok := ast.DecimalEncode(dType, r.Value)
+ if !ok {
+ panic(fmt.Sprintf("DecimalDecode does not handle %v", dType))
}
return bytes
default:
@@ -271,10 +271,10 @@ func (r *Raw) fromBytes(bytes []byte, dType ast.DataType) {
case ast.DataTypeMajorUint,
ast.DataTypeMajorInt,
ast.DataTypeMajorFixed:
- var err error
- r.Value, err = ast.DecimalDecode(dType, bytes)
- if err != nil {
- panic(err)
+ var ok bool
+ r.Value, ok = ast.DecimalDecode(dType, bytes)
+ if !ok {
+ panic(fmt.Sprintf("DecimalDecode does not handle %v", dType))
}
default:
panic(fmt.Errorf("unrecognized data type: %v", dType))