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 2014/07/11 12:12:39 UTC
[2/3] git commit: CAMEL-7595: camel-jdbc should preserve headers
first so new headers can be updated from the jdbc result such as update
count.
CAMEL-7595: camel-jdbc should preserve headers first so new headers can be updated from the jdbc result such as update count.
Conflicts:
components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcProducer.java
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/35eaf11d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/35eaf11d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/35eaf11d
Branch: refs/heads/camel-2.13.x
Commit: 35eaf11d3a354eb48469ce50f19a45a9b85895b3
Parents: be3f666
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Jul 11 12:10:18 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Jul 11 12:11:56 2014 +0200
----------------------------------------------------------------------
.../java/org/apache/camel/component/jdbc/JdbcProducer.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/35eaf11d/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcProducer.java b/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcProducer.java
index d573587..0446fb7 100644
--- a/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcProducer.java
+++ b/components/camel-jdbc/src/main/java/org/apache/camel/component/jdbc/JdbcProducer.java
@@ -67,8 +67,6 @@ public class JdbcProducer extends DefaultProducer {
} else {
processingSqlWithoutSettingAutoCommit(exchange);
}
- // populate headers
- exchange.getOut().getHeaders().putAll(exchange.getIn().getHeaders());
}
private void processingSqlBySettingAutoCommit(Exchange exchange) throws Exception {
@@ -141,6 +139,9 @@ public class JdbcProducer extends DefaultProducer {
setResultSet(exchange, rs);
} else {
int updateCount = ps.getUpdateCount();
+ // preserve headers
+ exchange.getOut().getHeaders().putAll(exchange.getIn().getHeaders());
+ // and then set the new header
exchange.getOut().setHeader(JdbcConstants.JDBC_UPDATE_COUNT, updateCount);
}
} finally {
@@ -262,6 +263,9 @@ public class JdbcProducer extends DefaultProducer {
* Sets the result from the ResultSet to the Exchange as its OUT body.
*/
protected void setResultSet(Exchange exchange, ResultSet rs) throws SQLException {
+ // preserve headers
+ exchange.getOut().getHeaders().putAll(exchange.getIn().getHeaders());
+
JdbcOutputType outputType = getEndpoint().getOutputType();
if (outputType == JdbcOutputType.SelectList) {