On Nov 16, 2008, at 2:14 AM, [EMAIL PROTECTED] wrote: > Do you mind specifying what are the "odd things" that happen? > > I have used TRIGGERs on tables with INTEGER PRIMARY KEY and have had > no odd things happen at all.
Right. I should have put more details up originally. Actually, the problems have all been related to the Objective-C / Cocoa interface that I have been working on. It is a small project with a small database consisting of 4 tables, one of which is a startup table with two integers. Those two integers correspond to primary keys of two other tables with the AUTOINCREMENT, precisely because I do not want recycling of id numbers. Originally, I had written Obj-C code to update the startup table integers whenever an UPDATE or INSERT was performed on the two tables with the AUTOINCREMENT id numbers, then I thought it would be much more efficient to have the triggers do the job, and result in less code in the actual front end. Well, all was working fine until I installed the triggers. My Obj-C code did indeed update the startup table, and then correctly read those integers to present the proper data to the GUI. After installing the triggers, and commenting out the relevant Obj-C code, it did not matter whether I did the INSERT or UPDATE via my GUI or via the command line; the startup table was consistently correct (i.e., the triggers were working), but my Obj-C code kept returning the integer 2, even when the startup table contained a 17. It was even more maddening when the same behavior was exhibited after dropping the triggers and un-commenting the Obj-C code. I ended up having to erase the database file completely and write a new one to get everything to function correctly as the original had. Yes, I am a beginner with both Obj-C and SQLite (6 months or so with both), so it is certainly possible that there is something involved with the timing of my commands within my Cocoa project that is doing this. The weird thing is that even when I shut down the sample app (running inside of XCode), and then re-launched it to read the tables fresh on startup, I would still consistently get a 2, regardless of what integer was actually residing in the startup table. In case you are wondering, I use 3 different Macs, depending on where I am during the month, and I want the startup table so that the database file can move from machine to machine, and my app will always have the same data and setup. The file will eventually reside on a flash drive, although for development purposes, right now I am keeping it on my desktop(s). Thank you again. > Craig Smith [EMAIL PROTECTED] _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users