Just following up from our chat on IRC for the benefit of those
watching this dicusssion here on the list.
If you want all the rows at once, use fetchAll().
If you want to seek the result set without fetching everything at
once, use a scrollable cursor.
If you want to fetch the rows one at a time and don't need random
access, use the default forward-only cursor.
We don't have a separate result set object for two reasons: it makes
the guts of PDO more simple and, IMO, makes the script more simple
two. (plus, this is good enough for the perl guys).
The statement object is, of course, necessary to be able to have some
context for parameter binding.
--Wez.
On Tue, 19 Oct 2004 23:43:19 +0200, Lukas Smith <lsmith@xxxxxxx> wrote:
> Wez Furlong wrote:
> > PDO won't have buffered queries in the mysql sense; instead we have
> > different cursor types for the statement handle. This isn't
> > completely implemented yet, but the idea is that you will choose a
> > scrollable cursor in the case where you need to be able to jump around
> > the result set.
>
> uhm .. now this doesnt sound as simple as things are now in mysql. this
> also sounds like people will have to then explictly manage freeing the
> buffer instead of now where things can happen automatically once no
> variable refernces the result set. I still think that you are mixing two
> things that dont have anything to do with eachother and that you are
> making things less intuitive and less simple. If your argument is
> correct why bother even having a statement object? MDB actually works
> fine with prepared queries without one and return result ressources (not
> objects). With MDB2 I moved to having result object and statement
> objects and I find it much clearer and also much simpler to prevent
> unintentional memory leaks.
>
> regards,
> Lukas
>
|