Re: PDO and buffered queries

From: Date: Sun, 01 Apr 2007 08:42:30 +0000
Subject: Re: PDO and buffered queries
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-251878@lists.php.net to get a copy of this message
On 4/1/07, Larry Garfield <larry@garfieldtech.com> wrote:
So there's no PDO experts out there, eh? :-(
No, not really a PDO expert ;)
On Wednesday 28 March 2007 11:14 pm, Larry Garfield wrote: HI all. The PHP.net manual is somewhat unclear on this point, so I thought I'd ask here. Does PDO automatically buffer queries the way that the mysql_* extension does, in order to allow multiple result sets open at the same time? Or is that something that has to be set on the connection, and if so, is that available for all drivers? I ask because I am running into a problem with a query segfaulting on me, but only under PHP 5.1 with PDO from pecl. It ran fine in PHP 5.2.0. The only mention in the manual on this subject is: http://us2.php.net/manual/en/ref.pdo-mysql.php "If this attribute is set to TRUE on a PDOStatement, the MySQL driver will use the buffered versions of the MySQL API. If you're writing portable code, you should use PDOStatement::fetchAll() instead." The sample code there suggests that nothing does buffered queries except the MySQL driver. I find no mention of that anywhere else, though, one way or another. Of course, using fetchAll(), as it suggests, means that I only get arrays, not objects. (Unless I'm misreading those docs, too.) Any PDO experts out there able to shed some light on the situation? I'm thoroughly confused at this point, and the manual is quite unclear on all of the important details I care about. :-) --
Larry Garfield                        AIM: LOLG42
larry@garfieldtech.com                ICQ: 6817012
The manual isn't very clear at this part, but from what i understand
of you is that you want to get objects from PDO using fetchAll(). Normally you would used fetch()? If so, it shouldn't be too hard i think as fetchAll() accepts the same constants as fetch() does. You should pass PDO::FETCH_OBJ: as first parameter for the fetchAll() function. If this wasn't what you were looking for, then sorry for wasting your time, as I'm no PDO expert. But I thought lets give it a shot :) Tijnema

« previous php.general (#251878) next »