git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@1105 f203690c-595d-4dc9-a70b-905162fa7fd2tags/jackcess-2.1.8
@@ -267,7 +267,7 @@ public abstract class QueryImpl implements Query | |||
return result; | |||
} | |||
private Join getJoinExpr(String table, List<Join> joinExprs) | |||
private static Join getJoinExpr(String table, List<Join> joinExprs) | |||
{ | |||
for(Iterator<Join> iter = joinExprs.iterator(); iter.hasNext(); ) { | |||
Join joinExpr = iter.next(); | |||
@@ -276,8 +276,9 @@ public abstract class QueryImpl implements Query | |||
return joinExpr; | |||
} | |||
} | |||
throw new IllegalStateException(withErrorContext( | |||
"Cannot find join table " + table)); | |||
// just use the table name as is | |||
return new Join(table, toOptionalQuotedExpr(new StringBuilder(), | |||
table, true).toString()); | |||
} | |||
private Collection<List<Row>> combineJoins(List<Row> joins) |
@@ -408,12 +408,9 @@ public class QueryTest extends TestCase | |||
addRows(query, newRow(JOIN_ATTRIBUTE, "(Table1.id = Table3Val.id)", 1, "BogusTable", "Table3Val")); | |||
try { | |||
query.toSQLString(); | |||
fail("IllegalStateException should have been thrown"); | |||
} catch(IllegalStateException e) { | |||
// success | |||
} | |||
assertEquals(multiline("SELECT Table1.id, Table1.col AS [Some.Alias]", | |||
"FROM BogusTable INNER JOIN ((Table1 INNER JOIN Table2 AS [Another Table] ON (Table1.id = [Another Table].id)) LEFT JOIN [Select val from Table3].val AS Table3Val ON (Table1.id = Table3Val.id)) ON (Table1.id = Table3Val.id);"), | |||
query.toSQLString()); | |||
removeRows(query, JOIN_ATTRIBUTE); | |||
} |