Ah ha!!! Excellent - that looks so much better now!  I appreciate your help

-Rob

On Tuesday, May 25, 2021 at 4:06:04 PM UTC-4 valq...@gmail.com wrote:

>
> http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Expressions
>
> вторник, 25 мая 2021 г. в 22:36:47 UTC+3, valq...@gmail.com: 
>
>> db(...).update(some_field = db.some_table.some_field_or_another_field + 1)
>> - should work ( it is a single db-query)
>>
>>
>> вторник, 25 мая 2021 г. в 19:59:34 UTC+3, Rob Paire: 
>>
>>> Hi All
>>> Thank you for the helpful comments!  I am fine leaving the SQL Execute 
>>> statement in place, but thought the question was worth asking.
>>>
>>> -Rob
>>>
>>> On Tuesday, May 25, 2021 at 8:06:46 AM UTC-4 Carlos Correia wrote:
>>>
>>>> Às 18:20 de 20/05/21, Rob Paire escreveu:
>>>>
>>>> Hello all, 
>>>>
>>>> I am wondering if it's possible to use DAL update method to increment 
>>>> the value of table column H_REVNO in one line of code, and one trip to the 
>>>> database?
>>>>
>>>> I tried this query, and a couple of similar variations, but could not 
>>>> get it to work.
>>>> db(db.KICKER.id == request.vars.kicker_id).update(H_REVNO=H_REVNO+1)
>>>>
>>>> Here is what I am using for now
>>>> db.executesql("update KICKER set H_REVNO = H_REVNO + 1 where ID = "+ 
>>>> str(request.vars.kicker_id))  which of course works. 
>>>>
>>>> Thank you all!
>>>>
>>>>
>>>>
>>>> Hi,
>>>>
>>>> Using DAL you have to read the record first in other to get the value 
>>>> to be incremented. But, if there are many users it might lead to corrupted 
>>>> values due to concurrency.
>>>>
>>>> As far as I know, the latest is the only sane approach to solve your 
>>>> problem.
>>>>
>>>>
>>>> Carlos Correia
>>>> =========================
>>>> MEMÓRIA PERSISTENTE
>>>> GSM:  917 157 146 (Signal, WhatsApp)
>>>> e-mail: ge...@memoriapersistente.pt
>>>> URL: http://www.memoriapersistente.pt
>>>> XMPP (Jabber): car...@memoriapersistente.pt
>>>> GnuPG: wwwkeys.eu.pgp.net
>>>>
>>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/bfeb24cc-010f-450e-80a5-be948de33db6n%40googlegroups.com.

Reply via email to