On Fri, 2007-01-12 at 15:20 +0300, Oleg Broytmann wrote:
> On Thu, Jan 11, 2007 at 05:04:55PM -0500, David Turner wrote:
> > I really don't like the half-constructing code.
> 
>    Me too. I have argued [1] against it but without much success. ;) What I
> don't like in it is doneColumn - an additional column that have to be
> processed everywhere.
>    Time to revert the patch?

I agree that doneColumn is the problem, and that the patch should be
reverted.  

One idea is to rewrite row creation as follows:

1. begin transaction
2. generate defaults
3. do creation (recursively)
4. end transaction

Because a transaction is begun before defaults are generated, nothing
can change between default calculation and row creation.  

Except, not really.  Because consider this plausible sequence of events:

thread 1:
opens transaction
selects something (step X)

thread 2:
opens transaction
selects something (step Y)

thread 1:
creates a row based on data selected in step X
This row should invalidate the select in step Y
commits

thread 2:
creates something based on (now incorrect) data selected in step Y
commits

---

The only way to prevent this is to lock the DB for writing before
reading (that is, before generating defaults).   But there is (afaict)
no standard SQL way to directly lock a table.  This may not matter -- we
could just write DB-specific ways of doing it as we would for anything
else non-standard.  

---

I don't really have time to write this right now.  I'm also not sure
it's 100% correct.  

I am sure that we need to put inherited row creation inside a
transaction, because otherwise random aggregate reads will fail.  I
still don't have time to do this right now.  


-------------------------------------------------------------------------
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
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to