@@ -10,7 +10,7 @@ import (
1010 "github.com/gitql/gitql/sql/expression"
1111 "github.com/gitql/gitql/sql/plan"
1212
13- "github.com/youtube /vitess/go/vt/sqlparser"
13+ "github.com/gitql /vitess/go/vt/sqlparser"
1414)
1515
1616const (
@@ -317,17 +317,23 @@ func valExprToExpression(ve sqlparser.ValExpr) (sql.Expression, error) {
317317 switch v := ve .(type ) {
318318 default :
319319 return nil , errUnsupported (v )
320- case sqlparser.StrVal :
321- return expression .NewLiteral (string (v ), sql .String ), nil
322- //TODO: case sqlparser.BoolVal:
323- // return expression.NewLiteral(bool(v), sql.Boolean), nil
324- case sqlparser.NumVal :
325- //TODO: Use smallest integer representation and widen later.
326- n , _ := strconv .ParseInt (string (v ), 10 , 64 )
327- return expression .NewLiteral (n , sql .BigInteger ), nil
328- case sqlparser.HexVal :
329- //TODO
330- return nil , errUnsupported (v )
320+ case * sqlparser.SQLVal :
321+ switch v .Type {
322+ case sqlparser .StrVal :
323+ return expression .NewLiteral (string (v .Val ), sql .String ), nil
324+ case sqlparser .IntVal :
325+ //TODO: Use smallest integer representation and widen later.
326+ n , _ := strconv .ParseInt (string (v .Val ), 10 , 64 )
327+ return expression .NewLiteral (n , sql .BigInteger ), nil
328+ case sqlparser .HexVal :
329+ //TODO
330+ return nil , errUnsupported (v )
331+ default :
332+ //TODO
333+ return nil , errUnsupported (v )
334+ }
335+ case sqlparser.BoolVal :
336+ return expression .NewLiteral (bool (v ), sql .Boolean ), nil
331337 case * sqlparser.NullVal :
332338 //TODO
333339 return expression .NewLiteral (nil , sql .Null ), nil
0 commit comments