Re: Updating a database once per day - An example
This WebDNA talk-list message is from 1998
It keeps the original formatting.
numero = 17975
interpreted = N
texte = >On 5/31/1998 11:29 pm, Kenneth Grome so noted...>>>If you want to make sure this manual updating process works properly>>without any problems, other than *possibly* a visitor or two getting an>>Error: the database 'test.db' could not be found or opened message>>during the process (which should take no more than a second or two at the>>most), do this in your update template:>>>>[DELETEFILE] <--trash the current db file>>[CLOSEDATABASE] <--purge the RAM cache>>[MOVEFILE] <--move the new db file into place>>>>This insures that when it's time to move the new db file into position,>>the old data is already purged from RAM ... and the old db file could not>>be reloaded because it wasn't there to be reloaded -- it was already>>deleted from disk.>It's my understanding that [closedatabase] writes out any modifications>to disk before closing ...Yes, this is correct.>will it create a new file if the expected>database file is missing? Probably a moot point, since I currently have>autocommit turned on, but if I didn't?No, it will not. I just tested it to be absolutely sure, and it does NOT recreate the test.db file that's missing ...>Getting the database not found error for those few seconds would>probably be acceptable (albeit kludgy).It's not even a few seconds, so I don't think you have anything to be concerned about. I just tested this to see exactly how long it atakes for the 3 tasks above to be performed. In repeated tests on my very old, slow 68040 Mac it still takes 7 ticks, which is 7/60 of a second. That's barely more than a tenth of a second! I doubt your visitors have much of a chance of hitting the missing db precisely during those 7 ticks ... but anything's possible I suppose.>Is there way to tell the ErrorMessages.db to point to a custom>error page of my own designUse [include] in the message field instead of what's there ...>can there be multiple ErrorMessages.db files to handle>customization on a site by site basis?No, but you can probably simulate the same thing with showif's and hideif's in your [include] file.>I know that this thread comes 'round every couple months or so. It would>be good to have some definitive word on the (apparently common) subject>from PCS, or some additional tags/tools with WebCatalog to make the>process easier.It couldn't get much easier than it is, this is all I put in my template to update my test db file and it works exactly as I expected it to work:[deletefile test.db][closedatabase test.db][movefile path=spareFolder/test.db&to=test.db]Nevertheless, confirmation from PCS is more than welcome ... :)Sincerely,Ken Grome808-737-6499WebDNA Solutionsmailto:ken@webdna.nethttp://www.webdna.net
Associated Messages, from the most recent to the oldest:
>On 5/31/1998 11:29 pm, Kenneth Grome so noted...>>>If you want to make sure this manual updating process works properly>>without any problems, other than *possibly* a visitor or two getting an>>Error: the database 'test.db' could not be found or opened message>>during the process (which should take no more than a second or two at the>>most), do this in your update template:>>>>
[deletefile] <--trash the current db file>>
[closedatabase] <--purge the RAM cache>>
[movefile] <--move the new db file into place>>>>This insures that when it's time to move the new db file into position,>>the old data is already purged from RAM ... and the old db file could not>>be reloaded because it wasn't there to be reloaded -- it was already>>deleted from disk.>It's my understanding that
[closedatabase] writes out any modifications>to disk before closing ...Yes, this is correct.>will it create a new file if the expected>database file is missing? Probably a moot point, since I currently have>autocommit turned on, but if I didn't?No, it will not. I just tested it to be absolutely sure, and it does NOT recreate the test.db file that's missing ...>Getting the database not found error for those few seconds would>probably be acceptable (albeit kludgy).It's not even a few seconds, so I don't think you have anything to be concerned about. I just tested this to see exactly how long it atakes for the 3 tasks above to be performed. In repeated tests on my very old, slow 68040 Mac it still takes 7 ticks, which is 7/60 of a second. That's barely more than a tenth of a second! I doubt your visitors have much of a chance of hitting the missing db precisely during those 7 ticks ... but anything's possible I suppose.>Is there way to tell the ErrorMessages.db to point to a custom>error page of my own designUse
[include] in the message field instead of what's there ...>can there be multiple ErrorMessages.db files to handle>customization on a site by site basis?No, but you can probably simulate the same thing with showif's and hideif's in your
[include] file.>I know that this thread comes 'round every couple months or so. It would>be good to have some definitive word on the (apparently common) subject>from PCS, or some additional tags/tools with WebCatalog to make the>process easier.It couldn't get much easier than it is, this is all I put in my template to update my test db file and it works exactly as I expected it to work:[deletefile test.db][closedatabase test.db][movefile path=spareFolder/test.db&to=test.db]Nevertheless, confirmation from PCS is more than welcome ... :)Sincerely,Ken Grome808-737-6499WebDNA Solutionsmailto:ken@webdna.nethttp://www.webdna.net
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:
emailer on Windows Beta 18 (1997)
Country & Ship-to address & other fields ? (1997)
Using the Tearoom Teamplates (2000)
math with multiple [founditems] (1999)
PIXO support (1997)
[LOOKUP] (1997)
Multiple Fulfillment Emails (2002)
Finding max value for a field (1997)
WebCat2_Mac RETURNs in .db (1997)
Initiating NewCart (1997)
[URL] and [showif] or [hideif] comparisons (2003)
Add to Cart & List of Products (1997)
[TaxableTotal] - not working with AOL and IE (1997)
WebCat2b13MacPlugIn - [showif][search][/showif] (1997)
Three new problems, maybe a fourth (1997)
keep W* in front applescript? (1998)
Webstar / WebCat - Persistent Setting (2003)
[WebDNA] Crashing Database (2011)
error -108 (1997)
[WebDNA] =?UTF-8?B?UmU6IFtXZWJETkFdIFJlOiBbV2ViRE5BXSBSZTogW1dlYkROQV0gUmU=?= (2011)