Page 1 of 1

Serielization for MySql

Posted: Sat May 15, 2010 2:19 pm
by drayfuss
Hi,

I was wondering if there is any way of knowing whether data in a database has been serialized?

I'm working on a Database class which allows the option of inserting a serialized array value into a row on a database. When I run a SELECT query on the database, I want to be able to know if the result should be deserialized before I return it to the model that's requesting it. Or am I just going to have to keep an eye on what I do/don't serialize?

Thanks,

drayfuss

Re: Serielization for MySql

Posted: Wed May 19, 2010 5:47 am
by Benjamin
All records in a particular field should either be serialized or not. You should never have a field which may or may not contain serialized data.

Re: Serielization for MySql

Posted: Wed May 19, 2010 2:33 pm
by John Cartwright
I agree with Benjamin on this. However, for the sake of the issue at hand, a php.net commenter posted a solution to this here.