Re: [SQLObject] Bug: InheritableSQLObject can leave DB in inconsistent state
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: David T. <no...@op...> - 2006-12-11 21:16:38
|
On Mon, 2006-12-11 at 23:52 +0300, Oleg Broytmann wrote: > On Mon, Dec 11, 2006 at 03:37:38PM -0500, David Turner wrote: > > > 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. > > Because accessing the DB during row creation when the "row" is actually > a set of rows exposes the inconsistent state of the DB, and SQLObject > certainly cannot prevent this. Sure it can -- using transactions in the way I suggested, or using a liveness marker which is atomically set at the end of creation. Either of these would work. > > 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. > > "sort_index" should be an autoincremented int. Thus the DB guarantees > both consistency and speed. That would be nice, but MySQL only allows one autoincremented column per table. |