[support] New CCK field not found in mysql
Yves Chedemois
yched.drupal at free.fr
Fri Nov 20 22:29:29 UTC 2009
The content_database_info() function gives you the storage information
you need to build your custom queries.
You can do something like:
$field = content_fields($field_name);
$db_info = content_database_info($field);
$sql = db_fetch_array(db_query('SELECT nid FROM {'. $db_info['table'] .
'} WHERE '. $db_info['columns']['value'] .' = %d',$product_id));
See the PHPdoc for more details.
Yves Chedemois
William Smith a ecrit le 20/11/2009 22:49:
> Absolutely. One of the things you'll find to is that where data is
> stored will shift on you depending on whether the field is isolated to
> one node type only or if it is shared, etc.. As Domenic said, it
> really is best to use the regular node api for this sort of thing
> rather than try to cram it in via direct SQL queries against the DB.
>
> On Fri, Nov 20, 2009 at 4:41 PM, Domenic Santangelo
> <domenics at gmail.com <mailto:domenics at gmail.com>> wrote:
>
> CCK is black magic... better not to try and decipher the db structure
> which at times seems kind of arbitrary to me.
>
> The better way is to write a fn that loops thru the nodes you want to
> batch add to, do a node_load() on them, modify the desired fields,
> then node_save().
>
> HTH,
> -Dom
>
> On Nov 20, 2009, at 1:07 PM, Scott wrote:
>
> > I found where the data went by exporting the sites database. Rather
> > than create a new table named content_field_street_name, as I would
> > have
> > expected, it created content_type_[content_type_name]. This
> table has
> > fields: vid, nid and field_street_name_value. I'm about out of time
> > today but I wonder what would've happened had I added two new fields
> > to
> > this CCK type.
> >
> >
> > On Fri, 2009-11-20 at 12:07 -0800, Scott wrote:
> >> I've created a new field for a CCK type and it works fine in my
> >> drupal
> >> site. My problem is that it does not show up in mysql command line
> >> interface or with phpmyadmin. This is confusing to me. I can
> >> modify,
> >> add and delete data using the edit node function when viewing a
> >> page, so
> >> I know the data is somewhere, however, I wish to do a batch load of
> >> this
> >> field with mysql.
> >>
> >
> > --
> > [ Drupal support list | http://lists.drupal.org/ ]
>
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>
>
More information about the support
mailing list