The way I think of it is

db(....) defines a set of records

.count() counts the records of the set
.delete() deletes the recods
.update(....) updates the records
.select(...) extracts info from the records ... specifies what and
how.

.select(db.table.field1,db.table.field2) extracts two fields
.select(orderby=db.table.field1) extract all fields sorted by field1

db(query1)(query2) compute the query2 subset of db(query1)

How this makes sense.

On Aug 1, 10:14 am, Pynthon <[email protected]> wrote:
> 1. I think I understand but what If I want only to get the db.table.id
> and the db.table.name fields? Can you or someone please give me some
> examples :$? BTW if you do all does it this (in MySQL)
>
> SELECT *
> FROM table
>
> or SELECT field1, field2
> FROM table?
>
> 2. Sorry but I still do not understand? Why you cant just do this:
>
> all = db( db.leden.id == request.args ).select() This is the same as:
>
> SELECT leden_id, leden_naam
> FROM leden
> WHERE leden_id = #url.id#
>
> 3. Ah, ok :)
>
> Thanks and sorry that I don't understand that much :$.
>
> On 1 aug, 17:02, mdipierro <[email protected]> wrote:
>
> > > Maybe I will switch back to Web2Py but I still have some questions :P.
> > > 1. Why it is herehttp://pastebin.com/f4c8cd718db().select(query) and 
> > > herehttp://pastebin.com/m291dbd6ddb(query).select?
>
> > the syntax is always
>
> >     db(query).select(*fields,*attributes)
>
> > db.table.ALL is not a query, means all fields of "table". If you need
> > all fields of a table you can omit a query and web2py assumes you want
> > all fields and all records of that table.
>
> > > 2. What does herehttp://pastebin.com/m3869a9bthe[0] in the line and at 
> > > the end?
>
> > This means you only want the first record. It is the same as
>
> >     all = db.leden[request.args[0]]
>
> > (the latter is better because retruns None if no records, the example
> > you posted would raise an Exception instead).
>
> > > 3. What does herehttp://pastebin.com/m1c7e0e1therequestmean?
>
> > Normally
>
> >     url= URL(applicaiton, controller, function)
>
> > but if you do
>
> >     url = URL(r=request,f=funciton)
>
> > it gets the application name and controller name from the current
> > request. It is a shortcut that is used often.
>
> > Massimo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to