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.
This commit is contained in:
Justin Bertram 2019-04-22 20:46:02 -05:00 committed by Clebert Suconic
parent 838651ce62
commit b4ce3305bf
1 changed files with 6 additions and 2 deletions

View File

@ -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();