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
diff --git a/src/main/java/com/google/gwtorm/jdbc/AccessGen.java b/src/main/java/com/google/gwtorm/jdbc/AccessGen.java
index 7cba532..3066f73 100644
--- a/src/main/java/com/google/gwtorm/jdbc/AccessGen.java
+++ b/src/main/java/com/google/gwtorm/jdbc/AccessGen.java
@@ -736,20 +736,22 @@
       if (hasLimitParam || !dialect.selectHasLimit()) {
         mv.visitVarInsn(ALOAD, psvar);
         if (hasLimitParam) {
-          CodeGenSupport cgs2 = new CodeGenSupport(mv) {
-            @Override
-            public void pushSqlHandle() {
-              mv.visitVarInsn(ALOAD, psvar);
-            }
+          if (dialect.selectHasLimit()) {
+            CodeGenSupport cgs2 = new CodeGenSupport(mv) {
+              @Override
+              public void pushSqlHandle() {
+                mv.visitVarInsn(ALOAD, psvar);
+              }
 
-            @Override
-            public void pushFieldValue() {
-              final int n = argIdx[0];
-              loadVar(pTypes[n], pVars[n]);
-            }
-          };
-          cgs2.resetColumnIndex(cgs.getColumnIndex() + 1);
-          dialect.getSqlTypeInfo(Integer.TYPE).generatePreparedStatementSet(cgs2);
+              @Override
+              public void pushFieldValue() {
+                final int n = argIdx[0];
+                loadVar(pTypes[n], pVars[n]);
+              }
+            };
+            cgs2.resetColumnIndex(cgs.getColumnIndex() + 1);
+            dialect.getSqlTypeInfo(Integer.TYPE).generatePreparedStatementSet(cgs2);
+          }
           mv.visitVarInsn(ILOAD, pVars[pTypes.length - 1]);
         } else {
           cgs.push(info.getStaticLimit());