Hello Oleg and folks,

I would like to put a certain where-condition to a class of mine, so that to every select against that table my condition is added. I think this must be put within the class-definition.
I need it, because there appeared not-planned values in the table i cannot remove, and instead of going to each .select() and put the filter there i´d like to define it once in the class def.

Is that possible?



Tanks and Regards,

Frank




On Dec 9, 2007 10:45 PM, Oleg Broytmann <phd@phd.pp.ru> wrote:
On Sun, Dec 09, 2007 at 08:36:52PM +0100, Petr Jake?? wrote:
> On Dec 9, 2007 6:28 PM, Oleg Broytmann wrote:
> >   Use sqlbuilder.Select() from the trunk - it supports all
> > features of .select() (actually, .select() is reimplemented in the trunk
> > by
> > means of sqlbuilder.Select()).
>
> Can you please give me a short example. The documentation (
> http://www.sqlobject.org/SQLBuilder.html) does not describe the
> sqlbuilder.Select() method.

  class Select declared in

http://svn.colorstudy.com/SQLObject/trunk/sqlobject/sqlbuilder.py

  as

class Select(SQLExpression):
   def __init__(self, items=NoDefault, where=NoDefault, groupBy=NoDefault,
                having=NoDefault, orderBy=NoDefault, limit=NoDefault,
                join=NoDefault, lazyColumns=False, distinct=False,
                start=0, end=None, reversed=False, forUpdate=False,
                clause=NoDefault, staticTables=NoDefault, distinctOn=NoDefault)

  It generates a SELECT clause which you have to execute via your
connection:

rows = connection.queryAll(connection.sqlrepr(
  Select([MyTable.q.col1, MyTable.q.col2], distinct=True)
))

Oleg.
--
    Oleg Broytmann             http://phd.pp.ru/            phd@phd.pp.ru
          Programmers don't die, they just GOSUB without RETURN.

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss