Closed (fixed)
Project:
Content Construction Kit (CCK)
Version:
6.x-2.4
Component:
General
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
26 Jul 2009 at 08:34 UTC
Updated:
29 Aug 2009 at 12:50 UTC
Hi, just discovered this in my db..
I have custom content type "flat" (on real estate page), some of the cck field values are stored in "content_type_flat", which is what I expected, but some of them, fg. "field_rent_sell" are stored in "content_field_rent_sell" etc.., is there a reason for this? All of them are text type check boxes/radio buttons with allowed values like this..
return array(
'1' => t('Sell'),
'2' => t('Rent'),
);
Comments
Comment #1
czeky commentedComment #2
markus_petrux commentedAt this moment, CCK2 uses 2 different storage methods for fields: a) table per content type (default), b) table per field. This is not user selectable. CCK2 switches to b) when the field is shared between several content types (you used add existing field), or when the field allows multiple values, where in addition to store the field on its own table, a delta column is added to the primary key. If any of the conditions that triggered b) changes, then CCK re-evaluates, and switches back to a) storage as appropriate.
If you don't use multiple values for a field, and you want to make sure this field is stored in the content type related table, then do not shared this field between more than one content type.
Comment #3
tinem commentedVERY interesting and important message which will be a concern to my testsite http://www.tinemuller.dk/drupal/node/1097 making a map without using any map/locations modules but storing the data in Drupal and then getting the info from the table in my situation from my Content type Copenhagen which is content_type_copenhagen.
I'm also going to use CCK fields for several multiple values for people to choose so have to figure out how to get this done to show on the big map if I want to from the other table then but it would have been nice if ALL the info was in ONE table though. :-)
Comment #4
markus_petrux commentedWell, you may or may not want to share a field between content types. The fact a separate table will be used when a field is shared is something to take into account before you share a field. In any case, CCK gives you the choice to do it or not.
When the field allows multiple values, then it must be stored into a separate table because a new delta column needs to be added to the primary key. This is an attribute that is only related to the field that is defined to allow multiple values. So its data needs a separate table.
Comment #5
czeky commentedThanx, the reason I'm asking is.. I need to write custom module to search custom values in db
this is working fine, because in one table, but I need more values, now.. from other table (as described above), I have radio button Rent or Sell (with values "rent" and "sell") in the other table, and I need to display and sort these values as well. I just don't have a clue how to do it together.. ;-(
is it possible to do something like SELECT columnX FROM tableX WHERE xxx AND SELECT columnY FROM tableY WHERE yyy ORDER BY zzz DESC?
many thanx guys
Comment #6
markus_petrux commentedYou can use CCK APIs for this. Examples:
Comment #7
tinem commentedI have made my first filed with checkbox/radiobuttons for 2 different chooses and I can see that both answer is in the same table as the other fields which was want I wanted. How can that be?
I have:
Betaling2:
N/A
2gratis
2betalingstoilet
Don't know what N/A is about?
This is one toilet http://www.tinemuller.dk/drupal/node/1090 and the other http://www.tinemuller.dk/drupal/node/1100.
This is what I have at the bottom of the site in PHP:
return array(
'0' => t('2gratis'),
'1' => t('2betalingstoilet'),
);
In my table field_betaling2_value I have "1" and "2" for different toilets and think this is how it should be, right?
Comment #8
tinem commentedJust discovered that I hadn't been giving the CCK permission for these filelds so Anomymous users could not see the info from this fields but it's ok now - http://www.tinemuller.dk/drupal/copenhagen.
Maybe some one can answer to my question now, please?
Comment #9
markus_petrux commentedRe: Don't know what N/A is about?
This is added by CCK optionwidgets because the field is defined as optional. You can change the text of this option overiding the function theme_optionwidgets_none() in your theme.
Search the issues queue as this N/A thing has been discussed several times.
Re: In my table field_betaling2_value I have "1" and "2" for different toilets and think this is how it should be, right?
I think this has been answered in #2 and #4? Since this one seems to be a field that only accepts one value, if you want it to be stored in the content type table, then don't share this field with other content types. If you do, CCK will swicth to *per field storage* and create a table for this field.
Comment #10
tinem commented@markus_petrux wrote:
Search the issues queue as this N/A thing has been discussed several times.
I can't figure out what to choose to get info about this in issue. Can someone help, please?
Comment #11
markus_petrux commentedFollow this link and you'll find one or two issues:
http://drupal.org/project/issues/cck?text=theme_optionwidgets_none&statu...