Skip to content
Open
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
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ This document is intended for Spotless developers.
We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `1.27.0`).

## [Unreleased]
### Fixed
* Preserve case of JDBI named bind params that collide with SQL keywords (e.g. `:limit`, `:offset`) in the DBeaver SQL formatter.

## [4.5.0] - 2026-03-18
### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,13 @@ private List<FormatterToken> format(final List<FormatterToken> argList) {
}

final KeywordCase keywordCase = formatterCfg.getKeywordCase();
for (FormatterToken anArgList : argList) {
token = anArgList;
for (int index = 0; index < argList.size(); index++) {
token = argList.get(index);
if (token.getType() == TokenType.KEYWORD) {
// Do not transform case for JDBI named bind params (e.g. :limit, :offset)
if (index > 0 && isEmbeddedToken(argList.get(index - 1))) {
continue;
}
token.setString(keywordCase.transform(token.getString()));
}
}
Expand Down Expand Up @@ -323,8 +327,10 @@ private List<FormatterToken> format(final List<FormatterToken> argList) {
continue;
}
if (token.getType() == TokenType.SYMBOL && isEmbeddedToken(token)
&& (!":".equals(token.getString()) || prev.getType() == TokenType.SYMBOL)
|| prev.getType() == TokenType.SYMBOL && isEmbeddedToken(prev)) {
// Do not insert spaces around colons
// Do not insert spaces around embedded tokens (colons, dots),
// except before JDBI named bind params (e.g. :limit) preceded by a keyword or name
continue;
}
if (token.getType() == TokenType.SYMBOL && prev.getType() == TokenType.SYMBOL) {
Expand Down
2 changes: 2 additions & 0 deletions plugin-gradle/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `3.27.0`).

## [Unreleased]
### Fixed
* Preserve case of JDBI named bind params that collide with SQL keywords (e.g. `:limit`, `:offset`) in the DBeaver SQL formatter.

## [8.4.0] - 2026-03-18
### Added
Expand Down
2 changes: 2 additions & 0 deletions plugin-maven/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `1.27.0`).

## [Unreleased]
### Fixed
* Preserve case of JDBI named bind params that collide with SQL keywords (e.g. `:limit`, `:offset`) in the DBeaver SQL formatter.

## [3.4.0] - 2026-03-18
### Added
Expand Down
7 changes: 7 additions & 0 deletions testlib/src/main/resources/sql/dbeaver/jdbi-params.clean
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,10 @@ FROM
WHERE
id IN(<ids>)
AND user_id =:user_id;

SELECT
*
FROM
TABLE
WHERE
id =:id LIMIT :limit OFFSET :offset;
1 change: 1 addition & 0 deletions testlib/src/main/resources/sql/dbeaver/jdbi-params.dirty
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
SELECT * FROM table WHERE id IN (<ids>) AND user_id = :user_id;
SELECT * FROM table WHERE id = :id LIMIT :limit OFFSET :offset;