"Randell D." <pl*******************@news.group.com> writes:
Michael Fuhr wrote: Thierry <thierry_at_iceprod.com@no_spam_please.com> writes:
I do have a mysql database with a BLOB column. What is the proprest way
to read this column ?
SELECT it just like any other field. Some people mistakenly say
to use stripslashes() on the result, but it's almost always wrong
to do so.
Are you having trouble working with binary data? If so then please
elaborate.
Question for Michael (since I am not the original poster): Why would
performing a stripslashes() on the result be *almost* always wrong on a
BLOB column? I could see where this might be suggested for binary data,
but not for ascii text... I'm just curious since I store data in BLOBs
(and read them back using SELECT) and I'm wondering if there is
something that I am (or am not considering) that I may not know about...
I said "almost always wrong" because I could contrive a situation
where calling stripslashes() on retrieved data would be appropriate.
For example, if magic_quotes_gpc is turn on but a script doesn't
check it with get_magic_quotes_gpc() and calls addslashes() or
mysql_escape_string() on form data anyway, then the form data would
be double-escaped. If the double-escaped data is inserted into a
database, then you'd need to call stripslashes() after retrieving
the data to get it back to its original format. Proper coding would
have avoided this, but if you're working on a project with other
programmers then you may not have control over how data is inserted
into the database.
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/