[development] Drupal 7 node_example.module

Dale McGladdery torelad at gmail.com
Tue Aug 25 20:05:10 UTC 2009


I'm working on a Drupal 7 update to the node_example.module. Issue:
http://drupal.org/node/508342

I have a working D7 version of node_example.module. Before I post my
replacement candidate I'm hoping for answers to a couple of questions.
If you have a comment, please respond in the issue queue
(http://drupal.org/node/508342) so we retain a record of the
conversation.

Q1: The Drupal 6 example
(http://api.drupal.org/api/drupal/developer--examples--node_example.module)
provided SQL for creating a database table required for the module.
I've created a .install file and Schema API definition for the module
(for my own testing sanity). Since using schema is best practice, I
would like to include the .install file in the example.
Comments/Objections?

Q2: If the Schema API is used, which database update method is better
for the example: drupal_write_record() (Schema API) or
db_insert()/db_update()?
I've used db_insert and db_update because they seem the best follow-on
from the Drupal 6 example. However, I don't know if this is a
situation where drupal_write_record() is best practice.

Thanks in advance, everyone. Looking forward to feedback in
http://drupal.org/node/508342 .


More information about the development mailing list