Thanks for your reply, Nithin. I know how to create composite keys in SQL... I'm just not sure if Android can work with them? I have looked at methods of uploading databases to Android phones, in particular this one:
http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/ Which seems to imply that keys need to be called '_id'; however, if I were to have composite keys, I could not call both '_id'. Is this naming more a convention, or is it required for Android to be able to work with the database? As well as the above, I have seen a few other suggested methods, such as storing a file of the SQL commands to build the database which are read in and executed. Which method is more likely to be efficient for a large database - copying a database onto the device, or running the SQL commands from a resource or raw file to build it? On Jan 7, 7:56 am, Nithin <nithin.war...@gmail.com> wrote: > > Firstly, is it possible to implement composite keys? > > Yes, its possible. > > Can do something like this, > > CREATE *TABLE* example1( > field1 text not null, > field2 text not null, > *PRIMARY* *KEY*(field1, field2) > ); > > > And secondly, how can I load a pre-created database onto an Android > > device efficiently? > > Database will be loaded, when you load the apk into the deveice. All > the resource, that application has (like files, database etc.) will be > bundled in the .apk file. And moreover, Database is private to the > application in Android. > > Nithin > > On Jan 4, 7:44 pm, verb <verb_se...@hotmail.com> wrote: > > > > > I'm currently doing a project which requires a potentially large > > underlying relational database, and have a couple of queries on how to > > implement this in Android. > > > Firstly, is it possible to implement composite keys? I have seen > > methods which suggest that all primary keys in a database must be > > called '_id' for Android to recognise them, but cannot find anything > > on if there is more than one key in a table. > > > And secondly, how can I load a pre-created database onto an Android > > device efficiently? It will only need to be added once on > > installation, but potentially be updated or have individual entries > > added by the user. > > > I am currently implementing in API Level 4 (Android 1.6). > > > Thanks in advance.
-- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en