This is an automated email from the ASF dual-hosted git repository.

clebertsuconic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git


The following commit(s) were added to refs/heads/master by this push:
     new b4ce330  ARTEMIS-2296 PgResultSet.updateBlob not implemented
     new c5aa5fa  This closes #2636
b4ce330 is described below

commit b4ce3305bfc2b0a6ee88d0083aed5d7d6eaf586f
Author: Justin Bertram <[email protected]>
AuthorDate: Mon Apr 22 20:46:02 2019 -0500

    ARTEMIS-2296 PgResultSet.updateBlob not implemented
    
    There is no test for this as we don't have a way to embed/test Postgres.
    It will need to be verified externally. However, given the exception the
    fix looks solid.
---
 .../jdbc/store/file/PostgresSequentialSequentialFileDriver.java   | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/PostgresSequentialSequentialFileDriver.java
 
b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/PostgresSequentialSequentialFileDriver.java
index 85d4813..3c68781 100644
--- 
a/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/PostgresSequentialSequentialFileDriver.java
+++ 
b/artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/PostgresSequentialSequentialFileDriver.java
@@ -107,7 +107,7 @@ public final class PostgresSequentialSequentialFileDriver 
extends JDBCSequential
    }
 
    @Override
-   public int writeToFile(JDBCSequentialFile file, byte[] data) throws 
SQLException {
+   public int writeToFile(JDBCSequentialFile file, byte[] data, boolean 
append) throws SQLException {
       synchronized (connection) {
          LargeObjectManager lobjManager = ((PGConnection) 
connection).getLargeObjectAPI();
          LargeObject largeObject = null;
@@ -116,7 +116,11 @@ public final class PostgresSequentialSequentialFileDriver 
extends JDBCSequential
          try {
             connection.setAutoCommit(false);
             largeObject = lobjManager.open(oid, LargeObjectManager.WRITE);
-            largeObject.seek(largeObject.size());
+            if (append) {
+               largeObject.seek(largeObject.size());
+            } else {
+               largeObject.truncate(0);
+            }
             largeObject.write(data);
             largeObject.close();
             connection.commit();

Reply via email to