Re: [android-developers] SQLite Database - Multiple Tables

2011-03-14 Thread Brad Stintson
Thanks. I created foreign key, but when I try to insert values using m application it throws *android.database.sqlite.SQLiteConstraintException: error code* * 19: constraint failed.* * * But if I insert values manually usiing console, then values are inserted properly. Why is it so? **2011/3/13

Re: [android-developers] SQLite Database - Multiple Tables

2011-03-14 Thread Kostya Vasilyev
Most likely, it means you didn't specify a value for the foreign key when inserting into the child table (ref_id_value in the snippet below). -- Kostya 14.03.2011 16:27, Brad Stintson пишет: Thanks. I created foreign key, but when I try to insert values using m application it throws

Re: [android-developers] SQLite Database - Multiple Tables

2011-03-14 Thread Brad Stintson
I assigned pre-defined value for foregin key. The thing that happens is that on first time use of that key, an entry is created in database. But if I use that value for second time then value is not updated in database My database table strings are as follows private static final String

Re: [android-developers] SQLite Database - Multiple Tables

2011-03-14 Thread Kostya Vasilyev
14.03.2011 17:36, Brad Stintson пишет: I assigned pre-defined value for foregin key. The thing that happens is that on first time use of that key, an entry is created in database. But if I use that value for second time then value is not updated in database Brad, Not sure if I understand

Re: [android-developers] SQLite Database - Multiple Tables

2011-03-14 Thread Brad Stintson
What happens is that it doesn't allow multiple entries for that pro_id. I'm not able to understand why that is happening. On Mon, Mar 14, 2011 at 8:48 PM, Kostya Vasilyev kmans...@gmail.com wrote: 14.03.2011 17:36, Brad Stintson пишет: I assigned pre-defined value for foregin key. The

Re: [android-developers] SQLite Database - Multiple Tables

2011-03-14 Thread Kostya Vasilyev
Your table definition looks pretty reasonable to me (perhaps I'm missing something). Are you sure it's really that column? You have a lot of NOT NULL constraints in table event, maybe it's one of the other ones? You previously wrote that inserting values by hand (sqlite3 command line tool?)

[android-developers] SQLite Database - Multiple Tables

2011-03-13 Thread Brad Stintson
How to insert multiple tables which have few fields in common? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to

Re: [android-developers] SQLite Database - Multiple Tables

2011-03-13 Thread Kostya Vasilyev
Multiple inserts, one at a time. Preferably using a transaction. 13.03.2011 12:58 пользователь Brad Stintson geek.bin...@gmail.com написал: How to insert multiple tables which have few fields in common? -- You received this message because you are subscribed to the Google Groups Android

Re: [android-developers] SQLite Database - Multiple Tables

2011-03-13 Thread Brad Stintson
How to use transaction and how to implement the concept of foreign key? 2011/3/13 Kostya Vasilyev kmans...@gmail.com Multiple inserts, one at a time. Preferably using a transaction. 13.03.2011 12:58 пользователь Brad Stintson geek.bin...@gmail.com написал: How to insert multiple tables

Re: [android-developers] SQLite Database - Multiple Tables

2011-03-13 Thread Kostya Vasilyev
SQLite has foreign key support starting with version 3.6.19. http://www.sqlite.org/foreignkeys.html Some versions of Android have SQLite versions earlier than that - someone posted a breakdown recently, check the list archives. For earlier versions, it works pretty well to do something like: