Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
blog.module
Priority:
Normal
Category:
Task
Assigned:
Issue tags:
Reporter:
Created:
31 Aug 2008 at 12:32 UTC
Updated:
2 Jan 2014 at 23:45 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
eclipsegc commentedOne more time
Comment #3
R.Muilwijk commentedUnfortunatly it breaks blog API tests. See the attached picture.
Comment #4
R.Muilwijk commentedComment #5
eclipsegc commentedActually BlogAPI appears to break w/ or w/o this code. Please verify. (also turn clean URLS on it'll run faster)
Comment #6
R.Muilwijk commentedHmmz this is strange. I just did a new checkout and all the tests passed. Then I applied your patch and it still passed :S
Comment #7
R.Muilwijk commentedThe dblog test is failing because of the function _blog_post_exists. You typecast a object to boolean here._blog_post_exists
Comment #8
catchBlogAPI weirdness was here, now passes in head: http://drupal.org/node/297860
(this is why all tests should always pass).
Comment #9
Anonymous (not verified) commentedThe last submitted patch failed testing.
Comment #10
Dave.Ingram commentedWorking on this as of the DrupalCon DC Code sprint... patch coming soon
Comment #11
dave reidComment #12
Dave.Ingram commentedOK. 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.
Comment #13
Crell commentedDo 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.
Comment #14
Dave.Ingram commentedOK. What's the test for me to know which queries are dynamic and which are static?
Comment #15
Crell commentedFirst 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.
Comment #16
moshe weitzman commentedI 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.
Comment #17
moshe weitzman commentedAlso, if a query currently uses db_rewrite_sql() then you must include '->addTag('node_access')'. Thats missing in a few places.
Comment #18
berdirReroll.. 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.
Comment #19
berdirComment #21
berdirPatch chained a addExpression(1) call... replaced by fields('n', array('nid')).
Comment #22
berdirComment #23
dries commentedLooks good, and all tests pass. Committed to CVS HEAD.