[CDBI] Multiple records

Kate Yoak kate at yoak.com
Tue Sep 6 08:06:29 BST 2005

I have come across a tricky problem and would like advice for how to handle it best.
Let's suppose I have a Bucket which has_many Water::Drop's.  Now, it's a really large bucket, and we may be able to put thousands of drops in it (or we might just put one).  

It would be nice to be able to store them all at once.  One-at-a-time method might be just a tad slow.  

OK, so we make a create_many method in the parent class.  Unlike the regular create() method it does not return any objects - it's for writing to the database and nothing else.  Presumably, there is no need to generate thousands of objects at once - they can be retrieved later.  There is a design problem with this approach: data validation routines are not being called.  Triggers are not either.  A lot of implied functionality breaks (some that I am probably not aware of).

I can certainly look at the code for Class::DBI::create() and make sure I do everything that's necessary.  But before I plunge ahead, has anyone a) encountered this situation before b) thought of a clever way to solve it c) decided it's the wrong way to think about it d) has general advice.

Thanks for the help!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digitalcraftsmen.net/mailman/private/classdbi/attachments/20050906/120d02e2/attachment.htm

More information about the ClassDBI mailing list