This patch enables pager_query() sql to span multiple lines, which is my preferred way of writing long sql queries as they're more readable. Without this patch, those using multiline (as in with line breaks in them) sql will find that theme_pager() returns the wrong number of pages.
This patch just solves this issue for pager_query, though there may be many other places in the drupal code where multiline sql isn't supported. Indeed, Drupal coding style says to keep sql to one line. But for usability, I believe the coding style should be changed.
The patch simply changes two . in a preg_replace to (.|\n) to enable line returns to return true as well.
before:
$count_query = preg_replace(array('/SELECT.*?FROM/As', '/ORDER BY .*/'), array('SELECT COUNT(*) FROM', ''), $query);
after:
$count_query = preg_replace(array('/SELECT(.|\n)*?FROM/As', '/ORDER BY (.|\n)*/'), array('SELECT COUNT(*) FROM', ''), $query);
Comments
Comment #1
jakeg commentedchanging what project it refers to
Comment #2
ax commentedpager_query() sql should be able to span multiple lines because of the s modifier (
'/SELECT.*?FROM/As', last char). could you please provide an example where multiline sql makes it fail? i'd guess there is another reason ...Comment #3
LAsan commentedAny news about this?
Moving to cvs.
Comment #4
moshe weitzman commentedobsoleted by #299267: Add "Extender" support to SELECT query builder?
Comment #5
damien tournoud commentedReassigned to D6.
Comment #6
dpearcefl commentedAt this point, no new features will be added to D6. If you think Drupal 8 needs this feature, please assign this issue to D8.