DBTNG: Node module

Crell - March 7, 2009 - 19:45
Project:Drupal
Version:7.x-dev
Component:node.module
Category:task
Priority:normal
Assigned:Unassigned
Status:closed
Issue tags:DBTNG Conversion
Description

This is going to be non-small, I think.

#1

Berdir - April 13, 2009 - 23:08

I can confirm, this is non-small :)

Attached is a first patch.

There are some tricky parts, for example node_access.. funny to see that I re-implemented it the exact same way it was already done for node_query_node_access_alter.

AttachmentSizeStatusTest resultOperations
394484.node_dbtng.patch28.43 KBIdleFailed: Failed to apply patch.View details | Re-test

#2

Berdir - April 13, 2009 - 23:09
Status:active» needs review

#3

Crell - April 14, 2009 - 04:02
Status:needs review» needs work

node.api.inc:

- In hook_node_load(), there's no need for that query to use db_select(). If you pass an array in as a value in the placeholders array for db_query(), the DB layer will automatically convert it to the proper placeholders for you for use in an IN clause. It's cool like that. :-)

node.module

- In node_last_viewed(), use fetchObject() explicitly rather than fetch(). It is more self-documenting that way.

- You're somewhat inconsistent in how you handle single-value fields() calls. In some places you break that out so that there's just a single key/value on one line, in others you just inline it on the fields() line. For single-value arrays I think it's preferable to just inline them. Please check to make sure you do so consistently.

- node_page_view() has a db_select() in it that I don't think needs to be. db_query_range() still works the same as before, and there's no tagging, so using a static query will be faster.

- node_access_rebuild(): I'm curious why you're using this:

<?php
$result
= db_query("SELECT nid FROM {node}", array(), array('fetch' => PDO::FETCH_COLUMN));
?>

Instead of fetchCol(). and then iterating the result. It works, I suppose, but I've not seen that idiom used anywhere else in Drupal. (Depending on your reasoning maybe we should, but we don't right now.:-) )

- _node_access_rebuild_batch_oper(), again I don't think the db_select() needs to be a dynamic query. It should be fine as db_query_range().

Nicely done for a module this big!

#4

Berdir - April 14, 2009 - 07:34

> Instead of fetchCol(). and then iterating the result. It works, I suppose, but I've not seen that idiom used anywhere else in Drupal. (Depending on your reasoning maybe we should, but we don't right now.:-) )
I was not sure under which condition this is called and was a bit scared by that "SELECT nid FROM {node}" without any conditions. I thought it would use less memory to iterate over the result instead of loading all nid's into an array but I assume that's only the case when there are many many nid's and in that case one should use batch anyway. I've also not used node_load_multiple there for the same reason.

> - node_page_view() has a db_select() in it that I don't think needs to be. db_query_range() still works the same as before, and there's no tagging, so using a static query will be faster.
Oh, i thought db_query_range needs to be replaced too.

Fixed the other things.

AttachmentSizeStatusTest resultOperations
394484.node_dbtng2.patch28.21 KBIdleFailed: Failed to apply patch.View details | Re-test

#5

Berdir - April 14, 2009 - 07:35
Status:needs work» needs review

#6

Berdir - April 14, 2009 - 09:23

Actually forgot to do that I wrote in #302234-18: DBTNG blog.module - replaced while .. db_fetch_object.. with foreach.

AttachmentSizeStatusTest resultOperations
394484.node_dbtng3.patch28.67 KBIdleFailed: Failed to apply patch.View details | Re-test

#7

System Message - April 21, 2009 - 12:10
Status:needs review» needs work

The last submitted patch failed testing.

#8

Berdir - April 21, 2009 - 15:30
Status:needs work» needs review

Re-roll due to conflict with the recent node_delete() commit.

AttachmentSizeStatusTest resultOperations
394484.node_dbtng4.patch28.17 KBIdleFailed: Failed to apply patch.View details | Re-test

#9

System Message - April 24, 2009 - 16:36
Status:needs review» needs work

The last submitted patch failed testing.

#10

Berdir - April 24, 2009 - 18:51
Status:needs work» needs review

Re-roll because of the node_counter patch..

AttachmentSizeStatusTest resultOperations
394484.node_dbtng5.patch28.1 KBIdleFailed: Invalid PHP syntax in modules/node/node.module.View details | Re-test

#11

System Message - April 24, 2009 - 19:06
Status:needs review» needs work

The last submitted patch failed testing.

#12

Berdir - April 24, 2009 - 20:09
Status:needs work» needs review

It would help if I would save the updated file before creating the patch... :)

AttachmentSizeStatusTest resultOperations
394484.node_dbtng6.patch27.84 KBIdlePassed: 10905 passes, 0 fails, 0 exceptionsView details | Re-test

#13

Dries - April 25, 2009 - 16:33

Looks good. Committed to CVS HEAD. Thanks!

#14

dropcube - April 25, 2009 - 17:05
Status:needs review» fixed

#15

System Message - May 9, 2009 - 17:10
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.