AechoLiu
AechoLiu

Reputation: 18428

Is sqlite db file available under any platform?

For example, can I generate a SQLite db file and put it as a resource in the project. When the project first launches, copy the db into isolated storage without worrying this db file may be unavailable in the phone. Furthermore, can I copy this empty db file into another platform, like android or iPhone, and operate this db by in SQLite api of the platform.

Upvotes: 3

Views: 981

Answers (4)

The SQLite version is compatible with Android - iOS - WindowsPhone as far I have experimented. I have created SQLite DB on a Mac Desktop and copied it into projects along with data into each of these platforms. Everything worked fine no issues.

Ref:

http://www.sqlite.org/download.html

Precompiled Binaries for Windows Phone 8

sqlite-wp80-winrt-3071502.vsix (2.72 MiB)

A complete VSIX package with an extension SDK and all other components needed to use SQLite for application development with Visual Studio 2012 targeting Windows Phone 8.0. (sha1: 4cab3fd698402bf30448c64e39001103c10ff82b)

The download page itself lists the entire code and binaries for different platforms. Using a PC/Mac for creating a DB is convenient option.

You can use SQLite manager for doing so on a Windows or Linux PC.

SQLite Manager (Preferred by Myself)

http://sqliteman.com/

There are also extensions for Chrome and Firefox, which makes SQLite Available for almost any platform to Manage them.

Firefox Plugin for managing those files. https://code.google.com/p/sqlite-manager/

codev.it also allows to enable editing SQLite Files.

As far as DB is concerned, Exporting them from the device is as described by @Jon Skeet

SQLite 3.7 is more compatible with Windows Phone. Since SQLite DBs are backward compatible, there isn't any need to worry weather your DB works on older 2.x version or 3.x..

Hope this helps.

Upvotes: 1

nkchandra
nkchandra

Reputation: 5557

@Bhuro As you want a detailed procedure for using SQLite db in a Windows Phone 7 app, Here is a good post Native Database Programming via Sqlite Client for Windows Phone.

I have successfully followed the same process in my WP app. Try that and let me know if you get any doubt.

Good luck !!

Upvotes: 0

Jon Skeet
Jon Skeet

Reputation: 1503120

From the SQLite web site:

A database in SQLite is a single disk file. Furthermore, the file format is cross-platform. A database that is created on one machine can be copied and used on a different machine with a different architecture. SQLite databases are portable across 32-bit and 64-bit machines and between big-endian and little-endian architectures.

So yes, when you've validated that the SQLite API is available everywhere you want to use it, that should be fine as a storage format.

EDIT: And yes, SQLite does work on Windows Phone 7, using this Codeplex project or this one.

Upvotes: 12

theChrisKent
theChrisKent

Reputation: 15099

Yes. We are using the same SQLite database in an iOS, Android and WP7 app. I've written a quick start guide here: http://wirebear.com/blog/2010/11/12/using-sqlite-in-your-wp7-app

The above blog post covers copying your database from your resources to isolated storage and correctly configuring SQLite to work on your device.

Upvotes: 3

Related Questions