Anyway, the short answer is that every abstract type needs to be associated with only one MySQL type, and the stored file still needs to include the filename, and, if available the mime type.
So, just 'cause I'm curious, is there a performance advantage to using the regexp to remove the metadata header, rather than just extracting the data by using the regexp backreference? I suppose, since a 'file' is being stored as a mediumblob (max about 16 MB) that it could be a lot of data to run through the regexp engine. Hmm. I'll have to think about that.
Thanks again,
Lloyd
Mac Newbold wrote:
Today at 4:12pm, Lloyd T Brown said:
Here's the situation. I'm encoding files (base 64 encoding) to put them into a database. I want to also include some metadata with the encoded string, namely filename and mime type. Here's an example of the format I decided to use.
"filename: somefilename.txt;mime-type: text/plain; data:
VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw=="
I know you're really asking for a regexp, but if I may, I'd like to suggest you [re]consider having the meta data be stored as a separate column in the table. This could have several benefits:
1) Don't have to parse it out of a blob/text field 2) Can use the meta data for db queries (i.e. selecting by name/type, etc.) 3) Simpler code to read and write file entries in the database 4) More flexible: much easier to expand your meta-data set later 5) That's what databases are for
But of course I don't know the entire situation, so this may not be appropriate in your setting.
BTW, the regexp looked pretty good, and I pretty much agree with what Jacob Fugal said.
Thanks, Mac
-- Mac Newbold MNE - Mac Newbold Enterprises, LLC [EMAIL PROTECTED] http://www.macnewbold.com/
____________________
BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
--
--------------------
"Open Source is not a crime."
-Seen on a bumper sticker
--------------------____________________
BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
