File tree 2 files changed +13
-2
lines changed
2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -161,8 +161,8 @@ Sql.prototype.travelXORExpression = function (ast) {
161
161
this . appendKeyword ( ast . operator ) ;
162
162
this . travel ( ast . right ) ;
163
163
}
164
- Sql . prototype . travelNull =
165
- Sql . prototype . travelBoolean =
164
+ Sql . prototype . travelNull =
165
+ Sql . prototype . travelBoolean =
166
166
Sql . prototype . travelBooleanExtra = function ( ast ) {
167
167
this . appendKeyword ( ast . value ) ;
168
168
}
@@ -184,6 +184,12 @@ Sql.prototype.travelFunctionCall = function (ast) {
184
184
}
185
185
}
186
186
this . append ( ')' , true ) ;
187
+ if ( ast . alias ) {
188
+ if ( ast . hasAs ) {
189
+ this . appendKeyword ( 'as' ) ;
190
+ }
191
+ this . travel ( ast . alias ) ;
192
+ }
187
193
}
188
194
Sql . prototype . travelFunctionCallParam = function ( ast ) {
189
195
if ( ast . distinctOpt ) {
Original file line number Diff line number Diff line change @@ -136,5 +136,10 @@ AND (rd.rd_numberofrooms <= (select sum(rn.reservation_numberofrooms) as count_r
136
136
it ( 'restore semicolon.' , function ( ) {
137
137
testParser ( 'select a from b limit 2;' ) ;
138
138
} ) ;
139
+
140
+ it ( 'recognoce alias for sql-function calls in stringify function.' , function ( ) {
141
+ testParser ( 'SELECT COUNT(*) AS total FROM b' ) ;
142
+ } ) ;
143
+
139
144
} ) ;
140
145
You can’t perform that action at this time.
0 commit comments