Mercurial Hosting > luan
changeset 1428:d21a7cf8fa9e
fix postgres check
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 24 Nov 2019 21:02:38 -0700 |
parents | a076e89a2879 |
children | 82415c9c0015 |
files | src/luan/modules/lucene/PostgresBackup.java |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/luan/modules/lucene/PostgresBackup.java Sun Nov 24 18:23:57 2019 -0700 +++ b/src/luan/modules/lucene/PostgresBackup.java Sun Nov 24 21:02:38 2019 -0700 @@ -200,6 +200,15 @@ Checker() throws SQLException { con = newConnection(); con.setAutoCommit(false); + con.setReadOnly(true); + con.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE); + + // hack to capture data in transaction + Statement stmt = con.createStatement(); + ResultSet rs = stmt.executeQuery("select 'x' from lucene"); + while(rs.next()); + stmt.close(); + pstmt = con.prepareStatement( "select data from lucene where id=?" );