I don't think the act differently...

db.tablename and db[tablename] are synonym I think and let you do something
like this :

db(db[request.args(0)].id == 1).select(...)

Where request.args(0) is your table name coming from your URL...

In the example you give in your first post you seems to have forget the
field you want to make a constraint for...

in db(db.tablename.fieldname == something).select(...) this part
"db.tablename.fieldname == something" is equal to "where
tablename.fieldname = something" in raw SQL...

If you want all the record from a table for example :

db(db.tablename.id > 0).select(db.tablename.ALL)

And if you don't know with table :

db(db[request.args(0).id > 0).select(db[request.args(0)].ALL)

Richard




On Thu, Dec 15, 2011 at 2:21 PM, monotasker <scotti...@gmail.com> wrote:

> OK, I found a workaround by doing a double inner-join:
> tb = db[tablename]
> rowlist = db((tb.author == db.authors.id) & (tb.work == db.works.id
> )).select()
>
> I'm still confused, though, by the difference between db.tablename and
> db[tablename]. Why do they act differently in queries?
>
>
>

Reply via email to