Skip to content

Commit

Permalink
#366 Multiple join produce "DSL SYNTAX ERROR"
Browse files Browse the repository at this point in the history
  • Loading branch information
Tapac committed Aug 16, 2018
1 parent 906b841 commit f2eddf9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/kotlin/org/jetbrains/exposed/sql/Table.kt
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ class Join (val table: ColumnSet) : ColumnSet() {
override fun describe(s: Transaction): String = buildString {
append(table.describe(s))
for (p in joinParts) {
append(" ${p.joinType} JOIN ${p.joinPart.describe(s)}")
append(" ${p.joinType} JOIN ")
val isJoin = p.joinPart is Join
if (isJoin) append("(")
append(p.joinPart.describe(s))
if(isJoin) append(")")
if (p.joinType != JoinType.CROSS) {
append(" ON ")
val queryBuilder = QueryBuilder(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1338,6 +1338,14 @@ class DMLTests : DatabaseTestsBase() {
}
}

@Test
fun testJoinWithJoin01() {
withCitiesAndUsers { cities, users, userData ->
val rows = (cities innerJoin (users innerJoin userData)).selectAll()
assertEquals(2, rows.count())
}
}

@Test
fun testStringFunctions() {
withCitiesAndUsers { cities, users, userData ->
Expand Down

0 comments on commit f2eddf9

Please sign in to comment.