On 11/14/06, Florent THIERY <[EMAIL PROTECTED]> wrote:
Is it best: - to create the table on-the-go: whenever a new column is needed, i add it and fill the data. The previous entries (which never needed this column) are NULL ? - my second option is to parse a lot of files and decide i have quite a good representation, i create the table once and for all, and fill the entries.
Is it possible to progressively (i.e. with several distinct requests) fill a line (entry)? Is it possible to easily create additional columns? Is it possible to reorder columns?
Actually, a more common approach is to make, well, relations ;) Most uses of SQL do not have dynamic schemas; instead they have tables that represent one-to-many relationships. Create a table "headers" containing 3 columns: fileid, path, value The fileid is be a reference (typically integer) to a row in another table that contains the filename and any related static information (file size, image resolution, ...). The path and value correspond to a piece of the header, so you end up with multiple rows in this table -- one for each header component. (If there isn't any other relevant information besides the filename, then the fileid column can just be the literal name. If you're storing long paths, putting them in a separate table may be a good idea anyway just to make the database more compact. Choose whichever fits your needs.) This way the header information can be arbitrarily extended, and you can get all headers for a file, or only a specific one, depending on your needs at search time. You also don't need to deal with the schema changing underneath you. ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------