@@ -25,8 +25,8 @@ import (
2525 "log"
2626 "strings"
2727
28- "github.com/xwb1989 /sqlparser/dependency/querypb"
29- "github.com/xwb1989 /sqlparser/dependency/sqltypes"
28+ "github.com/uole /sqlparser/dependency/querypb"
29+ "github.com/uole /sqlparser/dependency/sqltypes"
3030)
3131
3232// Instructions for creating new types: If a type
@@ -289,7 +289,7 @@ func (node *Select) SetLimit(limit *Limit) {
289289
290290// Format formats the node.
291291func (node * Select ) Format (buf * TrackedBuffer ) {
292- buf .Myprintf ("select %v%s%s%s%v from %v%v%v%v%v%v%s" ,
292+ buf .Myprintf ("SELECT %v%s%s%s%v FROM %v%v%v%v%v%v%s" ,
293293 node .Comments , node .Cache , node .Distinct , node .Hints , node .SelectExprs ,
294294 node .From , node .Where ,
295295 node .GroupBy , node .Having , node .OrderBy ,
@@ -478,8 +478,8 @@ type Insert struct {
478478
479479// DDL strings.
480480const (
481- InsertStr = "insert "
482- ReplaceStr = "replace "
481+ InsertStr = "INSERT "
482+ ReplaceStr = "REPLACE "
483483)
484484
485485// Format formats the node.
@@ -528,7 +528,7 @@ type Update struct {
528528
529529// Format formats the node.
530530func (node * Update ) Format (buf * TrackedBuffer ) {
531- buf .Myprintf ("update %v%v set %v%v%v%v" ,
531+ buf .Myprintf ("UPDATE %v%v SET %v%v%v%v" ,
532532 node .Comments , node .TableExprs ,
533533 node .Exprs , node .Where , node .OrderBy , node .Limit )
534534}
@@ -562,11 +562,11 @@ type Delete struct {
562562
563563// Format formats the node.
564564func (node * Delete ) Format (buf * TrackedBuffer ) {
565- buf .Myprintf ("delete %v" , node .Comments )
565+ buf .Myprintf ("DELETE %v" , node .Comments )
566566 if node .Targets != nil {
567567 buf .Myprintf ("%v " , node .Targets )
568568 }
569- buf .Myprintf ("from %v%v%v%v%v" , node .TableExprs , node .Partitions , node .Where , node .OrderBy , node .Limit )
569+ buf .Myprintf ("FROM %v%v%v%v%v" , node .TableExprs , node .Partitions , node .Where , node .OrderBy , node .Limit )
570570}
571571
572572func (node * Delete ) walkSubtree (visit Visit ) error {
@@ -600,9 +600,9 @@ const (
600600// Format formats the node.
601601func (node * Set ) Format (buf * TrackedBuffer ) {
602602 if node .Scope == "" {
603- buf .Myprintf ("set %v%v" , node .Comments , node .Exprs )
603+ buf .Myprintf ("SET %v%v" , node .Comments , node .Exprs )
604604 } else {
605- buf .Myprintf ("set %v%s %v" , node .Comments , node .Scope , node .Exprs )
605+ buf .Myprintf ("SET %v%s %v" , node .Comments , node .Scope , node .Exprs )
606606 }
607607}
608608
@@ -634,7 +634,7 @@ func (node *DBDDL) Format(buf *TrackedBuffer) {
634634 case DropStr :
635635 exists := ""
636636 if node .IfExists {
637- exists = " if exists "
637+ exists = " IF EXISTS "
638638 }
639639 buf .WriteString (fmt .Sprintf ("%s database%s %v" , node .Action , exists , node .DBName ))
640640 }
@@ -1338,9 +1338,9 @@ type ShowFilter struct {
13381338// Format formats the node.
13391339func (node * ShowFilter ) Format (buf * TrackedBuffer ) {
13401340 if node .Like != "" {
1341- buf .Myprintf ("like '%s'" , node .Like )
1341+ buf .Myprintf ("LIKE '%s'" , node .Like )
13421342 } else {
1343- buf .Myprintf ("where %v" , node .Filter )
1343+ buf .Myprintf ("WHERE %v" , node .Filter )
13441344 }
13451345}
13461346
@@ -1870,8 +1870,8 @@ type Where struct {
18701870
18711871// Where.Type
18721872const (
1873- WhereStr = "where "
1874- HavingStr = "having "
1873+ WhereStr = "WHERE "
1874+ HavingStr = "HAVING "
18751875)
18761876
18771877// NewWhere creates a WHERE or HAVING clause out
@@ -2148,8 +2148,8 @@ type RangeCond struct {
21482148
21492149// RangeCond.Operator
21502150const (
2151- BetweenStr = "between "
2152- NotBetweenStr = "not between "
2151+ BetweenStr = "BETWEEN "
2152+ NotBetweenStr = "NOT BETWEEN "
21532153)
21542154
21552155// Format formats the node.
@@ -2321,7 +2321,7 @@ func (node *SQLVal) Format(buf *TrackedBuffer) {
23212321 case BitVal :
23222322 buf .Myprintf ("B'%s'" , []byte (node .Val ))
23232323 case ValArg :
2324- buf .WriteArg (string (node . Val ))
2324+ buf .WriteArg (string ("?" ))
23252325 default :
23262326 panic ("unexpected" )
23272327 }
@@ -3003,7 +3003,7 @@ type When struct {
30033003
30043004// Format formats the node.
30053005func (node * When ) Format (buf * TrackedBuffer ) {
3006- buf .Myprintf ("when %v then %v" , node .Cond , node .Val )
3006+ buf .Myprintf ("WHEN %v THEN %v" , node .Cond , node .Val )
30073007}
30083008
30093009func (node * When ) walkSubtree (visit Visit ) error {
@@ -3022,7 +3022,7 @@ type GroupBy []Expr
30223022
30233023// Format formats the node.
30243024func (node GroupBy ) Format (buf * TrackedBuffer ) {
3025- prefix := " group by "
3025+ prefix := " GROUP BY "
30263026 for _ , n := range node {
30273027 buf .Myprintf ("%s%v" , prefix , n )
30283028 prefix = ", "
@@ -3043,7 +3043,7 @@ type OrderBy []*Order
30433043
30443044// Format formats the node.
30453045func (node OrderBy ) Format (buf * TrackedBuffer ) {
3046- prefix := " order by "
3046+ prefix := " ORDER BY "
30473047 for _ , n := range node {
30483048 buf .Myprintf ("%s%v" , prefix , n )
30493049 prefix = ", "
@@ -3067,8 +3067,8 @@ type Order struct {
30673067
30683068// Order.Direction
30693069const (
3070- AscScr = "asc "
3071- DescScr = "desc "
3070+ AscScr = "ASC "
3071+ DescScr = "DESC "
30723072)
30733073
30743074// Format formats the node.
@@ -3107,7 +3107,7 @@ func (node *Limit) Format(buf *TrackedBuffer) {
31073107 if node == nil {
31083108 return
31093109 }
3110- buf .Myprintf (" limit " )
3110+ buf .Myprintf (" LIMIT " )
31113111 if node .Offset != nil {
31123112 buf .Myprintf ("%v, " , node .Offset )
31133113 }
@@ -3130,7 +3130,7 @@ type Values []ValTuple
31303130
31313131// Format formats the node.
31323132func (node Values ) Format (buf * TrackedBuffer ) {
3133- prefix := "values "
3133+ prefix := "VALUES "
31343134 for _ , n := range node {
31353135 buf .Myprintf ("%s%v" , prefix , n )
31363136 prefix = ", "
0 commit comments