Active
Project:
Content Construction Kit (CCK)
Version:
6.x-2.0
Component:
Documentation
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
10 Nov 2008 at 15:37 UTC
Updated:
11 Nov 2008 at 15:03 UTC
Hi there,
are there any drupal 6 cck docs for developers? I noticed that the db structure changed from 5.x version, or at least it doesn´t correspond to the drupal docs texts.
By the way, we are developing a module that need to access some cck content types fields in order to launch queries against the db, but my coworker is having problems retrieving that info from the db. Any simple form?
Thanks in advance, Simon.
Comments
Comment #1
yched commented$db info then contains the name of the db table that holds the data for the field, and the exact column names.
As you probably know, CCK storage is dynamic, the table for a field can change over time depending on the fields settings (shared / not shared, single value / multiple values)
So you should never make assumptions on where CCK data is stored, but use the code snippet above to retrieve the current storage informations.
Comment #2
SimonVlc commentedThanks a lot yched ;).
Comment #3
SimonVlc commentedJust to know,
how do you make complexes query having to get every field info with that snippet?
We are trying to port an structured application with 5 simple content types (no more 5 fields each) into the drupal db (porting all the structures to cck nodes) but it seems terrible inefficient.
Doing a simple query in the old system (a 2 way relationship) is now a completely mess between multiple cck tables... is this really the way to go?
Thanks in advance, Simon.
Comment #4
yched commentedThis means your query string will have variables for the table and column names.
Now, about the layout of CCK tables : CCK simply does what's driven by your field's definition.
- SQL-wise, there's no way to store a multiple values-field in the same table as some other fields.
- If a field is used by several content types, you can't store denormalize it in a per-content-type table...
These aspects have been discussed *at length* - see http://groups.drupal.org/node/9297 for instance.