Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News SQLite WinRT Wrapper with Lightweight APIs

SQLite WinRT Wrapper with Lightweight APIs

This item in japanese

SQLite WinRT Wrapper for Windows Phone 8 provides an ability to access the SQLite database functionality using lightweight Windows Runtime (WinRT) APIs. The wrapper provides functions for various database actions as listed below

The above mentioned operations follow the async pattern that means they perform operations on a worker thread, which helps make your database apps fast and fluid. The wrapper also provide support for exception based programming and is mainly designed to provide a very thin wrapper over the SQLite functionality.

SQLite WinRT wrapper also supports collection-based access to the returned result, but it's not enabled by default because it slows down processing and returns all columns as strings. In order to make use of this feature, you should call EnableColumnsProperty() method.\

var statement = await db.PrepareStatementAsync("SELECT rowid, CityName FROM Cities;");

In order to fix the problems associated with read only databases, you can either make use of temp_store pragma to force SQLite to use in-memory temporary tables and indices or copy the database from the install folder to the isolated storage folder on the first run of your app. While the first option is the easy to use, the second option uses more disk space and will take little time to initiate the first boot. However, you will not notice any undue delay if the database file is small. \

"Another feature that needs to be avoided with read-only databases is the journal_mode pragma with a value of WAL (write-ahead logging)," said Peter Torr, Program Manager, Windows Phone Developer Platform.

Rate this Article