camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/2] camel git commit: CAMEL-4725:Vendor spesific SQL type. Removed type conversions per SQL type.
Date Fri, 15 Jan 2016 07:38:49 GMT
CAMEL-4725:Vendor spesific SQL type. Removed type conversions per SQL type.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b3196ee5
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b3196ee5
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b3196ee5

Branch: refs/heads/master
Commit: b3196ee548866a26f2dbec512570804cc1787c61
Parents: 8363812
Author: Sami Nurminen <snurmine@gmail.com>
Authored: Thu Jan 14 19:30:45 2016 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Fri Jan 15 08:31:02 2016 +0100

----------------------------------------------------------------------
 .../BatchCallableStatementCreatorFactory.java   |   2 +-
 .../sql/stored/CallableStatementWrapper.java    |   4 +-
 .../sql/stored/SqlStoredComponent.java          |   3 +-
 .../component/sql/stored/SqlStoredEndpoint.java |   3 +-
 .../component/sql/stored/StamentWrapper.java    |   1 -
 .../sql/stored/TemplateStoredProcedure.java     |   6 +-
 .../sql/stored/template/ast/InputParameter.java |  23 +-
 .../sql/stored/template/ast/OutParameter.java   |  10 +-
 .../sql/stored/template/ast/ParseHelper.java    |  40 +-
 .../stored/template/generated/SSPTParser.java   | 556 +++++++-------
 .../template/generated/SSPTParserConstants.java |  65 +-
 .../generated/SSPTParserTokenManager.java       | 739 ++++++++++---------
 .../sql/stored/template/grammar/sspt.jj         |  28 +-
 .../camel/component/sql/stored/ParserTest.java  |  17 +-
 14 files changed, 745 insertions(+), 752 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/b3196ee5/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/BatchCallableStatementCreatorFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/BatchCallableStatementCreatorFactory.java b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/BatchCallableStatementCreatorFactory.java
index cda2bd4..6654007 100644
--- a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/BatchCallableStatementCreatorFactory.java
+++ b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/BatchCallableStatementCreatorFactory.java
@@ -86,7 +86,7 @@ public class BatchCallableStatementCreatorFactory {
         return params;
     }
 
