When designing a website, I find it mentally less challenging to use a database as opposed to a database + bunch of files. For example, if I have a table called
PLAYER then I prefer to have all aspects of that player
centralizedin a table instead of say, having the players picture on disk somewhere and having the player's name as a column in the table. This to me has many advantages:
- Creating a new player is not a hybrid task of adding a database row and managing a file hierarchy for him
- I dont have to keep track of two different access policies
- of course player deletion is fairly straightforward too.
Now the disadvantage is that it is much harder to get the client to cache image data (say of the player's picture) when I am serving it out of a database based on a query string instead of when the browser is making a call to the full URL to the image.
Is there an easy way to recoup the two? One thing which comes to mind is path translation:
http://www.website.com/user/bobo/pic/file.jpg
really gets served by an Apache handler ala:
SELECT pic FROM player WHERE username = 'bobo';
but I dont have the luxury of such a handler because I am being hosted somewhere where I only have CGI access.