diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-07-28 19:18:08 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-07-28 19:18:08 +0000 |
commit | a938e18a1bd36d887010863817470b690fdbf6f3 (patch) | |
tree | adbc7edb165255a47739fdbe7e0184c241f6340c /modules/comment/comment.install | |
parent | ff8b0618f5892d165720453efcd318b0d85a6f8c (diff) | |
download | brdo-a938e18a1bd36d887010863817470b690fdbf6f3.tar.gz brdo-a938e18a1bd36d887010863817470b690fdbf6f3.tar.bz2 |
- Patch #491556 by Berdir: completed converting core to DBTNG. Oh my. Kudos to Berdir for this humongous effort.
Diffstat (limited to 'modules/comment/comment.install')
-rw-r--r-- | modules/comment/comment.install | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/modules/comment/comment.install b/modules/comment/comment.install index f35b98d81..45afd76bd 100644 --- a/modules/comment/comment.install +++ b/modules/comment/comment.install @@ -42,7 +42,18 @@ function comment_uninstall() { */ function comment_enable() { // Insert records into the node_comment_statistics for nodes that are missing. - db_query("INSERT INTO {node_comment_statistics} (nid, last_comment_timestamp, last_comment_name, last_comment_uid, comment_count) SELECT n.nid, n.changed, NULL, n.uid, 0 FROM {node} n LEFT JOIN {node_comment_statistics} c ON n.nid = c.nid WHERE c.comment_count IS NULL"); + $query = db_select('node', 'n'); + $query->leftJoin('node_comment_statistics', 'ncs', 'ncs.nid = n.nid'); + $query->addField('n', 'changed', 'last_comment_timestamp'); + $query->addField('n', 'uid', 'last_comment_uid'); + $query->addField('n', 'nid'); + $query->addExpression('0', 'comment_count'); + $query->addExpression('NULL', 'last_comment_name'); + $query->isNull('ncs.comment_count'); + + db_insert('node_comment_statistics') + ->from($query) + ->execute(); } /** |