You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2019/05/13 10:22:17 UTC
[camel] branch master updated (e4f5b35 -> b4ccf59)
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.
from e4f5b35 Fixed CS
new f9182bc CAMEL-13506 - Camel-SQL: JDBC Aggregation repository support OID Postgresql as exchange column data type
new b4ccf59 CAMEL-13506 - Fixed CS
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../aggregate/jdbc/JdbcAggregationRepository.java | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
[camel] 02/02: CAMEL-13506 - Fixed CS
Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit b4ccf59a57de97bac7be90f6acc7d4018d2fbb57
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon May 13 12:21:55 2019 +0200
CAMEL-13506 - Fixed CS
---
.../aggregate/jdbc/JdbcAggregationRepository.java | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/components/camel-sql/src/main/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepository.java b/components/camel-sql/src/main/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepository.java
index 4977b80..09c440f 100644
--- a/components/camel-sql/src/main/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepository.java
+++ b/components/camel-sql/src/main/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepository.java
@@ -289,16 +289,15 @@ public class JdbcAggregationRepository extends ServiceSupport implements Recover
return transactionTemplateReadOnly.execute(new TransactionCallback<Exchange>() {
public Exchange doInTransaction(TransactionStatus status) {
try {
- String sql = "SELECT " + EXCHANGE + " FROM " + repositoryName + " WHERE " + ID + " = ?";
- ByteArrayOutputStream bis = new ByteArrayOutputStream();
- jdbcTemplate.query(sql, new Object[]{key},
- new AbstractLobStreamingResultSetExtractor() {
- @Override
- protected void streamData(ResultSet rs) throws SQLException, IOException, DataAccessException {
- FileCopyUtils.copy(getLobHandler().getBlobAsBinaryStream(rs, EXCHANGE), bis);
- }
- });
- return codec.unmarshallExchange(camelContext, bis.toByteArray());
+ String sql = "SELECT " + EXCHANGE + " FROM " + repositoryName + " WHERE " + ID + " = ?";
+ ByteArrayOutputStream bis = new ByteArrayOutputStream();
+ jdbcTemplate.query(sql, new Object[] {key}, new AbstractLobStreamingResultSetExtractor<Object>() {
+ @Override
+ protected void streamData(ResultSet rs) throws SQLException, IOException, DataAccessException {
+ FileCopyUtils.copy(getLobHandler().getBlobAsBinaryStream(rs, EXCHANGE), bis);
+ }
+ });
+ return codec.unmarshallExchange(camelContext, bis.toByteArray());
} catch (EmptyResultDataAccessException ex) {
return null;
} catch (IOException ex) {
[camel] 01/02: CAMEL-13506 - Camel-SQL: JDBC Aggregation repository
support OID Postgresql as exchange column data type
Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit f9182bcf2148a5a3aad7425c8cdc9157566de8b2
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri May 10 17:17:23 2019 +0200
CAMEL-13506 - Camel-SQL: JDBC Aggregation repository support OID Postgresql as exchange column data type
---
.../aggregate/jdbc/JdbcAggregationRepository.java | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/components/camel-sql/src/main/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepository.java b/components/camel-sql/src/main/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepository.java
index 4fb4962..4977b80 100644
--- a/components/camel-sql/src/main/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepository.java
+++ b/components/camel-sql/src/main/java/org/apache/camel/processor/aggregate/jdbc/JdbcAggregationRepository.java
@@ -16,6 +16,7 @@
*/
package org.apache.camel.processor.aggregate.jdbc;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -35,10 +36,12 @@ import org.apache.camel.support.service.ServiceSupport;
import org.apache.camel.util.ObjectHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.dao.DataAccessException;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.support.AbstractLobCreatingPreparedStatementCallback;
+import org.springframework.jdbc.core.support.AbstractLobStreamingResultSetExtractor;
import org.springframework.jdbc.support.lob.DefaultLobHandler;
import org.springframework.jdbc.support.lob.LobCreator;
import org.springframework.jdbc.support.lob.LobHandler;
@@ -48,6 +51,7 @@ import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallback;
import org.springframework.transaction.support.TransactionCallbackWithoutResult;
import org.springframework.transaction.support.TransactionTemplate;
+import org.springframework.util.FileCopyUtils;
/**
* JDBC based {@link org.apache.camel.spi.AggregationRepository}
@@ -285,10 +289,16 @@ public class JdbcAggregationRepository extends ServiceSupport implements Recover
return transactionTemplateReadOnly.execute(new TransactionCallback<Exchange>() {
public Exchange doInTransaction(TransactionStatus status) {
try {
- final byte[] data = jdbcTemplate.queryForObject(
- "SELECT " + EXCHANGE + " FROM " + repositoryName + " WHERE " + ID + " = ?",
- new Object[]{key}, byte[].class);
- return codec.unmarshallExchange(camelContext, data);
+ String sql = "SELECT " + EXCHANGE + " FROM " + repositoryName + " WHERE " + ID + " = ?";
+ ByteArrayOutputStream bis = new ByteArrayOutputStream();
+ jdbcTemplate.query(sql, new Object[]{key},
+ new AbstractLobStreamingResultSetExtractor() {
+ @Override
+ protected void streamData(ResultSet rs) throws SQLException, IOException, DataAccessException {
+ FileCopyUtils.copy(getLobHandler().getBlobAsBinaryStream(rs, EXCHANGE), bis);
+ }
+ });
+ return codec.unmarshallExchange(camelContext, bis.toByteArray());
} catch (EmptyResultDataAccessException ex) {
return null;
} catch (IOException ex) {