My favorites | Sign in
Project Logo
                
New issue | Search
for
| Advanced search | Search tips
Issue 3: allow separate DataSet objects having identical rows to be run together
1 person starred this issue and may be notified of changes. Back to list
Status:  Accepted
Owner:  kumar.mcmillan
Type-Enhancement
Priority-Medium
Milestone-Undecided


Sign in to add a comment
 
Reported by kumar.mcmillan, Feb 14, 2007
the first solution that comes to mind is to add a mode to LodableFixture
objects so they can load data as either "insert" or "refresh"

currently data is inserted from DataSet objects.  This is great until you
want to mix and match sets that were extracted from real data.  Some of
those sets will point to the same rows in a database.  It seems useful to
have an option where you can "update or save" a row from a DataSet.

The downsides: 

- you would have to define a primary key for each row.  for every row?
- old data might get overwritten by new data and in an unpredicatable
order.  This would be hard to debug if you didn't know you were doing it.  

The idea here is not to accomodate data already existing in a database
(although that might be a use case) but to make the combination of DataSet
objects with duplicate rows possible.

Maybe a better solution is to change the internal registry to be keyed by
storable object instead of DataSet class object?  I.E. in today's fixture,
two DataSet objects could be named the same but since they could be two
different class objects from separate modules, they would be treated as
unique DataSets.  No, that wouldn't work because the second DataSet may
have additional rows and it would be ignored.


Comment 1 by kumar.mcmillan, Feb 14, 2007
btw, this is done in DbUnit
http://dbunit.sourceforge.net/components.html#databaseoperation as Allen Bierbaum has
pointed out
Comment 2 by kumar.mcmillan, Feb 15, 2007
I'm leaning towards a new keyword that can be set at Fixture() or fixture.data() like so:

load_as="insert"
load_as="refresh"
Comment 3 by kumar.mcmillan, Apr 26, 2007
this could also be helpful to build tests entirely around generated data sets.  That
is, if you were to generate two separate data sets they may overlap in the
tables/rows they require.  The above feature would allow you to use a generated
dataset in its raw form, without editing the code.
Comment 4 by kumar.mcmillan, Sep 02, 2008
(No comment was entered for this change.)
Labels: Milestone-Undecided
Sign in to add a comment

Hosted by Google Code