I wanted to throw this out there and get a yes or no as I am trying to wrap my ehad around how drupal works. Is this statement true or false or kinda true.

"drupal creates object fro ease of processing then serializes them so that they can easily be stored in databases and then unserialized them when they are outputted from the database for ease of processing once again."

Just curious if this is a concept I'm understanding correctly.

Comments

mitchmac’s picture

Basically true, though it's not a concept limited to Drupal. A complex type is converted to a string so that it's structure doesn't have to be represented/dealt with for part of the application's workflow (as you point out for storage in the database or during transfer to another system, component, for example).

jaypan’s picture

Yes and no. Drupal often does this, though it's not limited to this. Nodes and users are objects. They aren't necessarily serialized however, they are broken apart and stored in different columns in the database.

Contact me to contract me for D7 -> D10/11 migrations.

tommy kaneko’s picture

Just to expand on this question, if you don't mind:

When you serialize data to store in the database, what type should the database field be? (blob, int, varchar) I am guessing varchar, as it is turned into a string, no?

Design is my game http://tomkaneko.com

jaypan’s picture

It depends on the amount of data, but generally I would use text, as serialized data could potentially be quite long.

Contact me to contract me for D7 -> D10/11 migrations.