[development] Field "body" no longer part of node table in 4.7 - looking for guidance on what to change

Scott McLewin drupal at mclewin.com
Mon Jan 9 13:41:27 UTC 2006


Thanks Nedjo.  I think you've answered my question - that doing a join 
to the {node_revisions} table to get the body is the proper method in 
Drupal 4.7.

Thanks for the prompt response.

Scott


Nedjo Rogers wrote:

> You can of course do a node_load($nid).  But if you need to manually 
> load data (e.g., so you can do a custom select), then, yes, you need 
> to do a join on {node_revisions}.  Examples are in the core 
> modules--searc for "{node_revisions}".  I don't see this in the module 
> update instructions--I'll add in a note (unless on second look I find 
> it already there).
>
> ----- Original Message ----- From: "Scott McLewin" <drupal at mclewin.com>
> To: <development at drupal.org>
> Sent: Sunday, January 08, 2006 6:52 PM
> Subject: [development] Field "body" no longer part of node table in 
> 4.7 - looking for guidance on what to change
>
>
>> Good evening.
>>
>> I'm busy upgrading the one module I maintain (wishlist.module) to 
>> Drupal 4.7.  It has been pretty straightforward, following 
>> http://drupal.org/node/33338 helped a lot.  The forms api conversion 
>> was simple with the help of the http://www.lullabot.com/formupdater.  
>> Thanks for the work that went into both of these.
>>
>> I've gone through the upgrade steps and rummaged around drupal.org 
>> looking for some help with a problem.  I can save, delete and edit a 
>> wishlist node with no problem.  But my custom display for showing 
>> wishlist items in a table (http://mclewin.com/wishlist/2 [4.6 
>> version]) spews SQL errors. Looking at the table schema, it appears 
>> that database structure was changed to remove the field "body" from 
>> the NODE table.  A little digging found a "body" field in the 
>> NODE_REVISONS table.  Before I rework my code to add another join 
>> between NODE and NODE_REVISIONS I thought I would double check that 
>> doing so is considered 'correct' - what is the intended way to 
>> retrieve the body text of the node in Druapl 4.7?
>>
>> Here is the error I'm getting:
>>
>>    * user warning: Unknown column 'n.body' in 'field list' query:
>>      SELECT n.nid, n.title, n.uid, w.item_priority, w.item_est_cost,
>>      w.item_currency, n.body, n.changed, w.item_quantity_requested,
>>      w.item_url1, w.item_url2 FROM node n LEFT JOIN wishlist w ON n.nid
>>      = w.nid WHERE n.type='wishlist' AND n.uid=1 AND w.item_is_public
>>      ORDER BY n.title ASC LIMIT 0, 10 in
>>
>> /raid/home/www-drupaldev/drupal-4.7.0-beta2/includes/database.mysql.inc
>>      on line 108.
>>
>>
>> Scott
>>
>>
>



More information about the development mailing list