Bug #27296
wrong results when using "DESC" and "limit" with a table which contains more entries than the "limit" parameter
| Status: | New | Start date: | 2011-06-08 | |
|---|---|---|---|---|
| Priority: | Should have | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | - | |||
| Target version: | - | |||
| Votes: | 0 |
Description
So, let's say i want a RSS of the 10 latest news, from the tt_news table, which contains 30 news:
I will use that typoscript
lib.in2rssFeed {
template = fileadmin/templates/rss.html
sorting = DESC
limit = 20
// table 1 (tt_news)
10 {
settings {
table = tt_news
....
....
A query like this will be generated:
SELECT uid, pid, title rssTitle, bodytext rssBody, short rssDescription, tstamp rssSorting, tstamp rssCrdate, image rssImage FROM tt_news WHERE pid IN ( 41 ) AND ..... AND .......... ORDER BY tstamp LIMIT 10
and i will have my 10 oldest entries, in descending order, instead of getting my 10 latest entries, descending order.
A good query will be : (order by ... DESC)
SELECT uid, pid, title rssTitle, bodytext rssBody, short rssDescription, tstamp rssSorting, tstamp rssCrdate, image rssImage FROM tt_news WHERE pid IN ( 41 ) AND ..... AND .......... ORDER BY tstamp DESC LIMIT 10
Maybe i missed something, but i think it's a "missing feature" :)
And what if we want a feed of 2 tables, one in ASC and one in DESC ?
I don't know if i'm clear, but a "sorting" parameter for each table will be great :)
Something like that :
lib.in2rssFeed {
template = fileadmin/templates/rss.html
limit = 20
// table 1 (tt_news)
10 {
settings {
limit = 10
sorting = DESC # "sorting for this table only"
table = tt_news
......
.....
}
.......
}
// table 2 (tt_content)
20 {
settings {
limit = 10
sorting = ASC # "sorting for this table only"
table = tt_content
......
.....
}
.......
}
.....
}
And in file class.tx_in2rss_div.php, in the getValuesFromDB() function, line 73, something like that :
change $this->cleanString($conf['settings.']['fieldSorting']),
to $this->cleanString($conf['settings.']['fieldSorting']).' '.$conf['settings.']['sorting'],