SMSI: closedatabase then replacefounditems inside the samesearch context ...

This WebDNA talk-list message is from

2002


It keeps the original formatting.
numero = 41874
interpreted = N
texte = As everyone knows, adding new fields to the .hdr file is an easy way to add new fields to the db without having to do anything to the .db file itself, since webcat automatically inserts the required tab characters into the .db file when it recognizes that the new fields have been added to the .hdr file.I wanted to take advantage of this time-saving webcat feature by improving it. So I wrote a little webdna snippet that *automatically* adds new fields to the .hdr file when certain field names in the posted form do not already exist in the db.Using this tool means I will no longer have to open the .hdr file and manually add new fields to the db every time I want to add another field to the db. Instead, the simple posting of any new form field (which has a special character string in its name) automatically adds that new field name to the .hdr file, then webcat automatically makes the appropriate adjustments to the .db file.I put my code snippet into an include file so I could use an include tag in front of *any* replace or append context. This means that any new fields posted via the form will be added to the db immediately before the posted form values are appended or replaced.This tool works perfectly now, but I ran into some problems at first ...What I learned here is that the db must be closed before running the replace or append -- apparently so webcat can reload the updated .hdr file which has the new fields in it. Once webcat recognizes that the new fields have been added to the .hdr file, it can successfully append or replace the posted form values to the db ...So in order to make sure webcat closes then re-opens the db -- in order to recognize the newly-added fields -- I put a closedatabase tag at the end of my code snippet. But when I placed my [include] tag inside a search context, immediately in front of a replacefounditems context, I got a cannot find or open the xxx.db file error message.When I moved the include file out of the search context, the errors stopped and the replacefounditems worked properly. This makes me think that it's not proper to place a closedatabase tag inside a search context, or at least it's not proper when you're going to follow that tag with a replacefounditems context or possibly a founditems context.Therefore, my question to SMSI is this:What happens when a closedatabase tag appears inside a search context but before a context such as replacefounditems or founditems, as in this example?:[search db=xxx.db ...] [closedatabase db=xxx.db] [replacefounditems]...[/replacefounditems] [/search]Does the theory go something like this?:1- webcat performs the search and identifies the matching records by their index values. 2- webcat closes the db -- which makes webcat LOSE the list of matching index values it has just created. 3- webcat tries to replacefounditems but fails: -because the db has been closed, or -because the list of index matching records no longer exists.Or is there a better description of what actually happens inside webcat in this situation? Sincerely, Kenneth Grome--------------------------------------------------- WebDNA Professional Training and Development Center 175 J. Llorente Street +63 (32) 255-6921 Cebu City, Cebu 6000 kengrome@webdna.net Philippines http://www.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. SMSI: closedatabase then replacefounditems inside the samesearch context ... (Kenneth Grome 2002)
As everyone knows, adding new fields to the .hdr file is an easy way to add new fields to the db without having to do anything to the .db file itself, since webcat automatically inserts the required tab characters into the .db file when it recognizes that the new fields have been added to the .hdr file.I wanted to take advantage of this time-saving webcat feature by improving it. So I wrote a little webdna snippet that *automatically* adds new fields to the .hdr file when certain field names in the posted form do not already exist in the db.Using this tool means I will no longer have to open the .hdr file and manually add new fields to the db every time I want to add another field to the db. Instead, the simple posting of any new form field (which has a special character string in its name) automatically adds that new field name to the .hdr file, then webcat automatically makes the appropriate adjustments to the .db file.I put my code snippet into an include file so I could use an include tag in front of *any* replace or append context. This means that any new fields posted via the form will be added to the db immediately before the posted form values are appended or replaced.This tool works perfectly now, but I ran into some problems at first ...What I learned here is that the db must be closed before running the replace or append -- apparently so webcat can reload the updated .hdr file which has the new fields in it. Once webcat recognizes that the new fields have been added to the .hdr file, it can successfully append or replace the posted form values to the db ...So in order to make sure webcat closes then re-opens the db -- in order to recognize the newly-added fields -- I put a closedatabase tag at the end of my code snippet. But when I placed my [include] tag inside a search context, immediately in front of a replacefounditems context, I got a cannot find or open the xxx.db file error message.When I moved the include file out of the search context, the errors stopped and the replacefounditems worked properly. This makes me think that it's not proper to place a closedatabase tag inside a search context, or at least it's not proper when you're going to follow that tag with a replacefounditems context or possibly a founditems context.Therefore, my question to SMSI is this:What happens when a closedatabase tag appears inside a search context but before a context such as replacefounditems or founditems, as in this example?:[search db=xxx.db ...] [closedatabase db=xxx.db] [replacefounditems]...[/replacefounditems] [/search]Does the theory go something like this?:1- webcat performs the search and identifies the matching records by their index values. 2- webcat closes the db -- which makes webcat LOSE the list of matching index values it has just created. 3- webcat tries to replacefounditems but fails: -because the db has been closed, or -because the list of index matching records no longer exists.Or is there a better description of what actually happens inside webcat in this situation? Sincerely, Kenneth Grome--------------------------------------------------- WebDNA Professional Training and Development Center 175 J. Llorente Street +63 (32) 255-6921 Cebu City, Cebu 6000 kengrome@webdna.net Philippines http://www.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:

What am I doing wrong? (2000) Parameter Passing Value (2002) different ship dates and shopping carts -- how to? (1997) MacOS X Server problems (2001) Help! WebCat2 bug (1997) Missing something simple?? (1998) webDNA and ASP pages (1997) WC TableGrinder (1997) [SHOWIF AND/OR] (1997) unsubscribe (1997) Associative lookup style? + bit more (1997) Append (1999) authorizenet and netscape (2002) file exists on remote server ??? (2006) Almost a there but..bye bye NetCloak (1997) Examples Link? (2000) Re:How to Display text in empty fields (1997) Re:Virtual hosting and webcatNT (1997) Getting total number of items ordered (1997) Expiration of Carts (1997)