diff options
author | Ting-Wei Lan <lantw44@gmail.com> | 2019-05-02 19:04:26 +0800 |
---|---|---|
committer | Ting-Wei Lan <tingwei.lan@cobinhood.com> | 2019-05-14 11:04:15 +0800 |
commit | 2a3c144a7872b33ecadb4448130f0df90828cac9 (patch) | |
tree | 5901f37c20d2cb02f9dceb6b8015a3dffba6aac3 /core/vm | |
parent | 49acaa8391cef7bd069b965d7de827cb0ba683b7 (diff) | |
download | dexon-2a3c144a7872b33ecadb4448130f0df90828cac9.tar dexon-2a3c144a7872b33ecadb4448130f0df90828cac9.tar.gz dexon-2a3c144a7872b33ecadb4448130f0df90828cac9.tar.bz2 dexon-2a3c144a7872b33ecadb4448130f0df90828cac9.tar.lz dexon-2a3c144a7872b33ecadb4448130f0df90828cac9.tar.xz dexon-2a3c144a7872b33ecadb4448130f0df90828cac9.tar.zst dexon-2a3c144a7872b33ecadb4448130f0df90828cac9.zip |
code backup 26
Diffstat (limited to 'core/vm')
-rw-r--r-- | core/vm/sqlvm/ast/ast.go | 8 | ||||
-rw-r--r-- | core/vm/sqlvm/checker/checker.go | 5 | ||||
-rw-r--r-- | core/vm/sqlvm/checker/utils.go | 2 |
3 files changed, 12 insertions, 3 deletions
diff --git a/core/vm/sqlvm/ast/ast.go b/core/vm/sqlvm/ast/ast.go index 5868549a8..9b0efd8f3 100644 --- a/core/vm/sqlvm/ast/ast.go +++ b/core/vm/sqlvm/ast/ast.go @@ -79,7 +79,11 @@ func safeIdentifierExtend(r rune) bool { func safeString(s []byte, quote byte, mustQuote bool) []byte { o := bytes.Buffer{} - o.Grow(len(s) + 1) + if mustQuote { + o.Grow(len(s) + 2) + } else { + o.Grow(len(s) + 1) + } o.WriteByte(quote) if len(s) > 0 { @@ -316,7 +320,7 @@ func (n *AddressValueNode) IsConstant() bool { return true } -// GetType returns the type of 'bool'. +// GetType returns the type of 'address'. func (n *AddressValueNode) GetType() DataType { return ComposeDataType(DataTypeMajorAddress, DataTypeMinorDontCare) } diff --git a/core/vm/sqlvm/checker/checker.go b/core/vm/sqlvm/checker/checker.go index 5dcfaa043..f18f9bc3f 100644 --- a/core/vm/sqlvm/checker/checker.go +++ b/core/vm/sqlvm/checker/checker.go @@ -304,6 +304,11 @@ func checkCreateTableStmt(n *ast.CreateTableStmtNode, s *schema.Schema, } column.Attr |= schema.ColumnAttrHasDefault + // We should not do type checking on an invalid type. + if !column.Type.Valid() { + break cs + } + value := cs.Value value = checkExpr(cs.Value, *s, o|CheckWithConstantOnly, c, el, 0, newTypeActionAssign(column.Type)) diff --git a/core/vm/sqlvm/checker/utils.go b/core/vm/sqlvm/checker/utils.go index 3ca49676f..60a3f7c86 100644 --- a/core/vm/sqlvm/checker/utils.go +++ b/core/vm/sqlvm/checker/utils.go @@ -15,7 +15,7 @@ import ( // td -> table descriptor // tr -> table reference // ti -> table index -// tn -< table name +// tn -> table name // // cd -> column descriptor // cr -> column reference |