final File createFile = File.createTempFile(SCHEMA_TEST, null);
if (DELETE_COPY)
createFile.deleteOnExit();
final SqlJetDb createDb = SqlJetDb.open(createFile, true);
createDb.getOptions().setAutovacuum(true);
createDb.getOptions().setIncrementalVacuum(true);
createDb.runWriteTransaction(new ISqlJetTransaction() {
public Object run(SqlJetDb db) throws SqlJetException {
final ISqlJetTableDef createTable = db
.createTable("create table test( id integer primary key, name text )");
logger.info(createTable.toString());
db.createIndex("CREATE INDEX test_index ON test(name);");
final ISqlJetTable openTable = createDb.getTable(createTable.getName());
openTable.insert(null, "test");
openTable.insert(null, "test1");
try {
openTable.insert(null, new String(TEST_UTF8, "UTF8"));
} catch (UnsupportedEncodingException e) {
throw new SqlJetException(e);
}
return null;
}
});
createDb.close();
final SqlJetDb checkDb = SqlJetDb.open(createFile, true);
Assert.assertTrue(checkDb.getOptions().isAutovacuum());
Assert.assertTrue(checkDb.getOptions().isIncrementalVacuum());
checkDb.close();
SqlJetFileUtil.deleteFile(createFile);
}