On Tuesday 03 February 2009, Oleg Broytmann wrote:
> On Tue, Feb 03, 2009 at 02:37:16PM -0500, Stef Telford wrote:
> > Oleg Broytmann wrote:
> > > Because SQLObject needs to generate unique alias names and a global
> > >  counter is the simplest way to do it. Think about joining a table
> > > with itself - you need two different names for the table.
> >
> > Sorry, perhaps I am being stupid here (always a possability) but, how
> > many self joins are we expecting in a query ? I mean to say, isn't
> > saying 'selfName = self.__class__.__name__ + "_%d" % int(random())'
> > good enough ?
>
>    Are you sure calling random() and int() is really so much faster
> than lock/increase counter/unlock?
>    Are you sure you are optimizing a real stumbling block?

I do not think that the issue is one of speed, but one of correctness. 
Locks plus an incrementing counter is safe and correct. Random numbers 
are not. While they may work most of the time, they may also fail under 
given circumstances which is unacceptable.

-- 
Dan

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to