| 673 | } |
| 674 | |
| 675 | func (c *cc) convertValueExpr(n *driver.ValueExpr) *ast.A_Const { |
| 676 | switch n.TexprNode.Type.GetType() { |
| 677 | case mysql.TypeBit: |
| 678 | case mysql.TypeDate: |
| 679 | case mysql.TypeDatetime: |
| 680 | case mysql.TypeGeometry: |
| 681 | case mysql.TypeJSON: |
| 682 | case mysql.TypeNull: |
| 683 | case mysql.TypeSet: |
| 684 | case mysql.TypeShort: |
| 685 | case mysql.TypeDuration: |
| 686 | case mysql.TypeTimestamp: |
| 687 | // TODO: Create an AST type for these? |
| 688 | |
| 689 | case mysql.TypeTiny, |
| 690 | mysql.TypeInt24, |
| 691 | mysql.TypeYear, |
| 692 | mysql.TypeLong, |
| 693 | mysql.TypeLonglong: |
| 694 | return &ast.A_Const{ |
| 695 | Val: &ast.Integer{ |
| 696 | Ival: n.Datum.GetInt64(), |
| 697 | }, |
| 698 | Location: n.OriginTextPosition(), |
| 699 | } |
| 700 | |
| 701 | case mysql.TypeDouble, |
| 702 | mysql.TypeFloat, |
| 703 | mysql.TypeNewDecimal: |
| 704 | return &ast.A_Const{ |
| 705 | Val: &ast.Float{ |
| 706 | Str: strconv.FormatFloat(n.Datum.GetFloat64(), 'f', -1, 64), |
| 707 | }, |
| 708 | Location: n.OriginTextPosition(), |
| 709 | } |
| 710 | |
| 711 | case mysql.TypeBlob, mysql.TypeString, mysql.TypeVarchar, mysql.TypeVarString, mysql.TypeLongBlob, mysql.TypeMediumBlob, mysql.TypeTinyBlob, mysql.TypeEnum: |
| 712 | } |
| 713 | return &ast.A_Const{ |
| 714 | Val: &ast.String{ |
| 715 | Str: n.Datum.GetString(), |
| 716 | }, |
| 717 | Location: n.OriginTextPosition(), |
| 718 | } |
| 719 | } |
| 720 | |
| 721 | func (c *cc) convertWildCardField(n *pcast.WildCardField) *ast.ColumnRef { |
| 722 | items := []ast.Node{} |