comparison src/luan/modules/lucene/PostgresBackup.java @ 1453:928be2a4d565

fix postgres backup
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 02 Mar 2020 15:09:10 -0700
parents 851b9a48cc44
children 219f2b937f2b
comparison
equal deleted inserted replaced
1452:c15444f4da05 1453:928be2a4d565
156 throw new LuanException("rollback failed trans="+trans); 156 throw new LuanException("rollback failed trans="+trans);
157 con.rollback(); 157 con.rollback();
158 con.setAutoCommit(true); 158 con.setAutoCommit(true);
159 } 159 }
160 160
161 void restoreLucene(LuceneIndex li) 161 void restoreLucene(LuceneIndex li,LuanFunction completer)
162 throws LuanException, IOException, SQLException, ParseException 162 throws LuanException, IOException, SQLException, ParseException
163 { 163 {
164 Luan luan = new Luan(); 164 Luan luan = new Luan();
165 Statement stmt = con.createStatement(); 165 Statement stmt = con.createStatement();
166 ResultSet rs = stmt.executeQuery("select data from lucene"); 166 ResultSet rs = stmt.executeQuery("select data from lucene");
167 while( rs.next() ) { 167 while( rs.next() ) {
168 String data = rs.getString("data"); 168 String data = rs.getString("data");
169 LuanTable doc = (LuanTable)LuanParser.parse(luan,data); 169 LuanTable doc = (LuanTable)LuanParser.parse(luan,data);
170 li.restore(doc); 170 li.restore(completer,doc);
171 } 171 }
172 stmt.close(); 172 stmt.close();
173 } 173 }
174 174
175 long maxId() 175 long maxId()