Quantcast
Channel: sqlwinrt Wiki Rss Feed
Viewing all articles
Browse latest Browse all 9

Updated Wiki: Home

$
0
0

Project Description
SQLite wrapper for WinRT

The SQLite WinRT wrapper offers lightweight Windows Runtime (WinRT) APIs you can use to access the most common SQLite database functionality. The latest update of the library supports Windows Phone 8 development in addition to Windows 8 development.

This project does not have a binary download; to use the component, download the source code and add the WinRT component project to your solution.

To use the Component

Download the source code and add the project for Windows 8 or Windows Phone 8 as appropriate to your solution to begin accessing SQLite databases in your Windows Phone 8 apps.

Important: You must also install the SQLite for Windowsand/or SQLite for Windows Phone Extension SDK from the Visual Studio Extensions and Updates option on the Tools menu.

Supported functionality

The WinRT API gives you a familiar programming model for implementing the following basic operations:

All operations follow the async pattern– they perform operations on a worker thread, which helps make your database apps fast and fluid. The wrapper also supports exception-based programming, so you don’t need to check the return value from every method call. Note that the API doesn’t support all of the advanced features of SQLite, nor does it attempt to hide the underlying SQL statements, untyped result sets, and so on. It’s designed to provide a very thin wrapper over the SQLite functionality that many people already know and love, rather than to provide an equivalent programming model to LINQ-to-SQL or ADO.NET.

For more information, see the following blog post: SQLite WinRT wrapper for Windows Phone


Example (C#): 

asyncvoid AddToItemsCollection()

{

  // Get the file from the install location

  var file = awaitPackage.Current.InstalledLocation.GetFileAsync("cities.db");

 

  // Create a new SQLite instance for the file

  var db = newDatabase(file);

 

  // Open the database asynchronously

  await db.OpenAsync(SqliteOpenMode.OpenRead);

 

  // Prepare a SQL statement to be executed

  var statement = await db.PrepareStatementAsync(

    "SELECT rowid, CityName FROM Cities;");

 

  // Loop through all the results and add to the collection

  while (await statement.StepAsync())

    items.Add(statement.GetIntAt(0) + ": "+ statement.GetTextAt(1));

}

  

 


Viewing all articles
Browse latest Browse all 9

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>