[Nitro] Og Unit Tests

Walter Walter at mwsewall.com
Fri Jan 20 11:59:34 EST 2006


> 
> > Any plans to allow for non auto-sequenced compound primary keys.  This
> would allow for much easier integration with legacy systems.
> 
> Can you explain this in more detail?
> 


I deal with a legacy accounting/Fuel Oil program that does NOT use auto increment primary keys named oid or id or anything like that.

Basically there is a separate table that contains the next available entry number, whether it is a journal entry or an invoice and whatever.  I must get the next "KEY" from that table and assign it to the object.

If we take an invoice for example there is an invoice header and invoice line items.  The header primary key is the division and the invoice number that I would need to get from the above method, and the division is whatever division I am in when I create the invoice.  The index is based on (div, inv_no).  For each line item in the invoice there is an InvoiceLineItem whose key is the invoice number of the invoice header it is a child of and the line item number for this line item (not always sequential).

Basically I need to be able to assign the keys during creation, but Og should be able to use the compound primary keys for lookups/updates/deletes.  I would still like to do invoice.line_items and have Og find them for me.

If there were a KeyGenerator that could be plugged-in, one could create their own to work with the above, and other methods, assuming the table had that generator assigned to it.  Perhaps one KeyGenerator would simple be a ManualGenerator where key setting was manual.

This would allow for different methods of key generation, and allow it to work with legacy databases, which is something Rails cannot do very well.


Walt

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.20/234 - Release Date: 1/18/2006
 




More information about the Nitro-general mailing list