在MySQL数据库中创建CCK记录

时间:2010-12-18 02:41:33

标签: drupal-6

我想通过MySQL创建一个CCK节点。我知道这三个主要表格涉及:

  1. 似乎 Node 表用作node_revision和CCK表中所有记录的foriegn密钥。它还拥有标题,创建日期等。
  2. CCK表包含 CCK 字段值
  3. node_revision 表格,其中包含内容正文。
  4. 伪代码可能是:

    Insert Into NodeTable //Title and other node fields
    Select nId of New Node //To use as foreign key for insert into CCK & Revision table
    Insert Into Node_Revision //body field, using NodeId as foreign key
    Insert Into CCK_table //fields in form other than Title & Body
    

    是否需要触及任何其他表来通过UI进行复制?

1 个答案:

答案 0 :(得分:1)

这有点棘手,因为它取决于你安装的其他模块(例如位置)以及它们如何挂钩 - 是否有理由不想通过引导Drupal“以编程方式”执行此操作?这是一个很棒的指南,说明如何模拟表单模块并使用drupal_execute:

http://thedrupalblog.com/programmatically-create-any-node-type-using-drupal-execute