Re: PDO and buffered queries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sunday 01 April 2007 3:42 am, Tijnema ! wrote:

> > 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@xxxxxxxxxxxxxxxx                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

Hrm.  See, here's the trick.  I'm trying to write a PDO backend driver for an 
existing abstraction layer, as the first step in deprecating the existing 
layer.  That means I want to keep the existing flow as much as possible.  

The manual seems to say I don't get buffered queries, and therefore don't get 
the ability to run multiple queries at the same time.  However, in testing 
with MySQL I have no problem at all with multiple queries at the same time.  
I don't know if that's me misunderstanding the manual, misunderstanding how 
result sets work, or MySQL doing extra magic for me even though I don't tell 
it to.

I'm all confused. :-(

Of course, I'm also getting mysterious segfaults under PHP 5.1.6 with PDO-PECL 
that don't happen under PHP 5.2, which is another thing making it harder...

-- 
Larry Garfield			AIM: LOLG42
larry@xxxxxxxxxxxxxxxx		ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux