"Andreas Flack" <[EMAIL PROTECTED]> wrote: > >How do you know if object's id property is auto incremental ? > >How do you know it's primary and unique? > > Well, I don't (and I didn't write o.o.invoices), but that's the mechanism the > component uses right now: it looks for the highest ID in the table, then adds > one and inserts this in the invoiceNumber field when you click the "create > invoice" link. >
I would write the same solution. Though, I wouldn't like to depend on DB auto incremental ID. Correct invoice number is much more important than performance. > It's a strange and fragile system (because deleted invoices and other > irregularities can quickly derail the numbering system). Maybe a solution > could be not to use ID as the base for the next invoice number, but instead > qb->count(); where qb queries all invoices? new invoice /* 12 */ new invoice /* 13 */ invoice delete(12) new invoice /* 13 */ ( disaster ) Piotras _______________________________________________ user mailing list [email protected] http://lists.midgard-project.org/mailman/listinfo/user
