Re: OK to delete records while finding them?

This WebDNA talk-list message is from

2000


It keeps the original formatting.
numero = 32477
interpreted = N
texte = >Is there some inherent danger in deleting a record from a db within >a [founditems] loop which is finding >records in that same db?Yes, the founditems loop relies on the [index] position of the found items to be there every time it loops thru them, and deleting records ends up changing the index values of specific records, thus making the delete act on the wrong records, or failing to act on all the records you want it to act on.It's best to use founditems to create a SKU list of records to be deleted, then use that list in a single delete tag appearing AFTER the search context.>(I am setting up to do that now and thought maybe I remember some >discussion on this topic way back...?) > >ie- (carriage returns added for clarity only) > >[Search db=some.db >&eqMasterIDdatarq=[id] >&eqDestSectNumdatarq=[DestSectNum] >&PiSiNumsort=1 >&PiSiNumsdir=as >&PiSiNumtype=num] > >[FoundItems] > >[showif [someCriteria]=isMet] >[DELETE db=some.db >&eqMasterIDdatarq=[id] >&eqDestSectNumdatarq=[DestSectNum] >&eqPiSiNumdatarq=[PiSiNum]] >[/showif] > >[/FoundItems][/Search] > >?? > >Is this kosher? if not, then why not? And what is the workaround? > >-John > > >------------------------------------------------------------- >This message is sent to you because you are subscribed to > the mailing list . >To unsubscribe, E-mail to: >To switch to the DIGEST mode, E-mail to > >Web Archive of this list is at: http://search.smithmicro.com/================================ Kenneth Grome, WebDNA Consultant 808-737-6499 http://webdna.net ================================------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://search.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: OK to delete records while finding them? (John Butler 2000)
  2. Re: OK to delete records while finding them? (Kenneth Grome 2000)
  3. Re: OK to delete records while finding them? (Anup Setty 2000)
  4. Re: OK to delete records while finding them? (Michael Winston 2000)
  5. OK to delete records while finding them? (John Butler 2000)
  6. Re: OK to delete records while finding them? (Kenneth Grome 2000)
>Is there some inherent danger in deleting a record from a db within >a [founditems] loop which is finding >records in that same db?Yes, the founditems loop relies on the [index] position of the found items to be there every time it loops thru them, and deleting records ends up changing the index values of specific records, thus making the delete act on the wrong records, or failing to act on all the records you want it to act on.It's best to use founditems to create a SKU list of records to be deleted, then use that list in a single delete tag appearing AFTER the search context.>(I am setting up to do that now and thought maybe I remember some >discussion on this topic way back...?) > >ie- (carriage returns added for clarity only) > >[Search db=some.db >&eqMasterIDdatarq=[id] >&eqDestSectNumdatarq=[DestSectNum] >&PiSiNumsort=1 >&PiSiNumsdir=as >&PiSiNumtype=num] > >[founditems] > >[showif [someCriteria]=isMet] >[DELETE db=some.db >&eqMasterIDdatarq=[id] >&eqDestSectNumdatarq=[DestSectNum] >&eqPiSiNumdatarq=[PiSiNum]] >[/showif] > >[/FoundItems][/Search] > >?? > >Is this kosher? if not, then why not? And what is the workaround? > >-John > > >------------------------------------------------------------- >This message is sent to you because you are subscribed to > the mailing list . >To unsubscribe, E-mail to: >To switch to the DIGEST mode, E-mail to > >Web Archive of this list is at: http://search.smithmicro.com/================================ Kenneth Grome, WebDNA Consultant 808-737-6499 http://webdna.net ================================------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://search.smithmicro.com/ Kenneth Grome

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

Help with update to 2.11 (1998) More on the email templates (1997) Location of Webcat site in folder hierarchy (1997) Showif Context combined with Search (1997) WebCat2b13MacPlugIn - More limits on [include] (1997) Integration? (1999) [interpret] inside the db field? (1997) all db's in one folder and protected (1998) Document Contains No Data! (1997) The Guru, The Mooseman, Susie and Is That Really the Only Manual? (1998) What is wrong here? (2000) determining plug-ins? (1998) RE: Checkboxes to add to cart... (1998) [protect] on NT? (1997) WebCat2 - Getting to the browser's username/password data (1997) Math confusion (2004) remotely add + sign (1997) NT [delete] (1998) Fwd: Apache/Mod-SSL & WebCatalog (UNIX)! module bug? (2000) PCS Frames (1997)