I fixed question one already :D!
On 1 aug, 17:41, 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]?
>
> On 1 aug, 17:35, mdipierro <[email protected]> wrote:
>
> > On Aug 1, 10:25 am, Pynthon <[email protected]> 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 <[email protected]> wrote:
>
> > > > 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?
>
> > > > 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 <[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
-~----------~----~----~----~------~----~------~--~---