I study web-oriented programming, write a blog for myself using PHP with the MySQL database backend. This should replace my current (Drupal-based) blog.
I decided that I postshould include some data: id, userID, title, content, time-posted. This makes a beautiful schema for the database table. However, I am having problems resolving the issue of how I want to organize storage content.
I could:
- Use the file system. The database table
contentwill then be the URL of the local-local file, which I then read, formatted and displayed. - Save the entire contents of the message to
content, that is, place it in the database.
If I went with (1), searching for the contents of the messages would be a bit problematic - I would be limited to searching for metadata, or I would have to read the contents of each file while searching (although I don’t know which of the problems will be - grep -ir "string" .not too slow .. .). However, the images (if any) will link to the URL, so the link contentwill at least be an internal methodology, and I can easily reuse the content, since text files are ridiculously easy to use compared to the SQL database file.
Going with (2), I could use longtext. contentthen it will need to be sanitized before I try to put it in a tuple, and I am limited in size (although it is unlikely that I will write a blog post on 4 GB;). Search will be easy.
( ), () , () .
/ ? (1) (2) .