SQLServer2005LimitHandler creates invalid query when quoted column uses keywords.

Description

When a field name contains the " from " word in a field name and you enable the pagination the result query is wrong.

For example:

1 2 3 4 @Column(name = "[Created From Nonstock Item]", nullable = false) public Short getCreatedFromNonstockItem() { return this.createdFromNonstockItem; }

Whill cause the pagination to fail because the expression created here:

1 2 3 4 5 6 7 8 while ( nextComa != -1 ) { prevComa = nextComa; nextComa = shallowIndexOfPattern( sb, COMMA_PATTERN, nextComa ); if ( nextComa > endPos ) { break; } if ( nextComa != -1 ) { final String expression = sb.substring( prevComa, nextComa );

is wrong. Its value is "[Created ". This means that "alias" variable is null and the query will add something like this:

1 [Created as page0_ From Nonstock Item] as Created19_0_,

Environment

None

Status

Assignee

Chris Cranford

Reporter

Andrea Palmatè

Fix versions

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.2.2
5.2.3

Priority

Major