diff options
author | Ting-Wei Lan <tingwei.lan@cobinhood.com> | 2019-03-27 16:02:48 +0800 |
---|---|---|
committer | lantw44 <lantw44@gmail.com> | 2019-03-29 18:40:42 +0800 |
commit | 7ebf5e8b149f4f5610719c8bf784b1ed37bfb225 (patch) | |
tree | d11446e9d8f585fc5030ea70ff3e88e93cd9c394 /core/vm/sqlvm/ast/types.go | |
parent | 51acffafc2e45b2d1061c40f0f9b11e3153fcc4a (diff) | |
download | dexon-7ebf5e8b149f4f5610719c8bf784b1ed37bfb225.tar dexon-7ebf5e8b149f4f5610719c8bf784b1ed37bfb225.tar.gz dexon-7ebf5e8b149f4f5610719c8bf784b1ed37bfb225.tar.bz2 dexon-7ebf5e8b149f4f5610719c8bf784b1ed37bfb225.tar.lz dexon-7ebf5e8b149f4f5610719c8bf784b1ed37bfb225.tar.xz dexon-7ebf5e8b149f4f5610719c8bf784b1ed37bfb225.tar.zst dexon-7ebf5e8b149f4f5610719c8bf784b1ed37bfb225.zip |
core: vm: sqlvm: ast: rename DataTypeUnknown to DataTypePending
SQL uses three-valued logic which includes an unknown state. To prevent
the reader of the code from confusing the unknown value with the unknown
data type defined here, we rename 'unknown' data type to 'pending'
because it is intended to be used by nodes whose type has not been
determined.
Diffstat (limited to 'core/vm/sqlvm/ast/types.go')
-rw-r--r-- | core/vm/sqlvm/ast/types.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/core/vm/sqlvm/ast/types.go b/core/vm/sqlvm/ast/types.go index 41c35ac78..9d7efc430 100644 --- a/core/vm/sqlvm/ast/types.go +++ b/core/vm/sqlvm/ast/types.go @@ -2,6 +2,7 @@ package ast import ( "fmt" + "math" "math/big" "github.com/shopspring/decimal" @@ -27,7 +28,7 @@ type DataType uint16 // DataTypeMajor enums. const ( - DataTypeMajorUnknown DataTypeMajor = iota + DataTypeMajorPending DataTypeMajor = iota DataTypeMajorSpecial DataTypeMajorBool DataTypeMajorAddress @@ -47,8 +48,11 @@ const ( DataTypeMinorSpecialDefault DataTypeMinor = 0x02 ) -// DataTypeUnknown for unknown data type. -const DataTypeUnknown DataType = 0 +// Special data types which are commonly used. +const ( + DataTypePending DataType = (DataType(DataTypeMajorPending) << 8) | DataType(DataTypeMinorDontCare) + DataTypeBad DataType = math.MaxUint16 +) // DecomposeDataType to major and minor part with given data type. func DecomposeDataType(t DataType) (DataTypeMajor, DataTypeMinor) { |