Posted by Simon Stienen on 04/03/07 03:15
On 2007-04-03 05-51-52, Jerry Stuckle wrote:
> No, the DB object represents a QUERY.
a) Why isn't the query represented by a QUERY object?
b) It's definitely NOT true that an object represents something and then
something else (even if of the same type). The OOP approach would be to
have a QUERY object represent a query and build a new query object for a
new query. Additionally, it's bollocks to use a single query object
throughout the whole application for several queries. Especially if this
query object is called DB.
Next: A result is not a query but the result of a single invocation of this
query, therefore regardless how you call your query object, it's still
stupid to store the result in the same object. It should be returned as a
new instance of a result type - just as I mentioned several posts before.
Third: Taking C++ as an example: MySQL++ is doing exactly that. There is
mysqlpp::Query (not mysql::DB! - to all the onlookers not familiar with
C++: In C++ the scope operator :: is also used to seperate namespaces from
type names within them - just take the whole "mysqlpp::*" as typename to
use with new) which has a few methods to execute the query which will then
return a mysqlpp::Result instance. Just as I said. It's all in
understanding the purpose of the object.
[Back to original message]
|