- ResultSet rs = conn.prepareStatement("select uidvalidity from uidvalidity").executeQuery();
- if (!rs.next()) {
- this.uidValidity = new Random().nextInt();
- PreparedStatement ps = conn.prepareStatement("insert into uidvalidity (uidvalidity) values (?)");
- ps.setInt(1, uidValidity);
- ps.executeUpdate();
- } else {
- this.uidValidity = rs.getInt(1);
- }
- conn.prepareStatement("create table if not exists 'mail' ("+columns_+")").executeUpdate();
- for(String name : indexedColumns)
- conn.prepareStatement("create index if not exists "+name+"index on mail("+name+");").executeUpdate();
+ try {
+ rs = conn.prepareStatement("select uidvalidity from uidvalidity").executeQuery();
+ if (!rs.next()) {
+ this.uidValidity = new Random().nextInt();
+ PreparedStatement ps = conn.prepareStatement("insert into uidvalidity (uidvalidity) values (?)");
+ ps.setInt(1, uidValidity);
+ ps.executeUpdate();
+ } else {
+ this.uidValidity = rs.getInt(1);
+ }
+ conn.prepareStatement("create table if not exists 'mail' ("+columns_+")").executeUpdate();
+ for(String name : indexedColumns)
+ conn.prepareStatement("create index if not exists "+name+"index on mail("+name+");").executeUpdate();
+ } finally { db.close(rs); }