Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
* @author Geoffrey Deremetz
* @author Yanming Zhou
* @author Christoph Strobl
* @author Diego Pedregal
* @since 2.7.0
*/
public class JSqlParserQueryEnhancer implements QueryEnhancer {
Expand Down Expand Up @@ -237,7 +238,7 @@ private static String detectProjection(Statement statement) {
}

StringJoiner joiner = new StringJoiner(", ");
for (SelectItem<?> selectItem : ((PlainSelect) selectBody).getSelectItems()) {
for (SelectItem<?> selectItem : selectBody.getPlainSelect().getSelectItems()) {
joiner.add(selectItem.toString());
}
return joiner.toString().trim();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,13 @@ static Stream<Arguments> mergeStatementWorksSource() {
null));
}

@Test // GH-3869
void shouldWorkWithoutFromClause() {
String query = "SELECT is_contained_in(:innerId, :outerId)";

StringQuery stringQuery = new StringQuery(query, true);

assertThat(stringQuery.getQueryString()).isEqualTo(query);
}

}