2

I am new to Sqlite. This what I understand so far.

Please help to confirm my understanding. 1) Sqlite engine is built into the Android-OS System

so, I dont need to download and install this Sqlite engine from its website.

Now, I have these questions :

2) If I include a Sqlite Database( With data in it) in the Project, Do I need to read ( use memorystream to read into a buffer, this is based on WP on SlqCe ) it INTO the folder or directory under the Sqlite engine?

3) Is there any tutorial on Create table, Add, Insert, update for Sqlite, setUp relationship

4) Is referential integrity supported? Like If I delete the Primary Key , all the Foreign Key will be deleted as well.

Thanks

MilkBottle
  • 4,242
  • 13
  • 64
  • 146
  • http://stackoverflow.com/questions/4938867/need-an-example-of-sqlite-with-monodroid – Mohib Sheth Jul 18 '13 at 05:03
  • Thanks for the link. Have this question. Where to store the Sqlite DB with data in the Project. I saw this Environment.GetFolderPath ( Environment.SpecialFolder.Personal), What is SpecialFolder ? It is created by user or system folder? Thanks – MilkBottle Jul 18 '13 at 13:42
  • Its nothing but the user's "My Documents" folder and is created by the system. – Mohib Sheth Jul 19 '13 at 05:00

2 Answers2

0

One application which has helped me greatly in building SQLite Databases is this
SQLite Expert, http://www.sqliteexpert.com/ which is a standalone piece of sofware with a GUI which you can design the databases with and then produce the SQL code to produce the database.

The thing about setting up a Database is you need to create a class from the Android.Database.Sqlite.SQLiteOpenHelper object and override the OnCreate(SQLiteDatabase db) and OnUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) methods. It is then up to you to write your insert methods and so forth.

Good Luck, James.

Druid
  • 6,423
  • 4
  • 41
  • 56
James Cobold
  • 101
  • 1
  • 1
0

Refer this sample project : https://github.com/Vaikesh/Android-Quiz

I think you ca enforce referential integrity in SQLite with Triggers.

Tutorial on about SQLite : http://www.grokkingandroid.com/sqlite-in-android/

Yksh
  • 3,276
  • 10
  • 56
  • 101