Re: [writefile] ugliness

This WebDNA talk-list message is from

2001


It keeps the original formatting.
numero = 36740
interpreted = N
texte = >Writefile doesn't do databases. Use Append instead. Besides, the >info in physlot.db is written into RAM. To change the info WC has >stored, you need to flush that info from memory. > >Seems like it would be a lot easier to use something like: > >[deletefile file=physlot.db] >[FLUSHDATABASES] >[writeFile physlot.db] >[Append db=physlot.db&Replace=T] >YourStuffHere >[/writefile] This example is wrong.First of all, there's no reason to flushdatabases when you have the option to close the specific db you need to close. Using the closedatabase tag is more efficient. It writes the current RAM-cached data to disk then closes the specific db you need to close, without affecting the others.Second, if you're going to delete a db file, you have to close it FIRST -- *before* you delete the file. If you don't close it first, webcat will still have that data cached in RAM and it will use that old RAM-cached data overwrite your new data after you've created the new db via writefile.The *proper* code should be this instead:[closedatabase file=physlot.db] [deletefile file=physlot.db] [writeFile physlot.db] ... all the new stuff here ... [/writefile]But even this is not the best solution. An even more efficient technique would be to delete all the *records* in the currently existing db, then appending the new records to the db. This means you do not have to delete or rewrite any files at all, you simply 'empty' the current db and append new data to it.This example assumes you have a SKU field in the db, but if you do not, you can replace the SKU field name with the name of any other field in the db and it will still work properly:[delete db=physlot.db&neSKUdata=[blank]] [delete db=physlot.db&eqSKUdata=[blank]] [append db=physlot.db] ... all the new stuff here ... [/append]================================================= Kenneth Grome WebDNA Consultant telephone number: 011 63 32 486-9077 telephone number: 011 63 919 749-0060 business web site: http://webdna.net personal web site: http://kengrome.com =================================================------------------------------------------------------------- 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: [writefile] ugliness (Kenneth Grome 2001)
  2. Re: [writefile] ugliness (Glenn Busbin 2001)
  3. [writefile] ugliness continued (Conley Hanson 2001)
  4. [writefile] ugliness (Conley Hanson 2001)
>Writefile doesn't do databases. Use Append instead. Besides, the >info in physlot.db is written into RAM. To change the info WC has >stored, you need to flush that info from memory. > >Seems like it would be a lot easier to use something like: > >[deletefile file=physlot.db] >[flushdatabases] >[writeFile physlot.db] >[Append db=physlot.db&Replace=T] >YourStuffHere >[/writefile] This example is wrong.First of all, there's no reason to flushdatabases when you have the option to close the specific db you need to close. Using the closedatabase tag is more efficient. It writes the current RAM-cached data to disk then closes the specific db you need to close, without affecting the others.Second, if you're going to delete a db file, you have to close it FIRST -- *before* you delete the file. If you don't close it first, webcat will still have that data cached in RAM and it will use that old RAM-cached data overwrite your new data after you've created the new db via writefile.The *proper* code should be this instead:[closedatabase file=physlot.db] [deletefile file=physlot.db] [writeFile physlot.db] ... all the new stuff here ... [/writefile]But even this is not the best solution. An even more efficient technique would be to delete all the *records* in the currently existing db, then appending the new records to the db. This means you do not have to delete or rewrite any files at all, you simply 'empty' the current db and append new data to it.This example assumes you have a SKU field in the db, but if you do not, you can replace the SKU field name with the name of any other field in the db and it will still work properly:[delete db=physlot.db&neSKUdata=[blank]] [delete db=physlot.db&eqSKUdata=[blank]] [append db=physlot.db] ... all the new stuff here ... [/append]================================================= Kenneth Grome WebDNA Consultant telephone number: 011 63 32 486-9077 telephone number: 011 63 919 749-0060 business web site: http://webdna.net personal web site: http://kengrome.com =================================================------------------------------------------------------------- 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:

Encrypt question. (2000) 4.0 send email ticks. . (2000) ShippingCosts (1998) Colocator Upgrading OS (2004) auto-stripping of spaces (1997) pull downs (1997) dollar $ signs in database (2000) WebDNA on a Raq4i (2003) lookups or math? (1998) [LOOKUP] (1997) [WebDNA] Ubuntu 14.04 & WebDNA (2017) [WebDNA] exclusivelock (2011) Help! WebCat2 bug (Ben's input) (1997) Help! Odd, irreproducible happenings. (1998) Pithy questions on webcommerce & siteedit (1997) Summing fields (1997) WebCat2 - Getting to the browser's username/password data (1997) dbQuickView 2.0 (2005) [CART] inside a [LOOP] (1997) Emailer Set Up (1997)