Skip to content

Commit 9e646ea

Browse files
committed
1 parent 1c9419c commit 9e646ea

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

src/main/kotlin/com/github/mgramin/sqlboot/sql/select/impl/SimpleSelectQuery.kt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff 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

src/main/kotlin/com/github/mgramin/sqlboot/sql/select/impl/parser/SELECT.g4

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff 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

src/main/kotlin/com/github/mgramin/sqlboot/sql/select/wrappers/JdbcSelectQuery.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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())

0 commit comments

Comments
 (0)