Need a universal query method for DAO

As addressed in Guide:

Quote

A SQL statement is executed via CDbCommand in one of the following two ways:

    *

      execute(): performs a non-query SQL statement, such as INSERT, UPDATE and DELETE. If successful, it returns the number of rows that are affected by the execution.

    *

      query(): performs an SQL statement that returns rows of data, such as SELECT. If successful, it returns a CDbDataReader instance from which one can traverse the resulting rows of data. For convenience, a set of queryXXX() methods are also implemented which directly return the query results.

This means I have to know query type( select or insert/update/delete) for every query in advance, however it gives me problems to wrap some 3rd party lib/app into yii extensions, since some of them are using sth like mysql_query() which works for all types of queries.

Does Yii DAO have sth equivalent? if not, I think we should add a universal query method for DAO.

If you don't care about query results, you can always use execute(), even for SELECT statements.

Quote

If you don't care about query results, you can always use execute(), even for SELECT statements.

I have thought about it, however this is not a good solution, for instance,  in one of my current extension, I need to use the return results as callback params, execute() just can't be used here.

I think it would be worthy to add a universal query method to yii DAO to fulfill yii's goal of extensibility.

I'm not sure this is really good or not. As you can see, even PDO is differentiating the two kinds of call (exec vs. query).