OK, I think I've taken care of the necessary updates for now. Please review and let me know.

Comments

Patch failed to apply. More information can be found at http://testing.drupal.org/node/13930. If you need help with creating patches please look at http://drupal.org/patch/create

eclipsegc’s picture

StatusFileSize
new3.33 KB

One more time

R.Muilwijk’s picture

StatusFileSize
new87.63 KB

Unfortunatly it breaks blog API tests. See the attached picture.

R.Muilwijk’s picture

Status: Needs review » Needs work
eclipsegc’s picture

Status: Needs work » Needs review

Actually BlogAPI appears to break w/ or w/o this code. Please verify. (also turn clean URLS on it'll run faster)

R.Muilwijk’s picture

Hmmz this is strange. I just did a new checkout and all the tests passed. Then I applied your patch and it still passed :S

R.Muilwijk’s picture

The dblog test is failing because of the function _blog_post_exists. You typecast a object to boolean here._blog_post_exists

catch’s picture

BlogAPI weirdness was here, now passes in head: http://drupal.org/node/297860

(this is why all tests should always pass).

Anonymous’s picture

Status: Needs review » Needs work

The last submitted patch failed testing.

Dave.Ingram’s picture

Title: Updating blog.module to be db tng compatible. » Updating blog.module to be DBTNG compatible.
Assigned: eclipsegc » Dave.Ingram
Issue tags: +DBTNG Conversion

Working on this as of the DrupalCon DC Code sprint... patch coming soon

dave reid’s picture

Title: Updating blog.module to be DBTNG compatible. » DBTNG blog.module
Issue tags: +dc2009 code sprint
Dave.Ingram’s picture

StatusFileSize
new6.19 KB

OK. So all db_query functions and their counterparts have been converted to the new dynamic db_select syntax throughout the module. As a part of this I also rewrote node_title_list() to use a foreach loop instead of a while loop, as suggested by Crell.

Additionally, two chunks of code in blog.pages.inc could be shortened by simply doing a fetchCol() on the query instead of fetching a result and then looping through the results.

Crell’s picture

Do not use dynamic queries if you don't need dynamic behavior. It looks like you're converting all SELECT queries to dynamic, which is just a performance hit.

Dave.Ingram’s picture

OK. What's the test for me to know which queries are dynamic and which are static?

Crell’s picture

First try writing the query as a static. If you find that you need to use one of:

- String concatenation
- Paging
- Tablesort
- Node access restrictions

Then stop and make it dynamic instead.

That's not a perfect rule, but that's a good guideline. The vast majority of queries will be static.

moshe weitzman’s picture

I would add to that ruleset: If you think there is a significant likelyhood that sites will want to alter the query to achieve custom needs, use db_select(). Static queries are not alterable.

moshe weitzman’s picture

Also, if a query currently uses db_rewrite_sql() then you must include '->addTag('node_access')'. Thats missing in a few places.

berdir’s picture

StatusFileSize
new5.45 KB

Reroll.. there were no candicates for static queries, just added addTag() a few times and changed the extend() coding style according to #425872: DX problem with DB extenders. I also "removed" the node_title_list() change from the patch... I think it's easier to convert module per module.

berdir’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch failed testing.

berdir’s picture

StatusFileSize
new5.46 KB

Patch chained a addExpression(1) call... replaced by fields('n', array('nid')).

berdir’s picture

Status: Needs work » Needs review
dries’s picture

Status: Needs review » Fixed

Looks good, and all tests pass. Committed to CVS HEAD.

Status: Fixed » Closed (fixed)
Issue tags: -DBTNG Conversion, -dc2009 code sprint

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