Reply to comment
Drupal CCK delta value and other mysteries
For my aim to create an import-script (see other blog entry), I had to go deeper into Drupal DB values.
I don't like to do things again and again and I hope, that this note will be useful for somebody else perhaps, too.
My understanding of the common drupal cck-columns is:
"delta": Value for sorting the fields
==> 0 = first value
==> 1 = second value
... and so on.
Another aspect that is hard to understand, is the ..._data - column.
It seems to break the rules for database normalization and sets several values as a list in one column.
For example:
a:2:{s:3:"alt";s:0:"";s:5:"title";s:0:"";}
(CCK Image field)
As I understand this, it seems to encapsulate information about which data to use for the (html-)attributes.
An empty entry would look like this:
'a:0:{}'
From my point of view this code really smells bad. It is hard to understand, not db-normalized, ...
Technically it is just a serialized array, for example:
PHP:
print_r(serialize(array('a'=>'value a',
'b'=>'value b')));
RESULT:
a:2:{s:1:"a";s:5:"value a";s:1:"b";s:4:"value b";}
Anyway, we have to struggle with it and my oppinion doesn't matter in this case. For my script I will just leave this empty ('a:0:{}') and see, if it will cause problems. At the moment I think, there's no other possibility, because I can't find a documentation about this. So if you know better, please let me know!
Reply
Julian Pustkuchen ist passionierter Software- & Webentwickler mit den Schwerpunkten Softwaredesign, Objektorientierung, Ablaufoptimierung und Usability bei webks. Ein weiterer Schwerpunkt ist die Entwicklung im CMS Drupal.
Er besitzt einen Abschluss als B.Sc. Wirtschaftsinformatik (dual) und studiert derzeit für seinen Abschluss als Master of Science Wirtschaftsinformatik.
Entwickelt Julian gerade keine Software, fährt er Ski, Mountainbike, spielt Badminton, segelt oder verbringt Zeit mit Freunden.
Dieser Blog dient als sein "öffentlicher Notizblo(ck/g)".
Neueste Blogeinträge
-
05.02.2012 - 09:52
-
03.02.2012 - 18:14
-
27.01.2012 - 00:12
Tags in Blogeintrag - Kategorie
Webbasierte Lösungen? Machen wir!
webks: websolutions kept simple
http://www.webks.de





