DBQueries { public static void suspendSyncAndJournaling(final Connection connection){ setSyncAndJournaling(connection, SQLiteConfig.SynchronousMode.OFF, SQLiteConfig.JournalMode.OFF); }  static void createIndexTable(final String tableName, final Class<K> objectKeyClass, final Class<A> valueClass, final Connection connection); static boolean indexTableExists(final String tableName, final Connection connection); static void createIndexOnTable(final String tableName, final Connection connection); static void suspendSyncAndJournaling(final Connection connection); static void setSyncAndJournaling(final Connection connection, final SQLiteConfig.SynchronousMode pragmaSynchronous, final SQLiteConfig.JournalMode pragmaJournalMode); static SQLiteConfig.SynchronousMode getPragmaSynchronousOrNull(final Connection connection); static SQLiteConfig.JournalMode getPragmaJournalModeOrNull(final Connection connection); static void dropIndexOnTable(final String tableName, final Connection connection); static void dropIndexTable(final String tableName, final Connection connection); static void clearIndexTable(final String tableName, final Connection connection); static void compactDatabase(final Connection connection); static void expandDatabase(final Connection connection, long numBytes); static long getDatabaseSize(final Connection connection); static int bulkAdd(Iterable<Row<K, A>> rows, final String tableName, final Connection connection); static int bulkRemove(Iterable<K> objectKeys, final String tableName, final Connection connection); static int count(final Query<O> query, final String tableName, final Connection connection); static int countDistinct(final Query<O> query, final String tableName, final Connection connection); static java.sql.ResultSet search(final Query<O> query, final String tableName, final Connection connection); static java.sql.ResultSet getDistinctKeys(final Query<O> query, boolean descending, final String tableName, final Connection connection); static java.sql.ResultSet getKeysAndValues(final Query<O> query, boolean descending, final String tableName, final Connection connection); static int getCountOfDistinctKeys(final String tableName, final Connection connection); static java.sql.ResultSet getDistinctKeysAndCounts(boolean sortByKeyDescending, final String tableName, final Connection connection); static java.sql.ResultSet getAllIndexEntries(final String tableName, final Connection connection); static java.sql.ResultSet getIndexEntryByObjectKey(final K key , final String tableName, final Connection connection); static boolean contains(final K objectKey, final Query<O> query, final String tableName, final Connection connection);  }
@Test public void suspendSyncAndJournaling() throws Exception { Connection connection = null; try { ConnectionManager connectionManager = temporaryFileDatabase.getConnectionManager(true); connection = connectionManager.getConnection(null, noQueryOptions()); final SQLiteConfig.JournalMode journalMode = DBQueries.getPragmaJournalModeOrNull(connection); final SQLiteConfig.SynchronousMode synchronousMode = DBQueries.getPragmaSynchronousOrNull(connection); DBQueries.suspendSyncAndJournaling(connection); final SQLiteConfig.JournalMode journalModeDisabled = DBQueries.getPragmaJournalModeOrNull(connection); final SQLiteConfig.SynchronousMode synchronousModeDisabled = DBQueries.getPragmaSynchronousOrNull(connection); Assert.assertEquals(journalModeDisabled, SQLiteConfig.JournalMode.OFF); Assert.assertEquals(synchronousModeDisabled, SQLiteConfig.SynchronousMode.OFF); DBQueries.setSyncAndJournaling(connection, SQLiteConfig.SynchronousMode.FULL, SQLiteConfig.JournalMode.DELETE); final SQLiteConfig.JournalMode journalModeReset = DBQueries.getPragmaJournalModeOrNull(connection); final SQLiteConfig.SynchronousMode synchronousModeReset = DBQueries.getPragmaSynchronousOrNull(connection); Assert.assertEquals(journalModeReset, journalMode); Assert.assertEquals(synchronousModeReset, synchronousMode); }finally { DBUtils.closeQuietly(connection); } }