You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/04/30 10:53:58 UTC

[3/3] camel git commit: CAMEL-9805: camel-sql - body not copied from in to out when useing outputHeader and outputType=SelectOne when sql doesn't return a result. Same fix for camel-elsql

CAMEL-9805: camel-sql - body not copied from in to out when useing outputHeader and outputType=SelectOne when sql doesn't return a result. Same fix for camel-elsql


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

Branch: refs/heads/camel-2.16.x
Commit: 3971a368b64a3ed3c3295a9804f6dc1205c5562e
Parents: 09f47bc
Author: Claus Ibsen <da...@apache.org>
Authored: Sat Apr 30 10:52:31 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Sat Apr 30 10:53:47 2016 +0200

----------------------------------------------------------------------
 .../java/org/apache/camel/component/elsql/ElsqlProducer.java  | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/3971a368/components/camel-elsql/src/main/java/org/apache/camel/component/elsql/ElsqlProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-elsql/src/main/java/org/apache/camel/component/elsql/ElsqlProducer.java b/components/camel-elsql/src/main/java/org/apache/camel/component/elsql/ElsqlProducer.java
index 78d0d2e..6cd236b 100644
--- a/components/camel-elsql/src/main/java/org/apache/camel/component/elsql/ElsqlProducer.java
+++ b/components/camel-elsql/src/main/java/org/apache/camel/component/elsql/ElsqlProducer.java
@@ -102,6 +102,13 @@ public class ElsqlProducer extends DefaultProducer {
                                     exchange.getOut().setBody(data);
                                 }
                                 exchange.getOut().setHeader(SqlConstants.SQL_ROW_COUNT, 1);
+                            } else {
+                                if (getEndpoint().isNoop()) {
+                                    exchange.getOut().setBody(exchange.getIn().getBody());
+                                } else if (getEndpoint().getOutputHeader() != null) {
+                                    exchange.getOut().setBody(exchange.getIn().getBody());
+                                }
+                                exchange.getOut().setHeader(SqlConstants.SQL_ROW_COUNT, 0);
                             }
                         } else {
                             throw new IllegalArgumentException("Invalid outputType=" + outputType);