File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ func numInput(query string) int {
2929 and = newMatcher ("and" )
3030 from = newMatcher ("from" )
3131 join = newMatcher ("join" )
32+ subSelect = newMatcher ("select" )
3233 )
3334 for {
3435 if char , _ , err := reader .ReadRune (); err == nil {
@@ -74,7 +75,7 @@ func numInput(query string) int {
7475 keyword = true
7576 default :
7677 if limit .matchRune (char ) || offset .matchRune (char ) || like .matchRune (char ) ||
77- in .matchRune (char ) || from .matchRune (char ) || join .matchRune (char ) {
78+ in .matchRune (char ) || from .matchRune (char ) || join .matchRune (char ) || subSelect . matchRune ( char ) {
7879 keyword = true
7980 } else if between .matchRune (char ) {
8081 keyword = true
@@ -133,6 +134,8 @@ func quote(v driver.Value) string {
133134 return "'" + strings .NewReplacer (`\` , `\\` , `'` , `\'` ).Replace (v ) + "'"
134135 case time.Time :
135136 return formatTime (v )
137+ case nil :
138+ return "null"
136139 }
137140 return fmt .Sprint (v )
138141}
Original file line number Diff line number Diff line change @@ -127,6 +127,7 @@ func (stmt *stmt) bind(args []driver.NamedValue) (string, []ExternalTable) {
127127 in = newMatcher ("in" )
128128 from = newMatcher ("from" )
129129 join = newMatcher ("join" )
130+ subSelect = newMatcher ("select" )
130131 externalTables = make ([]ExternalTable , 0 )
131132 )
132133 switch {
@@ -178,7 +179,7 @@ func (stmt *stmt) bind(args []driver.NamedValue) (string, []ExternalTable) {
178179 keyword = true
179180 default :
180181 if limit .matchRune (char ) || offset .matchRune (char ) || like .matchRune (char ) ||
181- in .matchRune (char ) || from .matchRune (char ) || join .matchRune (char ) {
182+ in .matchRune (char ) || from .matchRune (char ) || join .matchRune (char ) || subSelect . matchRune ( char ) {
182183 keyword = true
183184 } else if between .matchRune (char ) {
184185 keyword = true
You can’t perform that action at this time.
0 commit comments