Re: [web2py] Re: counter implementation

2011-07-01 Thread Bruno Rocha
forget the lambda.. the problem is the key mytab=123 db(db.mytab.id==mytab_id).update(*cnt*=db.mytab.cnt+1 ) SyntaxError: keyword can't be an expression

Re: [web2py] Re: counter implementation

2011-07-01 Thread Bruno Rocha
On Fri, Jul 1, 2011 at 6:58 PM, weheh wrote: > mytab=123 > db(db.mytab.id==mytab_id).update(db.mytab.cnt=db.mytab.cnt+1) > SyntaxError: keyword can't be an expression > try with a lambda (I did not tested, but as lambda returns a valuem could work. mytab=123 db(db.mytab.id==mytab_id).update(db

[web2py] Re: counter implementation [almost closed]

2011-07-01 Thread Massimo Di Pierro
This is the shortcut db(db.mytab.id==mytab_id).update(cnt=db.mytab.cnt+1) because it does it in one SQL statement Other ways, when they work, are equivalent to row = db.mytab(mytab_id) row.update_record(cnt=row.nct+1) ie.e. two statements. On Jul 1, 7:59 pm, weheh wrote: > Thanks, that work

[web2py] Re: counter implementation [almost closed]

2011-07-01 Thread weheh
Thanks, that works now. My head is fuzzy today after all I've been through. I had tried this: db.mytab[mytab_id]=dict(cnt=db.mytab.cnt+1) but that didn't work. Is there a "shortcut" syntax to do this? Just curious, as the "longcut" is clearly just as short.

[web2py] Re: counter implementation [open]

2011-07-01 Thread Massimo Di Pierro
db(db.mytab.id==mytab_id).update(cnt=db.mytab.cnt+1) On Jul 1, 4:59 pm, weheh wrote: > On Jul 1, 5:58 pm, weheh wrote: > > > > > > > > > Maybe I spoke too soon... > > > mytab=123 > > db(db.mytab.id==mytab_id).update(db.mytab.cnt=db.mytab.cnt+1) > >   SyntaxError: keyword can't be an expression

[web2py] Re: counter implementation [open]

2011-07-01 Thread weheh
On Jul 1, 5:58 pm, weheh wrote: > Maybe I spoke too soon... > > mytab=123 > db(db.mytab.id==mytab_id).update(db.mytab.cnt=db.mytab.cnt+1) >   SyntaxError: keyword can't be an expression

[web2py] Re: counter implementation

2011-07-01 Thread weheh
Maybe I spoke too soon... mytab=123 db(db.mytab.id==mytab_id).update(db.mytab.cnt=db.mytab.cnt+1) SyntaxError: keyword can't be an expression

[web2py] Re: counter implementation

2011-07-01 Thread weheh
Thanks, Massimo. On Jul 1, 4:37 pm, Massimo Di Pierro wrote: > db(db.table.id=-id).update(db.table.field=db.table.field+1) > > does not work on GAE > > On Jul 1, 3:33 pm, weheh wrote: > > > > > > > > > With web2py, can you increment an integer field, which is used as a > > counter, with just 1 c

Re: [web2py] Re: counter implementation

2011-07-01 Thread Ovidio Marinho
There is a document that says what can or can not in GAE? Ovidio Marinho Falcao Neto ovidio...@gmail.com 88269088 Paraiba-Brasil 2011/7/1 Massimo Di Pierro > db(db.table.id=-id).update(db.table.field=db.table.field+1) > > does not

[web2py] Re: counter implementation

2011-07-01 Thread Massimo Di Pierro
db(db.table.id=-id).update(db.table.field=db.table.field+1) does not work on GAE On Jul 1, 3:33 pm, weheh wrote: > With web2py, can you increment an integer field, which is used as a > counter, with just 1 call to the db? Regardless, I'm looking for the > most efficient stand-alone syntax for in