But I can't figure out how to call CDbConnection without passing a connectionString. I can't just run 'new CDbConnection' because Yii complains that connectionString can't be empty. Why doesn't Yii just read it from the config file?
When using prepared statements, I want to provide the parameters as an array. You'll notice in my sample code that I used:
<?php $stmt->execute($params);
The second item is more of a strong preference than a requirement. I want to have a generic class for DB access that accepts a query string and an uncertain number of parameters. But thinking about it a bit more, I could do without that.
As for PDO::FETCH_CLASS, I use it because it allows me to run the result set through a constructor and get objects with methods. I don't use this a lot right now. Currently the ony thing the constructor does is concatenate the 'firstname' and 'surname' fields into a single 'name' property. But I was thinking that having the return set be a bunch of objects could come in handy later, if I want to add methods to those objects.
Anyways, looking at the DAO page on the guide, I could not see how to get the above two features.