-    public CallableStatementCreator newCallableStatementCreator(Map params) {
+    public CallableStatementCreator newCallableStatementCreator(Map<String, ?> params) {
         return this.callableStatementCreatorFactory.newCallableStatementCreator(params);
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/b3196ee5/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/CallableStatementWrapper.java
----------------------------------------------------------------------
diff --git a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/CallableStatementWrapper.java b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/CallableStatementWrapper.java
index 824f21d..b46e1a5 100644
--- a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/CallableStatementWrapper.java
+++ b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/CallableStatementWrapper.java
@@ -39,7 +39,7 @@ public class CallableStatementWrapper implements StamentWrapper {
 
     Map result;
 
-    List<Map> batchItems;
+    List<Map<String, ?>> batchItems;
 
     Integer updateCount;
 
@@ -63,7 +63,7 @@ public class CallableStatementWrapper implements StamentWrapper {
             throw new IllegalArgumentException("Batch must have at least one item");
         }
 
-        final Iterator<Map> params = batchItems.iterator();
+        final Iterator<Map<String, ?>> params = batchItems.iterator();
 
 
         return factory.getJdbcTemplate().execute(new CallableStatementCreator() {

http://git-wip-us.apache.org/repos/asf/camel/blob/b3196ee5/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/SqlStoredComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/SqlStoredComponent.java b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/SqlStoredComponent.java
index 5444b18..0cefe31 100644
--- a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/SqlStoredComponent.java
+++ b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/SqlStoredComponent.java
@@ -44,7 +44,7 @@ public class SqlStoredComponent extends UriEndpointComponent {
     }
 
     @Override
-    protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
+    protected Endpoint createEndpoint(String uri, String template, Map<String, Object> parameters) throws Exception {
         DataSource target = null;
 
         // endpoint options overrule component configured datasource
@@ -61,7 +61,6 @@ public class SqlStoredComponent extends UriEndpointComponent {
         }
 
         JdbcTemplate jdbcTemplate = new JdbcTemplate(target);
-        String template = remaining;
 
         SqlStoredEndpoint endpoint = new SqlStoredEndpoint(uri, this, jdbcTemplate);
         endpoint.setTemplate(template);

http://git-wip-us.apache.org/repos/asf/camel/blob/b3196ee5/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/SqlStoredEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/SqlStoredEndpoint.java b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/SqlStoredEndpoint.java
index 7897c74..0c41d10 100644
--- a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/SqlStoredEndpoint.java
+++ b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/SqlStoredEndpoint.java
@@ -58,8 +58,7 @@ public class SqlStoredEndpoint extends DefaultPollingEndpoint {
     }
 
     public Producer createProducer() throws Exception {
-        SqlStoredProducer result = new SqlStoredProducer(this);
-        return result;
+        return new SqlStoredProducer(this);
     }
 
 

http://git-wip-us.apache.org/repos/asf/camel/blob/b3196ee5/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/StamentWrapper.java
----------------------------------------------------------------------
diff --git a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/StamentWrapper.java b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/StamentWrapper.java
index 1b92b28..bcf842d 100644
--- a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/StamentWrapper.java
+++ b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/StamentWrapper.java
@@ -19,7 +19,6 @@ package org.apache.camel.component.sql.stored;
 import java.sql.SQLException;
 
 import org.apache.camel.Exchange;
-import org.apache.camel.component.sql.SqlProducer;
 
 /**
  * Wrapper that simplifies operations on  {@link java.sql.CallableStatement}

http://git-wip-us.apache.org/repos/asf/camel/blob/b3196ee5/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/TemplateStoredProcedure.java
----------------------------------------------------------------------
diff --git a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/TemplateStoredProcedure.java b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/TemplateStoredProcedure.java
index c7a1df5..a71ec9b 100644
--- a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/TemplateStoredProcedure.java
+++ b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/TemplateStoredProcedure.java
@@ -54,7 +54,7 @@ public class TemplateStoredProcedure extends StoredProcedure {
 
             } else if (parameter instanceof OutParameter) {
                 OutParameter outParameter = (OutParameter) parameter;
-                declareParameter(new SqlOutParameter(outParameter.getOutHeader(), outParameter.getSqlType()));
+                declareParameter(new SqlOutParameter(outParameter.getOutValueMapKey(), outParameter.getSqlType()));
                 setFunction(false);
             }
         }
@@ -71,9 +71,7 @@ public class TemplateStoredProcedure extends StoredProcedure {
         }
 
         LOG.debug("Invoking stored procedure: {}", template.getProcedureName());
-        Map<String, Object> ret = super.execute(params);
-
-        return ret;
+        return super.execute(params);
     }
 
     public Template getTemplate() {

http://git-wip-us.apache.org/repos/asf/camel/blob/b3196ee5/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/ast/InputParameter.java
----------------------------------------------------------------------
diff --git a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/ast/InputParameter.java b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/ast/InputParameter.java
index deb4d52..9623752 100644
--- a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/ast/InputParameter.java
+++ b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/ast/InputParameter.java
@@ -28,13 +28,11 @@ public class InputParameter {
 
     private final String name;
     private final int sqlType;
-    private final Class javaType;
     private ValueExtractor valueExtractor;
 
-    public InputParameter(String name, int sqlType, Token valueSrcToken, Class javaType) {
+    public InputParameter(String name, int sqlType, Token valueSrcToken) {
         this.name = name;
         this.sqlType = sqlType;
-        this.javaType = javaType;
         parseValueExpression(valueSrcToken);
     }
 
@@ -45,7 +43,7 @@ public class InputParameter {
 
                 @Override
                 public Object eval(Exchange exchange, Object container) {
-                    return exp.evaluate(exchange, javaType);
+                    return exp.evaluate(exchange, Object.class);
                 }
             };
         } else if (SSPTParserConstants.PARAMETER_POS_TOKEN == valueSrcToken.kind) {
@@ -61,18 +59,6 @@ public class InputParameter {
         }
     }
 
-    /*public Object getParameterValueFromContainer(Exchange exchange, Object container) {
-        if (this.valueExpression != null) {
-            return valueExpression.evaluate(exchange, this.getJavaType());
-        } else {
-            return getValueFromMap((Map<String, Object>) container);
-        }
-    }*/
-
-    /*private Object getValueFromMap(Map<String, Object> container) {
-        return container.get(mapKey);
-    }*/
-
     public String getName() {
         return name;
     }
@@ -81,11 +67,6 @@ public class InputParameter {
         return sqlType;
     }
 
-
-    public Class getJavaType() {
-        return javaType;
-    }
-
     public ValueExtractor getValueExtractor() {
         return valueExtractor;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/b3196ee5/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/ast/OutParameter.java
----------------------------------------------------------------------
diff --git a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/ast/OutParameter.java b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/ast/OutParameter.java
index f01bf57..82b67a1 100644
--- a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/ast/OutParameter.java
+++ b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/ast/OutParameter.java
@@ -20,12 +20,12 @@ public class OutParameter {
 
     private String name;
     private int sqlType;
-    private String outHeader;
+    private String outValueMapKey;
 
-    public OutParameter(String name, int sqlType, String outHeader) {
+    public OutParameter(String name, int sqlType, String outValueMapKey) {
         this.name = name;
         this.sqlType = sqlType;
-        this.outHeader = outHeader;
+        this.outValueMapKey = outValueMapKey;
     }
 
     public String getName() {
@@ -36,7 +36,7 @@ public class OutParameter {
         return sqlType;
     }
 
-    public String getOutHeader() {
-        return outHeader;
+    public String getOutValueMapKey() {
+        return outValueMapKey;
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/b3196ee5/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/ast/ParseHelper.java
----------------------------------------------------------------------
diff --git a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/ast/ParseHelper.java b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/ast/ParseHelper.java
index 8a2d9b5..bbfec72 100644
--- a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/ast/ParseHelper.java
+++ b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/ast/ParseHelper.java
@@ -17,36 +17,26 @@
 package org.apache.camel.component.sql.stored.template.ast;
 
 import java.lang.reflect.Field;
-import java.math.BigDecimal;
-import java.sql.Date;
 import java.sql.Types;
-import java.util.HashMap;
-import java.util.Map;
 
+import org.apache.camel.component.sql.stored.template.generated.SSPTParserConstants;
+import org.apache.camel.component.sql.stored.template.generated.Token;
 import org.springframework.util.ReflectionUtils;
 
 public final class ParseHelper {
 
-    static final Map<Integer, Class> SQL_TYPE_TO_JAVA_CLASS = new HashMap<>();
-
-    //somekind of mapping here https://docs.oracle.com/cd/E19501-01/819-3659/gcmaz/
-    //TODO: test with each SQL_TYPE_TO_JAVA_CLASS that JAVA conversion works!
-    static {
-        SQL_TYPE_TO_JAVA_CLASS.put(Types.INTEGER, Integer.class);
-        SQL_TYPE_TO_JAVA_CLASS.put(Types.VARCHAR, String.class);
-        SQL_TYPE_TO_JAVA_CLASS.put(Types.BIGINT, Long.class);
-        SQL_TYPE_TO_JAVA_CLASS.put(Types.CHAR, String.class);
-        SQL_TYPE_TO_JAVA_CLASS.put(Types.DECIMAL, BigDecimal.class);
-        SQL_TYPE_TO_JAVA_CLASS.put(Types.BOOLEAN, Boolean.class);
-        SQL_TYPE_TO_JAVA_CLASS.put(Types.DATE, Date.class);
-        SQL_TYPE_TO_JAVA_CLASS.put(Types.TIMESTAMP, Date.class);
-    }
-
     private ParseHelper() {
     }
 
-    public static int parseSqlType(String sqlType) {
-        Field field = ReflectionUtils.findField(Types.class, sqlType);
+    public static int parseSqlType(Token sqlType) {
+
+        //if number then use it(probably Vendor spesific SQL-type)
+        if (sqlType.kind == SSPTParserConstants.NUMBER) {
+            return Integer.valueOf(sqlType.toString());
+        }
+
+        //Loop-up from "Standard" types
+        Field field = ReflectionUtils.findField(Types.class, sqlType.toString());
         if (field == null) {
             throw new ParseRuntimeException("Field " + sqlType + " not found from java.procedureName.Types");
         }
@@ -56,12 +46,4 @@ public final class ParseHelper {
             throw new ParseRuntimeException(e);
         }
     }
-
-    public static Class sqlTypeToJavaType(int sqlType, String sqlTypeStr) {
-        Class javaType = SQL_TYPE_TO_JAVA_CLASS.get(sqlType);
-        if (javaType == null) {
-            throw new ParseRuntimeException("Unable to map SQL type " + sqlTypeStr + " to Java type");
-        }
-        return javaType;
-    }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/b3196ee5/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/generated/SSPTParser.java
----------------------------------------------------------------------
diff --git a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/generated/SSPTParser.java b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/generated/SSPTParser.java
index 27599f8..d55b900 100644
--- a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/generated/SSPTParser.java
+++ b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/generated/SSPTParser.java
@@ -1,328 +1,308 @@
 /* Generated By:JavaCC: Do not edit this line. SSPTParser.java */
 package org.apache.camel.component.sql.stored.template.generated;
 
-import org.apache.camel.component.sql.stored.template.ast.InputParameter;
-import org.apache.camel.component.sql.stored.template.ast.OutParameter;
-import org.apache.camel.component.sql.stored.template.ast.ParseHelper;
-import org.apache.camel.component.sql.stored.template.ast.Template;
+import org.apache.camel.component.sql.stored.template.ast.*;
 
 public class SSPTParser implements SSPTParserConstants {
-    static private int[] jj_la1_0;
+   int paramaterNameCounter = 0;
 
-    static {
-        jj_la1_init_0();
-    }
-
-    final private int[] jj_la1 = new int[4];
-    /** Generated Token Manager. */
-    public SSPTParserTokenManager token_source;
-    /** Current token. */
-    public Token token;
-    /** Next token. */
-    public Token jj_nt;
-    int paramaterNameCounter = 0;
-    SimpleCharStream jj_input_stream;
-    private int jj_ntk;
-    private int jj_gen;
-    private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
-    private int[] jj_expentry;
-    private int jj_kind = -1;
+   String createNextParameterName() {
+      return "_"+(paramaterNameCounter++);
+   }
 
-    /** Constructor with InputStream. */
-    public SSPTParser(java.io.InputStream stream) {
-        this(stream, null);
-    }
-
-    /** Constructor with InputStream and supplied encoding */
-    public SSPTParser(java.io.InputStream stream, String encoding) {
-        try {
-            jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1);
-        } catch (java.io.UnsupportedEncodingException e) {
-            throw new RuntimeException(e);
+  final public Template parse() throws ParseException {
+    Token procudureName;
+    Template template = new Template();
+    Object parameter = null;
+    procudureName = jj_consume_token(IDENTIFIER);
+    jj_consume_token(1);
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case 5:
+    case NUMBER:
+    case IDENTIFIER:
+      parameter = Parameter();
+                                                                 template.addParameter(parameter);
+      label_1:
+      while (true) {
+        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+        case 2:
+          ;
+          break;
+        default:
+          jj_la1[0] = jj_gen;
+          break label_1;
         }
-        token_source = new SSPTParserTokenManager(jj_input_stream);
-        token = new Token();
-        jj_ntk = -1;
-        jj_gen = 0;
-        for (int i = 0; i < 4; i++) jj_la1[i] = -1;
+        jj_consume_token(2);
+        parameter = Parameter();
+                template.addParameter(parameter);
+      }
+      break;
+    default:
+      jj_la1[1] = jj_gen;
+      ;
     }
+    jj_consume_token(3);
+    jj_consume_token(0);
+   template.setProcedureName(procudureName.toString());
+   {if (true) return template;}
+    throw new Error("Missing return statement in function");
+  }
 
-    /** Constructor. */
-    public SSPTParser(java.io.Reader stream) {
-        jj_input_stream = new SimpleCharStream(stream, 1, 1);
-        token_source = new SSPTParserTokenManager(jj_input_stream);
-        token = new Token();
-        jj_ntk = -1;
-        jj_gen = 0;
-        for (int i = 0; i < 4; i++) jj_la1[i] = -1;
+  final public Object Parameter() throws ParseException {
+    Object param;
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case NUMBER:
+    case IDENTIFIER:
+      param = InputParameter();
+                                {if (true) return param;}
+      break;
+    case 5:
+      param = OutParameter();
+                                                                          {if (true) return param;}
+      break;
+    default:
+      jj_la1[2] = jj_gen;
+      jj_consume_token(-1);
+      throw new ParseException();
     }
+    throw new Error("Missing return statement in function");
+  }
 
-    /** Constructor with generated Token Manager. */
-    public SSPTParser(SSPTParserTokenManager tm) {
-        token_source = tm;
-        token = new Token();
-        jj_ntk = -1;
-        jj_gen = 0;
-        for (int i = 0; i < 4; i++) jj_la1[i] = -1;
-    }
+  final public InputParameter InputParameter() throws ParseException {
+     Token sqlTypeToken;
+     String name;
+     Token valueSrcToken;
+    sqlTypeToken = ParameterSqlType();
+    jj_consume_token(4);
+    valueSrcToken = InputParameterSrc();
+        int sqlType = ParseHelper.parseSqlType(sqlTypeToken);
+        {if (true) return new InputParameter(createNextParameterName(),sqlType,valueSrcToken);}
+    throw new Error("Missing return statement in function");
+  }
 
-    private static void jj_la1_init_0() {
-        jj_la1_0 = new int[]{0x4, 0x820, 0x820, 0x600,};
-    }
+  final public OutParameter OutParameter() throws ParseException {
+     Token sqlTypeToken;
+     String name;
+     String outValueMapKey;
+    jj_consume_token(5);
+    jj_consume_token(4);
+    sqlTypeToken = ParameterSqlType();
+    jj_consume_token(4);
+    outValueMapKey = OutHeader();
+        {if (true) return new OutParameter(createNextParameterName(),ParseHelper.parseSqlType(sqlTypeToken),outValueMapKey);}
+    throw new Error("Missing return statement in function");
+  }
 
-    String createNextParameterName() {
-        return "_" + (paramaterNameCounter++);
+  final public Token ParameterSqlType() throws ParseException {
+    Token t;
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case NUMBER:
+      t = jj_consume_token(NUMBER);
+      break;
+    case IDENTIFIER:
+      t = jj_consume_token(IDENTIFIER);
+      break;
+    default:
+      jj_la1[3] = jj_gen;
+      jj_consume_token(-1);
+      throw new ParseException();
     }
+        {if (true) return t;}
+    throw new Error("Missing return statement in function");
+  }
 
-    final public Template parse() throws ParseException {
-        Token procudureName;
-        Template template = new Template();
-        Object parameter = null;
-        procudureName = jj_consume_token(IDENTIFIER);
-        jj_consume_token(1);
-        switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
-            case 5:
-            case IDENTIFIER:
-                parameter = Parameter();
-                template.addParameter(parameter);
-                label_1:
-                while (true) {
-                    switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
-                        case 2:
-                            ;
-                            break;
-                        default:
-                            jj_la1[0] = jj_gen;
-                            break label_1;
-                    }
-                    jj_consume_token(2);
-                    parameter = Parameter();
-                    template.addParameter(parameter);
-                }
-                break;
-            default:
-                jj_la1[1] = jj_gen;
-                ;
-        }
-        jj_consume_token(3);
-        jj_consume_token(0);
-        template.setProcedureName(procudureName.toString());
-        {
-            if (true) return template;
-        }
-        throw new Error("Missing return statement in function");
-    }
+  final public String OutHeader() throws ParseException {
+ Token token;
+    token = jj_consume_token(IDENTIFIER);
+        {if (true) return token.toString();}
+    throw new Error("Missing return statement in function");
+  }
 
-    final public Object Parameter() throws ParseException {
-        Object param;
-        switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
-            case IDENTIFIER:
-                param = InputParameter();
-            {
-                if (true) return param;
-            }
-            break;
-            case 5:
-                param = OutParameter();
-            {
-                if (true) return param;
-            }
-            break;
-            default:
-                jj_la1[2] = jj_gen;
-                jj_consume_token(-1);
-                throw new ParseException();
-        }
-        throw new Error("Missing return statement in function");
+  final public Token InputParameterSrc() throws ParseException {
+    Token ret = null;
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case SIMPLE_EXP_TOKEN:
+      ret = jj_consume_token(SIMPLE_EXP_TOKEN);
+        {if (true) return ret;}
+      break;
+    case PARAMETER_POS_TOKEN:
+      ret = jj_consume_token(PARAMETER_POS_TOKEN);
+            {if (true) return ret;}
+      break;
+    default:
+      jj_la1[4] = jj_gen;
+      jj_consume_token(-1);
+      throw new ParseException();
     }
+    throw new Error("Missing return statement in function");
+  }
 
-    final public InputParameter InputParameter() throws ParseException {
-        String sqlTypeAsStr;
-        String name;
-        Token valueSrcToken;
-        sqlTypeAsStr = ParameterSqlType();
-        jj_consume_token(4);
-        valueSrcToken = InputParameterSrc();
-        int sqlType = ParseHelper.parseSqlType(sqlTypeAsStr);
-        {
-            if (true)
-                return new InputParameter(createNextParameterName(), sqlType, valueSrcToken, ParseHelper.sqlTypeToJavaType(sqlType,
-                        sqlTypeAsStr));
-        }
-        throw new Error("Missing return statement in function");
-    }
+  /** Generated Token Manager. */
+  public SSPTParserTokenManager token_source;
+  SimpleCharStream jj_input_stream;
+  /** Current token. */
+  public Token token;
+  /** Next token. */
+  public Token jj_nt;
+  private int jj_ntk;
+  private int jj_gen;
+  final private int[] jj_la1 = new int[5];
+  static private int[] jj_la1_0;
+  static {
+      jj_la1_init_0();
+   }
+   private static void jj_la1_init_0() {
+      jj_la1_0 = new int[] {0x4,0x1060,0x1060,0x1040,0xc00,};
+   }
 
-    final public OutParameter OutParameter() throws ParseException {
-        String sqlType;
-        String name;
-        String outHeader;
-        jj_consume_token(5);
-        jj_consume_token(4);
-        sqlType = ParameterSqlType();
-        jj_consume_token(4);
-        outHeader = OutHeader();
-        {
-            if (true) return new OutParameter(createNextParameterName(), ParseHelper.parseSqlType(sqlType), outHeader);
-        }
-        throw new Error("Missing return statement in function");
-    }
+  /** Constructor with InputStream. */
+  public SSPTParser(java.io.InputStream stream) {
+     this(stream, null);
+  }
+  /** Constructor with InputStream and supplied encoding */
+  public SSPTParser(java.io.InputStream stream, String encoding) {
+    try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
+    token_source = new SSPTParserTokenManager(jj_input_stream);
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 5; i++) jj_la1[i] = -1;
+  }
 
-    final public String ParameterSqlType() throws ParseException {
-        Token t;
-        t = jj_consume_token(IDENTIFIER);
-        {
-            if (true) return t.toString();
-        }
-        throw new Error("Missing return statement in function");
-    }
+  /** Reinitialise. */
+  public void ReInit(java.io.InputStream stream) {
+     ReInit(stream, null);
+  }
+  /** Reinitialise. */
+  public void ReInit(java.io.InputStream stream, String encoding) {
+    try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
+    token_source.ReInit(jj_input_stream);
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 5; i++) jj_la1[i] = -1;
+  }
 
-    final public String OutHeader() throws ParseException {
-        Token token;
-        token = jj_consume_token(IDENTIFIER);
-        {
-            if (true) return token.toString();
-        }
-        throw new Error("Missing return statement in function");
-    }
+  /** Constructor. */
+  public SSPTParser(java.io.Reader stream) {
+    jj_input_stream = new SimpleCharStream(stream, 1, 1);
+    token_source = new SSPTParserTokenManager(jj_input_stream);
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 5; i++) jj_la1[i] = -1;
+  }
 
-    final public Token InputParameterSrc() throws ParseException {
-        Token ret = null;
-        switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
-            case SIMPLE_EXP_TOKEN:
-                ret = jj_consume_token(SIMPLE_EXP_TOKEN);
-            {
-                if (true) return ret;
-            }
-            break;
-            case PARAMETER_POS_TOKEN:
-                ret = jj_consume_token(PARAMETER_POS_TOKEN);
-            {
-                if (true) return ret;
-            }
-            break;
-            default:
-                jj_la1[3] = jj_gen;
-                jj_consume_token(-1);
-                throw new ParseException();
-        }
-        throw new Error("Missing return statement in function");
-    }
+  /** Reinitialise. */
+  public void ReInit(java.io.Reader stream) {
+    jj_input_stream.ReInit(stream, 1, 1);
+    token_source.ReInit(jj_input_stream);
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 5; i++) jj_la1[i] = -1;
+  }
 
-    /** Reinitialise. */
-    public void ReInit(java.io.InputStream stream) {
-        ReInit(stream, null);
-    }
+  /** Constructor with generated Token Manager. */
+  public SSPTParser(SSPTParserTokenManager tm) {
+    token_source = tm;
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 5; i++) jj_la1[i] = -1;
+  }
 
-    /** Reinitialise. */
-    public void ReInit(java.io.InputStream stream, String encoding) {
-        try {
-            jj_input_stream.ReInit(stream, encoding, 1, 1);
-        } catch (java.io.UnsupportedEncodingException e) {
-            throw new RuntimeException(e);
-        }
-        token_source.ReInit(jj_input_stream);
-        token = new Token();
-        jj_ntk = -1;
-        jj_gen = 0;
-        for (int i = 0; i < 4; i++) jj_la1[i] = -1;
-    }
+  /** Reinitialise. */
+  public void ReInit(SSPTParserTokenManager tm) {
+    token_source = tm;
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 5; i++) jj_la1[i] = -1;
+  }
 
-    /** Reinitialise. */
-    public void ReInit(java.io.Reader stream) {
-        jj_input_stream.ReInit(stream, 1, 1);
-        token_source.ReInit(jj_input_stream);
-        token = new Token();
-        jj_ntk = -1;
-        jj_gen = 0;
-        for (int i = 0; i < 4; i++) jj_la1[i] = -1;
+  private Token jj_consume_token(int kind) throws ParseException {
+    Token oldToken;
+    if ((oldToken = token).next != null) token = token.next;
+    else token = token.next = token_source.getNextToken();
+    jj_ntk = -1;
+    if (token.kind == kind) {
+      jj_gen++;
+      return token;
     }
+    token = oldToken;
+    jj_kind = kind;
+    throw generateParseException();
+  }
 
-    /** Reinitialise. */
-    public void ReInit(SSPTParserTokenManager tm) {
-        token_source = tm;
-        token = new Token();
-        jj_ntk = -1;
-        jj_gen = 0;
-        for (int i = 0; i < 4; i++) jj_la1[i] = -1;
-    }
 
-    private Token jj_consume_token(int kind) throws ParseException {
-        Token oldToken;
-        if ((oldToken = token).next != null) token = token.next;
-        else token = token.next = token_source.getNextToken();
-        jj_ntk = -1;
-        if (token.kind == kind) {
-            jj_gen++;
-            return token;
-        }
-        token = oldToken;
-        jj_kind = kind;
-        throw generateParseException();
-    }
+/** Get the next Token. */
+  final public Token getNextToken() {
+    if (token.next != null) token = token.next;
+    else token = token.next = token_source.getNextToken();
+    jj_ntk = -1;
+    jj_gen++;
+    return token;
+  }
 
-    /** Get the next Token. */
-    final public Token getNextToken() {
-        if (token.next != null) token = token.next;
-        else token = token.next = token_source.getNextToken();
-        jj_ntk = -1;
-        jj_gen++;
-        return token;
+/** Get the specific Token. */
+  final public Token getToken(int index) {
+    Token t = token;
+    for (int i = 0; i < index; i++) {
+      if (t.next != null) t = t.next;
+      else t = t.next = token_source.getNextToken();
     }
+    return t;
+  }
 
-    /** Get the specific Token. */
-    final public Token getToken(int index) {
-        Token t = token;
-        for (int i = 0; i < index; i++) {
-            if (t.next != null) t = t.next;
-            else t = t.next = token_source.getNextToken();
-        }
-        return t;
-    }
+  private int jj_ntk() {
+    if ((jj_nt=token.next) == null)
+      return (jj_ntk = (token.next=token_source.getNextToken()).kind);
+    else
+      return (jj_ntk = jj_nt.kind);
+  }
 
-    private int jj_ntk() {
-        if ((jj_nt = token.next) == null)
-            return (jj_ntk = (token.next = token_source.getNextToken()).kind);
-        else
-            return (jj_ntk = jj_nt.kind);
-    }
+  private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
+  private int[] jj_expentry;
+  private int jj_kind = -1;
 
-    /** Generate ParseException. */
-    public ParseException generateParseException() {
-        jj_expentries.clear();
-        boolean[] la1tokens = new boolean[12];
-        if (jj_kind >= 0) {
-            la1tokens[jj_kind] = true;
-            jj_kind = -1;
-        }
-        for (int i = 0; i < 4; i++) {
-            if (jj_la1[i] == jj_gen) {
-                for (int j = 0; j < 32; j++) {
-                    if ((jj_la1_0[i] & (1 << j)) != 0) {
-                        la1tokens[j] = true;
-                    }
-                }
-            }
-        }
-        for (int i = 0; i < 12; i++) {
-            if (la1tokens[i]) {
-                jj_expentry = new int[1];
-                jj_expentry[0] = i;
-                jj_expentries.add(jj_expentry);
-            }
-        }
-        int[][] exptokseq = new int[jj_expentries.size()][];
-        for (int i = 0; i < jj_expentries.size(); i++) {
-            exptokseq[i] = jj_expentries.get(i);
+  /** Generate ParseException. */
+  public ParseException generateParseException() {
+    jj_expentries.clear();
+    boolean[] la1tokens = new boolean[13];
+    if (jj_kind >= 0) {
+      la1tokens[jj_kind] = true;
+      jj_kind = -1;
+    }
+    for (int i = 0; i < 5; i++) {
+      if (jj_la1[i] == jj_gen) {
+        for (int j = 0; j < 32; j++) {
+          if ((jj_la1_0[i] & (1<<j)) != 0) {
+            la1tokens[j] = true;
+          }
         }
-        return new ParseException(token, exptokseq, tokenImage);
+      }
     }
-
-    /** Enable tracing. */
-    final public void enable_tracing() {
+    for (int i = 0; i < 13; i++) {
+      if (la1tokens[i]) {
+        jj_expentry = new int[1];
+        jj_expentry[0] = i;
+        jj_expentries.add(jj_expentry);
+      }
     }
-
-    /** Disable tracing. */
-    final public void disable_tracing() {
+    int[][] exptokseq = new int[jj_expentries.size()][];
+    for (int i = 0; i < jj_expentries.size(); i++) {
+      exptokseq[i] = jj_expentries.get(i);
     }
+    return new ParseException(token, exptokseq, tokenImage);
+  }
+
+  /** Enable tracing. */
+  final public void enable_tracing() {
+  }
+
+  /** Disable tracing. */
+  final public void disable_tracing() {
+  }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/b3196ee5/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/generated/SSPTParserConstants.java
----------------------------------------------------------------------
diff --git a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/generated/SSPTParserConstants.java b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/generated/SSPTParserConstants.java
index 147e050..0b66a49 100644
--- a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/generated/SSPTParserConstants.java
+++ b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/generated/SSPTParserConstants.java
@@ -8,38 +8,41 @@ package org.apache.camel.component.sql.stored.template.generated;
  */
 public interface SSPTParserConstants {
 
-    /** End of File. */
-    int EOF = 0;
-    /** RegularExpression Id. */
-    int DIGIT = 6;
-    /** RegularExpression Id. */
-    int LETTER = 7;
-    /** RegularExpression Id. */
-    int SPECIAL = 8;
-    /** RegularExpression Id. */
-    int SIMPLE_EXP_TOKEN = 9;
-    /** RegularExpression Id. */
-    int PARAMETER_POS_TOKEN = 10;
-    /** RegularExpression Id. */
-    int IDENTIFIER = 11;
+  /** End of File. */
+  int EOF = 0;
+  /** RegularExpression Id. */
+  int NUMBER = 6;
+  /** RegularExpression Id. */
+  int DIGIT = 7;
+  /** RegularExpression Id. */
+  int LETTER = 8;
+  /** RegularExpression Id. */
+  int SPECIAL = 9;
+  /** RegularExpression Id. */
+  int SIMPLE_EXP_TOKEN = 10;
+  /** RegularExpression Id. */
+  int PARAMETER_POS_TOKEN = 11;
+  /** RegularExpression Id. */
+  int IDENTIFIER = 12;
 
-    /** Lexical state. */
-    int DEFAULT = 0;
+  /** Lexical state. */
+  int DEFAULT = 0;
 
-    /** Literal token values. */
-    String[] tokenImage = {
-            "<EOF>",
-            "\"(\"",
-            "\",\"",
-            "\")\"",
-            "\" \"",
-            "\"OUT\"",
-            "<DIGIT>",
-            "<LETTER>",
-            "<SPECIAL>",
-            "<SIMPLE_EXP_TOKEN>",
-            "<PARAMETER_POS_TOKEN>",
-            "<IDENTIFIER>",
-    };
+  /** Literal token values. */
+  String[] tokenImage = {
+    "<EOF>",
+    "\"(\"",
+    "\",\"",
+    "\")\"",
+    "\" \"",
+    "\"OUT\"",
+    "<NUMBER>",
+    "<DIGIT>",
+    "<LETTER>",
+    "<SPECIAL>",
+    "<SIMPLE_EXP_TOKEN>",
+    "<PARAMETER_POS_TOKEN>",
+    "<IDENTIFIER>",
+  };
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/b3196ee5/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/generated/SSPTParserTokenManager.java
----------------------------------------------------------------------
diff --git a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/generated/SSPTParserTokenManager.java b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/generated/SSPTParserTokenManager.java
index d1a65b8..1dd57a1 100644
--- a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/generated/SSPTParserTokenManager.java
+++ b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/generated/SSPTParserTokenManager.java
@@ -1,375 +1,410 @@
 /* Generated By:JavaCC: Do not edit this line. SSPTParserTokenManager.java */
 package org.apache.camel.component.sql.stored.template.generated;
+import org.apache.camel.component.sql.stored.template.ast.*;
 
 /** Token Manager. */
-public class SSPTParserTokenManager implements SSPTParserConstants {
+public class SSPTParserTokenManager implements SSPTParserConstants
+{
 
-    /** Token literal values. */
-    public static final String[] jjstrLiteralImages = {
-            "", "\50", "\54", "\51", "\40", "\117\125\124", null, null, null, null, null,
-            null,};
-    /** Lexer state names. */
-    public static final String[] lexStateNames = {
-            "DEFAULT",
-    };
-    static final int[] jjnextStates = {
-            1, 2,
-    };
-    private final int[] jjrounds = new int[8];
-    private final int[] jjstateSet = new int[16];
-    /** Debug output. */
-    public java.io.PrintStream debugStream = System.out;
-    protected SimpleCharStream input_stream;
-    protected char curChar;
-    int curLexState = 0;
-    int defaultLexState = 0;
-    int jjnewStateCnt;
-    int jjround;
-    int jjmatchedPos;
-    int jjmatchedKind;
-
-    /** Constructor. */
-    public SSPTParserTokenManager(SimpleCharStream stream) {
-        if (SimpleCharStream.staticFlag)
-            throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
-        input_stream = stream;
-    }
-
-    /** Constructor. */
-    public SSPTParserTokenManager(SimpleCharStream stream, int lexState) {
-        this(stream);
-        SwitchTo(lexState);
-    }
-
-    /** Set debug output. */
-    public void setDebugStream(java.io.PrintStream ds) {
-        debugStream = ds;
-    }
-
-    private final int jjStopStringLiteralDfa_0(int pos, long active0) {
-        switch (pos) {
-            case 0:
-                if ((active0 & 0x20L) != 0L) {
-                    jjmatchedKind = 11;
-                    return 7;
-                }
-                return -1;
-            case 1:
-                if ((active0 & 0x20L) != 0L) {
-                    jjmatchedKind = 11;
-                    jjmatchedPos = 1;
-                    return 7;
-                }
-                return -1;
-            default:
-                return -1;
-        }
-    }
-
-    private final int jjStartNfa_0(int pos, long active0) {
-        return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
-    }
-
-    private int jjStopAtPos(int pos, int kind) {
-        jjmatchedKind = kind;
-        jjmatchedPos = pos;
-        return pos + 1;
-    }
-
-    private int jjMoveStringLiteralDfa0_0() {
-        switch (curChar) {
-            case 32:
-                return jjStopAtPos(0, 4);
-            case 40:
-                return jjStopAtPos(0, 1);
-            case 41:
-                return jjStopAtPos(0, 3);
-            case 44:
-                return jjStopAtPos(0, 2);
-            case 79:
-                return jjMoveStringLiteralDfa1_0(0x20L);
-            default:
-                return jjMoveNfa_0(3, 0);
-        }
-    }
-
-    private int jjMoveStringLiteralDfa1_0(long active0) {
-        try {
-            curChar = input_stream.readChar();
-        } catch (java.io.IOException e) {
-            jjStopStringLiteralDfa_0(0, active0);
-            return 1;
-        }
-        switch (curChar) {
-            case 85:
-                return jjMoveStringLiteralDfa2_0(active0, 0x20L);
-            default:
-                break;
-        }
-        return jjStartNfa_0(0, active0);
-    }
-
-    private int jjMoveStringLiteralDfa2_0(long old0, long active0) {
-        if (((active0 &= old0)) == 0L)
-            return jjStartNfa_0(0, old0);
-        try {
-            curChar = input_stream.readChar();
-        } catch (java.io.IOException e) {
-            jjStopStringLiteralDfa_0(1, active0);
-            return 2;
-        }
-        switch (curChar) {
-            case 84:
-                if ((active0 & 0x20L) != 0L)
-                    return jjStartNfaWithStates_0(2, 5, 7);
-                break;
-            default:
-                break;
-        }
-        return jjStartNfa_0(1, active0);
-    }
-
-    private int jjStartNfaWithStates_0(int pos, int kind, int state) {
-        jjmatchedKind = kind;
-        jjmatchedPos = pos;
-        try {
-            curChar = input_stream.readChar();
-        } catch (java.io.IOException e) {
-            return pos + 1;
-        }
-        return jjMoveNfa_0(state, pos + 1);
-    }
-
-    private int jjMoveNfa_0(int startState, int curPos) {
-        int startsAt = 0;
-        jjnewStateCnt = 8;
-        int i = 1;
-        jjstateSet[0] = startState;
-        int kind = 0x7fffffff;
-        for (; ; ) {
-            if (++jjround == 0x7fffffff)
-                ReInitRounds();
-            if (curChar < 64) {
-                long l = 1L << curChar;
-                do {
-                    switch (jjstateSet[--i]) {
-                        case 3:
-                            if ((0x3ff609c00000000L & l) != 0L) {
-                                if (kind > 11)
-                                    kind = 11;
-                                jjCheckNAdd(7);
-                            } else if (curChar == 58)
-                                jjstateSet[jjnewStateCnt++] = 4;
-                            if (curChar == 36)
-                                jjstateSet[jjnewStateCnt++] = 0;
-                            break;
-                        case 1:
-                            if ((0x3ff609d00000000L & l) != 0L)
-                                jjAddStates(0, 1);
-                            break;
-                        case 4:
-                            if (curChar == 35)
-                                jjCheckNAdd(5);
-                            break;
-                        case 5:
-                            if ((0x3ff609c00000000L & l) == 0L)
-                                break;
-                            if (kind > 10)
-                                kind = 10;
-                            jjCheckNAdd(5);
-                            break;
-                        case 6:
-                            if (curChar == 58)
-                                jjstateSet[jjnewStateCnt++] = 4;
-                            break;
-                        case 7:
-                            if ((0x3ff609c00000000L & l) == 0L)
-                                break;
-                            if (kind > 11)
-                                kind = 11;
-                            jjCheckNAdd(7);
-                            break;
-                        default:
-                            break;
-                    }
-                } while (i != startsAt);
-            } else if (curChar < 128) {
-                long l = 1L << (curChar & 077);
-                do {
-                    switch (jjstateSet[--i]) {
-                        case 3:
-                        case 7:
-                            if ((0x2ffffffe87fffffeL & l) == 0L)
-                                break;
-                            if (kind > 11)
-                                kind = 11;
-                            jjCheckNAdd(7);
-                            break;
-                        case 0:
-                            if (curChar == 123)
-                                jjCheckNAdd(1);
-                            break;
-                        case 1:
-                            if ((0x2ffffffe87fffffeL & l) != 0L)
-                                jjCheckNAddTwoStates(1, 2);
-                            break;
-                        case 2:
-                            if (curChar == 125 && kind > 9)
-                                kind = 9;
-                            break;
-                        case 5:
-                            if ((0x2ffffffe87fffffeL & l) == 0L)
-                                break;
-                            if (kind > 10)
-                                kind = 10;
-                            jjstateSet[jjnewStateCnt++] = 5;
-                            break;
-                        default:
-                            break;
-                    }
-                } while (i != startsAt);
-            } else {
-                int i2 = (curChar & 0xff) >> 6;
-                long l2 = 1L << (curChar & 077);
-                do {
-                    switch (jjstateSet[--i]) {
-                        default:
-                            break;
-                    }
-                } while (i != startsAt);
+  /** Debug output. */
+  public  java.io.PrintStream debugStream = System.out;
+  /** Set debug output. */
+  public  void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
+private final int jjStopStringLiteralDfa_0(int pos, long active0)
+{
+   switch (pos)
+   {
+      case 0:
+         if ((active0 & 0x20L) != 0L)
+         {
+            jjmatchedKind = 12;
+            return 8;
+         }
+         return -1;
+      case 1:
+         if ((active0 & 0x20L) != 0L)
+         {
+            jjmatchedKind = 12;
+            jjmatchedPos = 1;
+            return 8;
+         }
+         return -1;
+      default :
+         return -1;
+   }
+}
+private final int jjStartNfa_0(int pos, long active0)
+{
+   return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
+}
+private int jjStopAtPos(int pos, int kind)
+{
+   jjmatchedKind = kind;
+   jjmatchedPos = pos;
+   return pos + 1;
+}
+private int jjMoveStringLiteralDfa0_0()
+{
+   switch(curChar)
+   {
+      case 32:
+         return jjStopAtPos(0, 4);
+      case 40:
+         return jjStopAtPos(0, 1);
+      case 41:
+         return jjStopAtPos(0, 3);
+      case 44:
+         return jjStopAtPos(0, 2);
+      case 79:
+         return jjMoveStringLiteralDfa1_0(0x20L);
+      default :
+         return jjMoveNfa_0(4, 0);
+   }
+}
+private int jjMoveStringLiteralDfa1_0(long active0)
+{
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) {
+      jjStopStringLiteralDfa_0(0, active0);
+      return 1;
+   }
+   switch(curChar)
+   {
+      case 85:
+         return jjMoveStringLiteralDfa2_0(active0, 0x20L);
+      default :
+         break;
+   }
+   return jjStartNfa_0(0, active0);
+}
+private int jjMoveStringLiteralDfa2_0(long old0, long active0)
+{
+   if (((active0 &= old0)) == 0L)
+      return jjStartNfa_0(0, old0);
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) {
+      jjStopStringLiteralDfa_0(1, active0);
+      return 2;
+   }
+   switch(curChar)
+   {
+      case 84:
+         if ((active0 & 0x20L) != 0L)
+            return jjStartNfaWithStates_0(2, 5, 8);
+         break;
+      default :
+         break;
+   }
+   return jjStartNfa_0(1, active0);
+}
+private int jjStartNfaWithStates_0(int pos, int kind, int state)
+{
+   jjmatchedKind = kind;
+   jjmatchedPos = pos;
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) { return pos + 1; }
+   return jjMoveNfa_0(state, pos + 1);
+}
+private int jjMoveNfa_0(int startState, int curPos)
+{
+   int startsAt = 0;
+   jjnewStateCnt = 9;
+   int i = 1;
+   jjstateSet[0] = startState;
+   int kind = 0x7fffffff;
+   for (;;)
+   {
+      if (++jjround == 0x7fffffff)
+         ReInitRounds();
+      if (curChar < 64)
+      {
+         long l = 1L << curChar;
+         do
+         {
+            switch(jjstateSet[--i])
+            {
+               case 4:
+                  if ((0x3ff609c00000000L & l) != 0L)
+                  {
+                     if (kind > 12)
+                        kind = 12;
+                     jjCheckNAdd(8);
+                  }
+                  else if (curChar == 58)
+                     jjstateSet[jjnewStateCnt++] = 5;
+                  if ((0x3ff000000000000L & l) != 0L)
+                  {
+                     if (kind > 6)
+                        kind = 6;
+                     jjCheckNAdd(0);
+                  }
+                  else if (curChar == 36)
+                     jjstateSet[jjnewStateCnt++] = 1;
+                  break;
+               case 0:
+                  if ((0x3ff000000000000L & l) == 0L)
+                     break;
+                  if (kind > 6)
+                     kind = 6;
+                  jjCheckNAdd(0);
+                  break;
+               case 2:
+                  if ((0x3ff609d00000000L & l) != 0L)
+                     jjAddStates(0, 1);
+                  break;
+               case 5:
+                  if (curChar == 35)
+                     jjCheckNAdd(6);
+                  break;
+               case 6:
+                  if ((0x3ff609c00000000L & l) == 0L)
+                     break;
+                  if (kind > 11)
+                     kind = 11;
+                  jjCheckNAdd(6);
+                  break;
+               case 7:
+                  if (curChar == 58)
+                     jjstateSet[jjnewStateCnt++] = 5;
+                  break;
+               case 8:
+                  if ((0x3ff609c00000000L & l) == 0L)
+                     break;
+                  if (kind > 12)
+                     kind = 12;
+                  jjCheckNAdd(8);
+                  break;
+               default : break;
             }
-            if (kind != 0x7fffffff) {
-                jjmatchedKind = kind;
-                jjmatchedPos = curPos;
-                kind = 0x7fffffff;
+         } while(i != startsAt);
+      }
+      else if (curChar < 128)
+      {
+         long l = 1L << (curChar & 077);
+         do
+         {
+            switch(jjstateSet[--i])
+            {
+               case 4:
+               case 8:
+                  if ((0x2ffffffe87fffffeL & l) == 0L)
+                     break;
+                  if (kind > 12)
+                     kind = 12;
+                  jjCheckNAdd(8);
+                  break;
+               case 1:
+                  if (curChar == 123)
+                     jjCheckNAdd(2);
+                  break;
+               case 2:
+                  if ((0x2ffffffe87fffffeL & l) != 0L)
+                     jjCheckNAddTwoStates(2, 3);
+                  break;
+               case 3:
+                  if (curChar == 125 && kind > 10)
+                     kind = 10;
+                  break;
+               case 6:
+                  if ((0x2ffffffe87fffffeL & l) == 0L)
+                     break;
+                  if (kind > 11)
+                     kind = 11;
+                  jjstateSet[jjnewStateCnt++] = 6;
+                  break;
+               default : break;
             }
-            ++curPos;
-            if ((i = jjnewStateCnt) == (startsAt = 8 - (jjnewStateCnt = startsAt)))
-                return curPos;
-            try {
-                curChar = input_stream.readChar();
-            } catch (java.io.IOException e) {
-                return curPos;
+         } while(i != startsAt);
+      }
+      else
+      {
+         int i2 = (curChar & 0xff) >> 6;
+         long l2 = 1L << (curChar & 077);
+         do
+         {
+            switch(jjstateSet[--i])
+            {
+               default : break;
             }
-        }
-    }
+         } while(i != startsAt);
+      }
+      if (kind != 0x7fffffff)
+      {
+         jjmatchedKind = kind;
+         jjmatchedPos = curPos;
+         kind = 0x7fffffff;
+      }
+      ++curPos;
+      if ((i = jjnewStateCnt) == (startsAt = 9 - (jjnewStateCnt = startsAt)))
+         return curPos;
+      try { curChar = input_stream.readChar(); }
+      catch(java.io.IOException e) { return curPos; }
+   }
+}
+static final int[] jjnextStates = {
+   2, 3, 
+};
 
-    /** Reinitialise parser. */
-    public void ReInit(SimpleCharStream stream) {
-        jjmatchedPos = jjnewStateCnt = 0;
-        curLexState = defaultLexState;
-        input_stream = stream;
-        ReInitRounds();
-    }
+/** Token literal values. */
+public static final String[] jjstrLiteralImages = {
+"", "\50", "\54", "\51", "\40", "\117\125\124", null, null, null, null, null, 
+null, null, };
 
-    private void ReInitRounds() {
-        int i;
-        jjround = 0x80000001;
-        for (i = 8; i-- > 0; )
-            jjrounds[i] = 0x80000000;
-    }
+/** Lexer state names. */
+public static final String[] lexStateNames = {
+   "DEFAULT",
+};
+protected SimpleCharStream input_stream;
+private final int[] jjrounds = new int[9];
+private final int[] jjstateSet = new int[18];
+protected char curChar;
+/** Constructor. */
+public SSPTParserTokenManager(SimpleCharStream stream){
+   if (SimpleCharStream.staticFlag)
+      throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
+   input_stream = stream;
+}
 
-    /** Reinitialise parser. */
-    public void ReInit(SimpleCharStream stream, int lexState) {
-        ReInit(stream);
-        SwitchTo(lexState);
-    }
+/** Constructor. */
+public SSPTParserTokenManager(SimpleCharStream stream, int lexState){
+   this(stream);
+   SwitchTo(lexState);
+}
 
-    /** Switch to specified lex state. */
-    public void SwitchTo(int lexState) {
-        if (lexState >= 1 || lexState < 0)
-            throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
-        else
-            curLexState = lexState;
-    }
+/** Reinitialise parser. */
+public void ReInit(SimpleCharStream stream)
+{
+   jjmatchedPos = jjnewStateCnt = 0;
+   curLexState = defaultLexState;
+   input_stream = stream;
+   ReInitRounds();
+}
+private void ReInitRounds()
+{
+   int i;
+   jjround = 0x80000001;
+   for (i = 9; i-- > 0;)
+      jjrounds[i] = 0x80000000;
+}
 
-    protected Token jjFillToken() {
-        final Token t;
-        final String curTokenImage;
-        final int beginLine;
-        final int endLine;
-        final int beginColumn;
-        final int endColumn;
-        String im = jjstrLiteralImages[jjmatchedKind];
-        curTokenImage = (im == null) ? input_stream.GetImage() : im;
-        beginLine = input_stream.getBeginLine();
-        beginColumn = input_stream.getBeginColumn();
-        endLine = input_stream.getEndLine();
-        endColumn = input_stream.getEndColumn();
-        t = Token.newToken(jjmatchedKind, curTokenImage);
+/** Reinitialise parser. */
+public void ReInit(SimpleCharStream stream, int lexState)
+{
+   ReInit(stream);
+   SwitchTo(lexState);
+}
 
-        t.beginLine = beginLine;
-        t.endLine = endLine;
-        t.beginColumn = beginColumn;
-        t.endColumn = endColumn;
+/** Switch to specified lex state. */
+public void SwitchTo(int lexState)
+{
+   if (lexState >= 1 || lexState < 0)
+      throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
+   else
+      curLexState = lexState;
+}
 
-        return t;
-    }
+protected Token jjFillToken()
+{
+   final Token t;
+   final String curTokenImage;
+   final int beginLine;
+   final int endLine;
+   final int beginColumn;
+   final int endColumn;
+   String im = jjstrLiteralImages[jjmatchedKind];
+   curTokenImage = (im == null) ? input_stream.GetImage() : im;
+   beginLine = input_stream.getBeginLine();
+   beginColumn = input_stream.getBeginColumn();
+   endLine = input_stream.getEndLine();
+   endColumn = input_stream.getEndColumn();
+   t = Token.newToken(jjmatchedKind, curTokenImage);
 
-    /** Get the next Token. */
-    public Token getNextToken() {
-        Token matchedToken;
-        int curPos = 0;
+   t.beginLine = beginLine;
+   t.endLine = endLine;
+   t.beginColumn = beginColumn;
+   t.endColumn = endColumn;
 
-        EOFLoop:
-        for (; ; ) {
-            try {
-                curChar = input_stream.BeginToken();
-            } catch (java.io.IOException e) {
-                jjmatchedKind = 0;
-                matchedToken = jjFillToken();
-                return matchedToken;
-            }
+   return t;
+}
 
-            jjmatchedKind = 0x7fffffff;
-            jjmatchedPos = 0;
-            curPos = jjMoveStringLiteralDfa0_0();
-            if (jjmatchedKind != 0x7fffffff) {
-                if (jjmatchedPos + 1 < curPos)
-                    input_stream.backup(curPos - jjmatchedPos - 1);
-                matchedToken = jjFillToken();
-                return matchedToken;
-            }
-            int error_line = input_stream.getEndLine();
-            int error_column = input_stream.getEndColumn();
-            String error_after = null;
-            boolean EOFSeen = false;
-            try {
-                input_stream.readChar();
-                input_stream.backup(1);
-            } catch (java.io.IOException e1) {
-                EOFSeen = true;
-                error_after = curPos <= 1 ? "" : input_stream.GetImage();
-                if (curChar == '\n' || curChar == '\r') {
-                    error_line++;
-                    error_column = 0;
-                } else
-                    error_column++;
-            }
-            if (!EOFSeen) {
-                input_stream.backup(1);
-                error_after = curPos <= 1 ? "" : input_stream.GetImage();
-            }
-            throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
-        }
-    }
+int curLexState = 0;
+int defaultLexState = 0;
+int jjnewStateCnt;
+int jjround;
+int jjmatchedPos;
+int jjmatchedKind;
+
+/** Get the next Token. */
+public Token getNextToken() 
+{
+  Token matchedToken;
+  int curPos = 0;
 
-    private void jjCheckNAdd(int state) {
-        if (jjrounds[state] != jjround) {
-            jjstateSet[jjnewStateCnt++] = state;
-            jjrounds[state] = jjround;
-        }
-    }
+  EOFLoop :
+  for (;;)
+  {
+   try
+   {
+      curChar = input_stream.BeginToken();
+   }
+   catch(java.io.IOException e)
+   {
+      jjmatchedKind = 0;
+      matchedToken = jjFillToken();
+      return matchedToken;
+   }
 
-    private void jjAddStates(int start, int end) {
-        do {
-            jjstateSet[jjnewStateCnt++] = jjnextStates[start];
-        } while (start++ != end);
-    }
+   jjmatchedKind = 0x7fffffff;
+   jjmatchedPos = 0;
+   curPos = jjMoveStringLiteralDfa0_0();
+   if (jjmatchedKind != 0x7fffffff)
+   {
+      if (jjmatchedPos + 1 < curPos)
+         input_stream.backup(curPos - jjmatchedPos - 1);
+         matchedToken = jjFillToken();
+         return matchedToken;
+   }
+   int error_line = input_stream.getEndLine();
+   int error_column = input_stream.getEndColumn();
+   String error_after = null;
+   boolean EOFSeen = false;
+   try { input_stream.readChar(); input_stream.backup(1); }
+   catch (java.io.IOException e1) {
+      EOFSeen = true;
+      error_after = curPos <= 1 ? "" : input_stream.GetImage();
+      if (curChar == '\n' || curChar == '\r') {
+         error_line++;
+         error_column = 0;
+      }
+      else
+         error_column++;
+   }
+   if (!EOFSeen) {
+      input_stream.backup(1);
+      error_after = curPos <= 1 ? "" : input_stream.GetImage();
+   }
+   throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
+  }
+}
 
-    private void jjCheckNAddTwoStates(int state1, int state2) {
-        jjCheckNAdd(state1);
-        jjCheckNAdd(state2);
-    }
+private void jjCheckNAdd(int state)
+{
+   if (jjrounds[state] != jjround)
+   {
+      jjstateSet[jjnewStateCnt++] = state;
+      jjrounds[state] = jjround;
+   }
+}
+private void jjAddStates(int start, int end)
+{
+   do {
+      jjstateSet[jjnewStateCnt++] = jjnextStates[start];
+   } while (start++ != end);
+}
+private void jjCheckNAddTwoStates(int state1, int state2)
+{
+   jjCheckNAdd(state1);
+   jjCheckNAdd(state2);
+}
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/b3196ee5/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/grammar/sspt.jj
----------------------------------------------------------------------
diff --git a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/grammar/sspt.jj b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/grammar/sspt.jj
index 617d24a..ab483b5 100644
--- a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/grammar/sspt.jj
+++ b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/grammar/sspt.jj
@@ -64,42 +64,41 @@ Object Parameter() :
 
 InputParameter InputParameter() :
 {
-     String sqlTypeAsStr;
+     Token sqlTypeToken;
      String name;
      Token valueSrcToken;
 }
 {
-    (sqlTypeAsStr = ParameterSqlType() " " valueSrcToken =
+    (sqlTypeToken = ParameterSqlType() " " valueSrcToken =
     InputParameterSrc())
     {
-        int sqlType = ParseHelper.parseSqlType(sqlTypeAsStr);
-        return new InputParameter(createNextParameterName(),sqlType,valueSrcToken,ParseHelper.sqlTypeToJavaType(sqlType,
-        sqlTypeAsStr));
+        int sqlType = ParseHelper.parseSqlType(sqlTypeToken);
+        return new InputParameter(createNextParameterName(),sqlType,valueSrcToken);
     }
 }
 
 OutParameter OutParameter() :
 {
-     String sqlType;
+     Token sqlTypeToken;
      String name;
-     String outHeader;
+     String outValueMapKey;
 }
 {
-    ("OUT" " " sqlType = ParameterSqlType() " " outHeader =
+    ("OUT" " " sqlTypeToken = ParameterSqlType() " " outValueMapKey =
     OutHeader())
     {
-        return new OutParameter(createNextParameterName(),ParseHelper.parseSqlType(sqlType),outHeader);
+        return new OutParameter(createNextParameterName(),ParseHelper.parseSqlType(sqlTypeToken),outValueMapKey);
     }
 }
 
-String ParameterSqlType():
+Token ParameterSqlType():
 {
     Token t;
 }
 {
-    (t = <IDENTIFIER>)
+    (t = <NUMBER> | t = <IDENTIFIER>)
     {
-        return t.toString();
+        return t;
     }
 }
 
@@ -131,6 +130,11 @@ Token InputParameterSrc():
 }
 
 TOKEN: {
+    <NUMBER: (["0"-"9"])+>
+}
+
+
+TOKEN: {
     <#DIGIT: (["0"-"9"])>
 }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/b3196ee5/components/camel-sql/src/test/java/org/apache/camel/component/sql/stored/ParserTest.java
----------------------------------------------------------------------
diff --git a/components/camel-sql/src/test/java/org/apache/camel/component/sql/stored/ParserTest.java b/components/camel-sql/src/test/java/org/apache/camel/component/sql/stored/ParserTest.java
index ffd92fb..d9e8810 100644
--- a/components/camel-sql/src/test/java/org/apache/camel/component/sql/stored/ParserTest.java
+++ b/components/camel-sql/src/test/java/org/apache/camel/component/sql/stored/ParserTest.java
@@ -61,12 +61,12 @@ public class ParserTest extends CamelTestSupport {
         InputParameter param3 = (InputParameter) template.getParameterList().get(2);
         Assert.assertEquals("_2", param3.getName());
         Assert.assertEquals(Types.BIGINT, param3.getSqlType());
-        Assert.assertEquals(2L, param3.getValueExtractor().eval(exchange, null));
+        Assert.assertEquals(BigInteger.valueOf(2L), param3.getValueExtractor().eval(exchange, null));
 
         OutParameter sptpOutputNode = (OutParameter) template.getParameterList().get(3);
         Assert.assertEquals("_3", sptpOutputNode.getName());
         Assert.assertEquals(Types.INTEGER, sptpOutputNode.getSqlType());
-        Assert.assertEquals("header1", sptpOutputNode.getOutHeader());
+        Assert.assertEquals("header1", sptpOutputNode.getOutValueMapKey());
     }
 
     @Test(expected = ParseRuntimeException.class)
@@ -91,6 +91,19 @@ public class ParserTest extends CamelTestSupport {
     }
 
     @Test
+    public void vendorSpeficSqlType() {
+        Template template = parser.parseTemplate("ADDNUMBERS2(1342 ${${header.body}})");
+        assertEquals(1342, ((InputParameter) template.getParameterList().get(0)).getSqlType());
+    }
+
+    @Test
+    public void vendorSpeficSqlTypeOut() {
+        Template template = parser.parseTemplate("ADDNUMBERS2(OUT 1342 h1)");
+        assertEquals(1342, ((OutParameter) template.getParameterList().get(0)).getSqlType());
+    }
+
+
+    @Test
     public void nableIssueSyntax() {
         Map params = new HashMap<>();
         params.put("P_STR_IN", "a");


Mime
View raw message