Weird kind of data storage |
[eluser]codex[/eluser]
In the EE-core database I see there's data being stored as (something like) Code: a:1:{i:0;a:9:{s:8:"username";s:5:"edd";s:8:"password";s:32:"100cbe9b3aeaeeb2836384185cf96a27";s:4:"salt";s:32:"703f004209cc5f1d1d1133a9d0fd5bc6";s:5:"email";s:13:"[email protected]";s:9:"userlevel";i:4;s:8:"nickname";s:7:"coderd";s:8:"language";s:2:"nl";s:15:"text_processing";s:1:"5";s:8:"lastseen";i:1208909690;}} What is it and what is the purpose or advantage of storing data like this?
[eluser]wiredesignz[/eluser]
It's a serialised array or object, you can unserialise it back to its original form.
[eluser]codex[/eluser]
[quote author="wiredesignz" date="1209110805"]It's a serialised array or object, you can unserialise it back to its orignal form.[/quote] Ah, that's what I kinda thought. The data in question are stored preferences. I think I may be giving the answer myself, but could it be that the data is stored as a serialized string to prevent having to put in all fields into the database? I mean, instead of creating a field for each preference you now just have one that holds a serialized array of prefs. Am I close?
[eluser]webthink[/eluser]
Quote:instead of creating a field for each preference you now just have one that holds a serialized array of prefs. Exactly. Serialization allows you to store arrays as simple strings. Suits session storage perfectly.
[eluser]webthink[/eluser]
just re-read my last post... holy alliteration! Quote:Serialization stores simple strings. Suits session storage. say that 5 times fast!
[eluser]codex[/eluser]
[quote author="webthink" date="1209140087"]just re-read my last post... holy alliteration! Quote:Serialization stores simple strings. Suits session storage. say that 5 times fast![/quote] Code: $say_this = 'Serialization stores simple strings. Suits session storage.'; ;-) |
Welcome Guest, Not a member yet? Register Sign In |