public interface

SQLiteCheckpointListener

com.tencent.wcdb.database.SQLiteCheckpointListener
Known Indirect Subclasses

Class Overview

A listener for WAL checkpointing.

Summary

Public Methods
abstract void onAttach(SQLiteDatabase db)
Called immediately when this listener is set to the database.
abstract void onDetach(SQLiteDatabase db)
Called immediately when this listener is detached from the database.
abstract void onWALCommit(SQLiteDatabase db, String dbName, int pages)
Called immediately when a WAL transaction has been committed.

Public Methods

public abstract void onAttach (SQLiteDatabase db)

Called immediately when this listener is set to the database. Initialization codes can be placed here, if any.

Parameters
db database object to be attached

public abstract void onDetach (SQLiteDatabase db)

Called immediately when this listener is detached from the database. Cleanup codes can be placed here, if any.

Parameters
db database object to be detached from

public abstract void onWALCommit (SQLiteDatabase db, String dbName, int pages)

Called immediately when a WAL transaction has been committed.

The implementation should checkpoint the database according to its strategy by executing SQL PRAGMA wal_checkpoint; or something alike. Failing to do this will result in unlimited growing WAL file and may degrade performance.

Parameters
db database object whose transaction is committed
dbName attached database name of the committed transaction, or "main" for the main database
pages number of frames in the WAL file after commit