On Aug 1, 10:25 am, Pynthon <forumx...@gmail.com> wrote:
> So db(here the wheres).select(here the selects)

yes

> 2. What for list of records do you mean? If I select something with
> the ID it give me only info from that id right?

Select always returnes a Rows object with is similar to a list. If you
select by ID it contains a single element (if found) or no elements
(if not found).

>
> On 1 aug, 17:20, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > On Aug 1, 10:14 am, Pynthon <forumx...@gmail.com> 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?
>
> > rows=db().select(db.table.field1,db.table.field2)
>
> > > 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#
>
> > all = db( db.leden.id == request.args[0] ).select
> > (db.leden.id,db.leden.naam)
>
> > > 3. Ah, ok :)
>
> > > Thanks and sorry that I don't understand that much :$.
>
> > > On 1 aug, 17:02, mdipierro <mdipie...@cs.depaul.edu> 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 web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to