On Mon, 2006-12-11 at 23:02 +0300, Oleg Broytmann wrote:
> On Mon, Dec 11, 2006 at 02:57:03PM -0500, David Turner wrote:
> > This is not quite true, if I understand correctly.  First, sqlobject
> > creates the base row, then (if necessary) it calls methods to get
> > default values for the derived class, then it creates the derived row.
> > So the user's program does have control during those methods (and this
> > is where I ran into the problem).
> 
>    Shouldn't it be considered a bug in the user program if it access the DB
> during row creation?

I don't see why it should be.

The actual use case I had in mind was that a table's elements acted as a
sortable list, so the table has a column sort_index, which is unique.  I
want to set the sort_index on new elements to be one plus the max of the
sort_index on the old elements -- that is, new elements should appear at
the end of the list.

I could, of course, calculate the sort_index somewhere else, rather than
using SQLObject's default feature.  But then there's the risk of race
conditions, which I expect the ORM to insulate me from.

Generally, I think the ORM should always present a consistent view of
the data to user programs at all times.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to