File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 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) {
161161 this . appendKeyword ( ast . operator ) ;
162162 this . travel ( ast . right ) ;
163163}
164- Sql . prototype . travelNull =
165- Sql . prototype . travelBoolean =
164+ Sql . prototype . travelNull =
165+ Sql . prototype . travelBoolean =
166166Sql . prototype . travelBooleanExtra = function ( ast ) {
167167 this . appendKeyword ( ast . value ) ;
168168}
@@ -184,6 +184,12 @@ Sql.prototype.travelFunctionCall = function (ast) {
184184 }
185185 }
186186 this . append ( ')' , true ) ;
187+ if ( ast . alias ) {
188+ if ( ast . hasAs ) {
189+ this . appendKeyword ( 'as' ) ;
190+ }
191+ this . travel ( ast . alias ) ;
192+ }
187193}
188194Sql . prototype . travelFunctionCallParam = function ( ast ) {
189195 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
136136 it ( 'restore semicolon.' , function ( ) {
137137 testParser ( 'select a from b limit 2;' ) ;
138138 } ) ;
139+
140+ it ( 'recognoce alias for sql-function calls in stringify function.' , function ( ) {
141+ testParser ( 'SELECT COUNT(*) AS total FROM b' ) ;
142+ } ) ;
143+
139144} ) ;
140145
You can’t perform that action at this time.
0 commit comments