A few suggestions..
--------------------------
Fetching into objects:
This really needs to be sorted out early on, and kludging support for something that perhaps should be the default behavour is looking very messy:
a) if you want to fetch into a specific class, make that class extend PDO...
class myobject extends PDO {}
b) default fetch behaviour returns a clone of it'self with a pointer to the row (eg. lazy fetching..)
$pdo = new myobject;
$pdo->query('select ....');
while ($clone = $pdo->fetch()) {
echo $clone->some_column..
}
c) other fetch methods can be done by arguments:
$pdo->fetch(PDO::ARRAY), // standard KEY/VALUE ARRAY
$pdo->fetch(PDO::VALUES), // just the VALUES
$pdo->fetch(PDO::SINGLE), // single col. eg. 1 row fetch..
$pdo->fetch(PDO::NO_CLONE), (fetches into the object - so you have to manually clone it.)


--------------------------
Bound columns
Please ditch this for the time being (It's evil ;).. - Jeff's blog backs up my impression that this is magic code that should be removed. - Bound columns for use in updating should really only be done with the result object.


--------------------------
Connection configuration
something like:
PDO::registerConnection("myconnection", "mysql://......"); <- all the conneciton option in here... (like persistant / any compatibility stuff (like strtolower'ing oracle results..)


$x = new PDO("myconnection");

--------------------------
Long term plan? -
Is it better if the API's for DBDO and PDO slowly merged, where feasible.. ? -


I've no idea how feasible the query building is in PDO, - You need two facilities
a) blind schema quering (eg. DESCRIBE TABLE xxxx), and abstract type map defined
b) result schema querying (eg. mysql_field_type), and abstract type map


Regards
Alan




Marcus Boerger wrote:

Hello Jeff,

Monday, October 25, 2004, 8:09:20 PM, you wrote:




On Oct 25, 2004, at 8:48 AM, Lukas Smith wrote:





D Kingma wrote:


I just took a view at some PDO examples on the net and it looks promissing. The
one thing that I would to see is that the fetch method accepts a class name as
optional second parameter (when using PDO_FETCH_OBJ or PDO_FETCH_LAZY) and then
returns a new instance of the given class with the given result row as
properties (when defined in the class).


Yes, that as on the todo at somepoint. Atleast it was on Marcus's todo list at somepoint. Another cool thing to have would be to also be able to pass an existing class instance instead of a class name.





I really like that idea. You don't really need the ability to pass a class name if you have that ability:





$obj = $stmt->fetch(PDO_FETCH_OBJ, new MyObject());



You do! First there is the problem of protected/private variables and second the idea behind is being able to specify the classname already in execute() and to pass along some ctor params. This allows to initialize instances both all with the same parameters and with values from the actual query. And it allows that inside iteraotr based access which will kill all overhaed.

But you are right, we will provide special access functions for the
different functionality as needed.

regards
marcus




-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to