[Dbix-class] bulk_create branch updated

John Napiorkowski jjn1056 at yahoo.com
Tue May 22 00:16:00 GMT 2007


--- John Napiorkowski <jjn1056 at yahoo.com> wrote:

> 
> --- Jess Robinson <castaway at desert-island.me.uk>
> wrote:
> 
> > 
> > On Thu, 17 May 2007, John Napiorkowski wrote:
> > 
> > > Hey,
> > >
> > > I checked in an update to the bulk_create branch
> > that
> > > basically seems to do the job (calls create in
> > array
> > > context, but bulk_insert in void context)
> although
> > I'm
> > > not sure if this is much more efficient.  I have
> > to
> > > call bulk insert for each nested relationship,
> for
> > > example.  Also I run a bunch of nasty maps to
> > convert
> > > and merge some data structures.  So I'm hoping
> to
> > > gather some feedback.
> > >
> > > I also still need to clean up the indenting to
> > conform
> > > to coding standards.  I'll do that when we all
> > think
> > > the code is doing what we want.
> > >
> > 
> > Cool stuff!
> > 
> > However, you neglected to create belongs_to rels
> > before the main object.. 
> > I've added a test to 101populate_rs which fails
> for
> > you ;)
> > 
> > Jess

Okay, I checked in some nasty hacks to make this work.
 I'll clean/refactor it a bit more later.  I also
updated the tests a bit, please take a look and let me
know if you think I'm still testing for what we need.

I need to add a few tests to make sure I cover void
and array context for both automatic PKs and specified
PK's.  Right now I don't cover the case were the
relationship is a has_many type and we are
automatically creating relating keys.  I have no good
way to handle this in bulk_insert since execute_array
doesn't seem to have a way to return the inserted
rows.  Any thoughts or directions of research on this
would be appreciated.  Also someone with good
knowledge of the way we can determine relationships
should really look at my code and let me know if I'm
doing this the hard way.  I can see some ways to make
this more efficient, but not much more.

--john



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Dbix-class mailing list