File tree Expand file tree Collapse file tree 3 files changed +14
-6
lines changed
src/main/kotlin/com/github/mgramin/sqlboot/sql/select Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -64,11 +64,20 @@ class SimpleSelectQuery(private val templateGenerator: TemplateGenerator) : Sele
6464 override fun execute (variables : Map <String , Any >) = throw RuntimeException (" Not allow here" )
6565
6666
67- private class SelectStatementParser ( sql : String ) {
67+ private class SelectStatementParser {
6868
69- val parser = SELECTParser (CommonTokenStream (SELECTLexer (ANTLRInputStream (sql))))
70- val selectVisitorCustom = SelectVisitorCustom ()
71- val visit = selectVisitorCustom.visit(parser.select_statement())
69+ constructor (sql: String ) {
70+ val selectLexer = SELECTLexer (ANTLRInputStream (sql))
71+ selectLexer.removeErrorListeners()
72+
73+ this .parser = SELECTParser (CommonTokenStream (selectLexer))
74+ this .selectVisitorCustom = SelectVisitorCustom ()
75+ this .visit = selectVisitorCustom.visit(parser.select_statement())
76+ }
77+
78+ val parser: SELECTParser
79+ val selectVisitorCustom: SelectVisitorCustom
80+ val visit: Any
7281
7382 fun comment () = selectVisitorCustom.queryComment
7483
Original file line number Diff line number Diff line change @@ -65,7 +65,6 @@ select_statement
6565 : query_comment
6666 (with)*
6767 select select_row( COMMA select_row )*
68- from (schema_name+ DOT )? table_name
6968 .*?
7069 ;
7170
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ class JdbcSelectQuery(
6767
6868 override fun execute (variables : Map <String , Any >): Flux <Map <String , Any >> {
6969 val sqlText = JinjaTemplateGenerator (origin.query()).generate(variables)
70- logger.info(sqlText)
70+ logger.info(" \n $ sqlText" )
7171
7272 return Mono .fromCallable {
7373 logger.info(Thread .currentThread().toString())
You can’t perform that action at this time.
0 commit comments