Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Easy to use Database function Re:

From: norsepower:uswest at: 26-Jul-2000 9:04

I use a system which may not be the best solution but it works in my head space. On my news Web site, the common denominator is the news article, including the headline, byline, body copy, etc. This then is the basic value to be stored. Each news article is saved in a text file as an object expression so that the values can be loaded and objects can be created on the fly. Each object expression has a "reference-id" which matches the name of the file. The reference-id is based on the time the file was created in digits (e.g. 200007251762). Since file creation is automated, this assures there will never be a file or object of the same name (wait 1 is used to keep it incremental.) Articles can be commented on. Comments are saved in the same fashion, with their own reference-ids which match the name of the file containing the comments in an object expression. The comments relate to a specific article by being saved in a directory with the same name as the article that the comments reference. Of course, the comments directories are saved in an alternate directory separate from the path where the articles are saved. This creates a database using the file system, directories and files as the cells where data is stored. Like I said, I don't know if it is the best solution, but since data is kept in separate files, individual articles can be deleted from the "database" quite easily and there is no single, large file that must be loaded into memory each time the database is accessed. Data is sought out by simply reading a directory and looking for a reference ID. -Ryan