Only bind LIMIT variable in SQL when dialect supports it

Jdbc dialect may claim not to support LIMIT construct by overriding
selectHasLimit() method and returning false.

When this is the case, then the query model doesn't generate LIMIT ?
construct.  Since Ie18898242 however limit variable is always bound
into prepare statement, i. e. by calling setInt(1, 5) on it. But this
obviously cannot work as select statement doesn't include any bind
variables. As the consequence it fails with:

  java.sql.SQLException: Invalid column index

Rectify it by only binding the variables in the LIMIT construct, when
Jdbc dialect claims to support it.  Currently all dialects support it,
with one exception: Oracle.

Change-Id: Ibea3e71ea8df79bb238d4ff21c4c1b9748439d2a
1 file changed