I was recently working with creating a web-based interface to a small part of vendor-supplied database application. Most of the HUNDREDS of tables have two or more keys. Since the application was going to be read only, I wrapped the tables I was using into views (many times simplifying or compiling the data), and for every table that had compound keys, I had an 'ID' field in the view that had the value of each of the keys separated by '|' -- it's arguably an ugly solution, but it proved speedy, made the table data very readable, provided a consistent means for IDing records (and foreign keys), and best of all -- was quick, easy, and required very little coding.
Your mileage may vary, of course. On Apr 18, 3:11 pm, GreyCells <[EMAIL PROTECTED]> wrote: > That's far too pragmatic Nate :) > > How am I going to earn my fee if you keep coming up with such easy > solutions? Oh wait a minute - I'm not being paid for this one... > > On Apr 18, 8:04 pm, nate <[EMAIL PROTECTED]> wrote: > > > Actually, I thought of one possible solution for that: move all the > > records to another (temp) table, truncate the table, and add the pre- > > existing records back. That would reset the ID. > > > GreyCells wrote: > > > I think you mean compund primary key. See: > > > >http://groups.google.com/group/cake-php/browse_thread/thread/4a3f44f8... > > > > Especially Nate's comments. Coincidentally, I had a requirement for > > > one today - but only because mysql can't recycle sequences... > > > > ~GreyCells > > > > On Apr 18, 6:14 pm, "John David Anderson (_psychic_)" > > > <[EMAIL PROTECTED]> wrote: > > > > On Apr 18, 2007, at 10:08 AM, christianandradet wrote: > > > > > > I don't know what to do, how do i define the composed primary key??? > > > > > Why do you need one? Is 'id' not unique? > > > > > -- John --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
