@@ -25,8 +25,8 @@ import (
25
25
"log"
26
26
"strings"
27
27
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"
30
30
)
31
31
32
32
// Instructions for creating new types: If a type
@@ -289,7 +289,7 @@ func (node *Select) SetLimit(limit *Limit) {
289
289
290
290
// Format formats the node.
291
291
func (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" ,
293
293
node .Comments , node .Cache , node .Distinct , node .Hints , node .SelectExprs ,
294
294
node .From , node .Where ,
295
295
node .GroupBy , node .Having , node .OrderBy ,
@@ -478,8 +478,8 @@ type Insert struct {
478
478
479
479
// DDL strings.
480
480
const (
481
- InsertStr = "insert "
482
- ReplaceStr = "replace "
481
+ InsertStr = "INSERT "
482
+ ReplaceStr = "REPLACE "
483
483
)
484
484
485
485
// Format formats the node.
@@ -528,7 +528,7 @@ type Update struct {
528
528
529
529
// Format formats the node.
530
530
func (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" ,
532
532
node .Comments , node .TableExprs ,
533
533
node .Exprs , node .Where , node .OrderBy , node .Limit )
534
534
}
@@ -562,11 +562,11 @@ type Delete struct {
562
562
563
563
// Format formats the node.
564
564
func (node * Delete ) Format (buf * TrackedBuffer ) {
565
- buf .Myprintf ("delete %v" , node .Comments )
565
+ buf .Myprintf ("DELETE %v" , node .Comments )
566
566
if node .Targets != nil {
567
567
buf .Myprintf ("%v " , node .Targets )
568
568
}
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 )
570
570
}
571
571
572
572
func (node * Delete ) walkSubtree (visit Visit ) error {
@@ -600,9 +600,9 @@ const (
600
600
// Format formats the node.
601
601
func (node * Set ) Format (buf * TrackedBuffer ) {
602
602
if node .Scope == "" {
603
- buf .Myprintf ("set %v%v" , node .Comments , node .Exprs )
603
+ buf .Myprintf ("SET %v%v" , node .Comments , node .Exprs )
604
604
} 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 )
606
606
}
607
607
}
608
608
@@ -634,7 +634,7 @@ func (node *DBDDL) Format(buf *TrackedBuffer) {
634
634
case DropStr :
635
635
exists := ""
636
636
if node .IfExists {
637
- exists = " if exists "
637
+ exists = " IF EXISTS "
638
638
}
639
639
buf .WriteString (fmt .Sprintf ("%s database%s %v" , node .Action , exists , node .DBName ))
640
640
}
@@ -1338,9 +1338,9 @@ type ShowFilter struct {
1338
1338
// Format formats the node.
1339
1339
func (node * ShowFilter ) Format (buf * TrackedBuffer ) {
1340
1340
if node .Like != "" {
1341
- buf .Myprintf ("like '%s'" , node .Like )
1341
+ buf .Myprintf ("LIKE '%s'" , node .Like )
1342
1342
} else {
1343
- buf .Myprintf ("where %v" , node .Filter )
1343
+ buf .Myprintf ("WHERE %v" , node .Filter )
1344
1344
}
1345
1345
}
1346
1346
@@ -1870,8 +1870,8 @@ type Where struct {
1870
1870
1871
1871
// Where.Type
1872
1872
const (
1873
- WhereStr = "where "
1874
- HavingStr = "having "
1873
+ WhereStr = "WHERE "
1874
+ HavingStr = "HAVING "
1875
1875
)
1876
1876
1877
1877
// NewWhere creates a WHERE or HAVING clause out
@@ -2148,8 +2148,8 @@ type RangeCond struct {
2148
2148
2149
2149
// RangeCond.Operator
2150
2150
const (
2151
- BetweenStr = "between "
2152
- NotBetweenStr = "not between "
2151
+ BetweenStr = "BETWEEN "
2152
+ NotBetweenStr = "NOT BETWEEN "
2153
2153
)
2154
2154
2155
2155
// Format formats the node.
@@ -2321,7 +2321,7 @@ func (node *SQLVal) Format(buf *TrackedBuffer) {
2321
2321
case BitVal :
2322
2322
buf .Myprintf ("B'%s'" , []byte (node .Val ))
2323
2323
case ValArg :
2324
- buf .WriteArg (string (node . Val ))
2324
+ buf .WriteArg (string ("?" ))
2325
2325
default :
2326
2326
panic ("unexpected" )
2327
2327
}
@@ -3003,7 +3003,7 @@ type When struct {
3003
3003
3004
3004
// Format formats the node.
3005
3005
func (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 )
3007
3007
}
3008
3008
3009
3009
func (node * When ) walkSubtree (visit Visit ) error {
@@ -3022,7 +3022,7 @@ type GroupBy []Expr
3022
3022
3023
3023
// Format formats the node.
3024
3024
func (node GroupBy ) Format (buf * TrackedBuffer ) {
3025
- prefix := " group by "
3025
+ prefix := " GROUP BY "
3026
3026
for _ , n := range node {
3027
3027
buf .Myprintf ("%s%v" , prefix , n )
3028
3028
prefix = ", "
@@ -3043,7 +3043,7 @@ type OrderBy []*Order
3043
3043
3044
3044
// Format formats the node.
3045
3045
func (node OrderBy ) Format (buf * TrackedBuffer ) {
3046
- prefix := " order by "
3046
+ prefix := " ORDER BY "
3047
3047
for _ , n := range node {
3048
3048
buf .Myprintf ("%s%v" , prefix , n )
3049
3049
prefix = ", "
@@ -3067,8 +3067,8 @@ type Order struct {
3067
3067
3068
3068
// Order.Direction
3069
3069
const (
3070
- AscScr = "asc "
3071
- DescScr = "desc "
3070
+ AscScr = "ASC "
3071
+ DescScr = "DESC "
3072
3072
)
3073
3073
3074
3074
// Format formats the node.
@@ -3107,7 +3107,7 @@ func (node *Limit) Format(buf *TrackedBuffer) {
3107
3107
if node == nil {
3108
3108
return
3109
3109
}
3110
- buf .Myprintf (" limit " )
3110
+ buf .Myprintf (" LIMIT " )
3111
3111
if node .Offset != nil {
3112
3112
buf .Myprintf ("%v, " , node .Offset )
3113
3113
}
@@ -3130,7 +3130,7 @@ type Values []ValTuple
3130
3130
3131
3131
// Format formats the node.
3132
3132
func (node Values ) Format (buf * TrackedBuffer ) {
3133
- prefix := "values "
3133
+ prefix := "VALUES "
3134
3134
for _ , n := range node {
3135
3135
buf .Myprintf ("%s%v" , prefix , n )
3136
3136
prefix = ", "
0 commit comments