I do not understand your point either. It seems you have records with
a flag (somedata.value) and you set this flag to 0 or non-zero.
Perhaps if you could explain the overall logic we can be of more help.

massimo

On Jun 20, 6:57 am, Fauché JM <jm.fau...@free.fr> wrote:
> Hello,
> I my application ,I have a db in which some row are frequently
> deleted, so if for each new data I  save it in db  (automatiquely
> incremented) I will have a lot of data and a lot of id "empty".
> I think that in this situation when reading data , the program loose
> time ..?
> So I imagine a piece of code where first I seach for free places for
> using the fist one for new data:
>
>                 libre=(db.somedata.value==0)
>                 if len(db(libre).select())>0:           # On free
> place
>                     le_libre = db(libre).select()[0]
>                     db(db.somedata.id==le_libre.id).update
> (value=newvalue)
>                 else:                                   # On new
> place
>                     somedata_id=db.somedata.insert(value=newvalue)
>
> May be there is a simple way ? (for exemple a
> function ...insert_onfree...)
>
> Thank for your comments
> Jean-Marc
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" 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