You mean otherwise it gets the whole dict? and now only id: 1 ?
On 1 aug, 19:48, Yarko Tymciurak <[email protected]> wrote:
> On Sat, Aug 1, 2009 at 12:43 PM, Yarko Tymciurak <[email protected]> wrote:
>
> > On Sat, Aug 1, 2009 at 10:41 AM, Pynthon <[email protected]> wrote:
>
> >> 1. =] Nice! But watch this query:
>
> >> db( db.leden.info == 'Hans' ).select( db.leden.id, db.leden.naam )
>
> >> It still give me no error so if I enter a where clause the DAL will
> >> get all the fields?
>
> >> 2. You mean if you don't use [0] this will be the output
>
> >> output = [1, 'name', 'info'] And to get it nice you need to use [0]?
>
> > Here's the way to think of this:
>
> > each select from web2py returns a dictionary which represents the rows
> > selected - a LIST OF ROWS:
>
> ...sorry... this should have said "...returns a list of dictionaries..."
>
>
>
> > query_results = [ retuned_row1, returned_row2, returned_row3, ... ]
>
> > What is returned for each result query is a dict (not a list);
> > In your example:
>
> > output = [ {id:1, naam:'name', info:'Hans'} ]
>
> > db( yourQuery ).select()[0] is just the first (in your example, only) row,
> > so just the dict (not in a list):
> > {id:1, naam:'name', info:'Hans'}
>
> > If you had multiple results, you would have:
>
> > output = [ {id:1, naam:'name', info:'Hans'},
> > {id:2, naam:'Hans', info:'This is a correction'},
> > ...]
>
> > Does this make more sense?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---