On 7 August 2010 04:57, Dominic LoBue <dominic.lo...@gmail.com> wrote:
> Hello, > > Is it possible to create a "virtual" column in SQLObject? > > To give you an example of what I mean by a virtual column, given a > table named "agtAgent" with a StringCol() named "name", and two > IntCol()'s named "level" and "quality", consider this SQL statement: > select name, level, quality, (((level -1)*2) + (quality/20)) as > reqStanding from agtAgent where reqStanding > %i > > Is it possible to do something like this in SQLObject without having > to drop down to writing the sql queries manually? > > Hi, check the Using sqlmeta<http://www.sqlobject.org/SQLObject.html#using-sqlmeta>in the main SQLObject documentation (untested) class AgtAgent(SQLObject): class sqlmeta: fromDatabase = True columnList = True def _get_reqStanding(self): return(self.level-1)*2 + (self.quality/20) HTH Petr Jakes
------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss