CActiveDataProvider and Custom SQL query (PostgreSQL tsearch2)

Hi Everybody!

Can you help me? I use Postgres and its full text search engine named tsearch2. Problem is I want to pass search query result into the CListView and use its pagination feature. I can make pure SQL query and convert its result into CArrayDataProvider, but in this case LIMIT and OFFSET features wont work. If there will be 1000 results all of them will be selected and loaded into view. And it will be repeater every time user changed page.

There is only way to avoid it - using CDbCriteria to be passed into CActiveDataProvider. But, unfortunatelly, I don’t know how to change FROM clause in a such construction. To make search query you need to add to_tsquery call into the FROM clause.


SELECT … FROM Texts, to_tsquery(‘Brain upgrade’) AS q WHERE …

Does somebody have any idea how to implement it?

Thanx in advance!

There’s another one: CSqlDataProvider

Thank you!!! That’s exactly I need!