I don't know if this is of any help, but you can make a mysql field Unique
without it being an index/primary key.
----- Original Message -----
From: "Al" <news@xxxxxxxxxxxxx>
To: <php-general@xxxxxxxxxxxxx>
Sent: Monday, July 25, 2005 9:40 AM
Subject: A strategy question about using mySQL for saving flat-file
stings?
I've been creating a number of CM applications for a virtual-host website.
One feature, of several applications, allows the editor [one of our
people] to create simple text files. I've been using simple flat-files in
a directory for saving the files.
I've gotten tried of dealing with directory permission problems, etc., and
am considering using a simple mySQL DB for storing the file strings.
Obviously, for each file-string to be unique, its path must be included as
part of the ID.
Here is my question.
I can use one table for all the path/files and use the following as the
primary key "/home/some-dir/filename".
fields: fullpath-filename | path | type | date | binary-string
path is so the code can do an equivalent of scandir()
type signifies whether data has been serialized() or not. This is so I
can save arrays
date is the equivalent of file last mod date.
Or, I can create a separate table for each full-path used and then just
use the filename for the primary key. In this case, since the table name
is in effect the path, only the filename is needed.
The first approach is obviously simplest; but, I'm concerned about getting
myself into a trap later on. Anyone offer any suggestions?
Many thanks.....
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php