pdo::mysql and unbuffered queries

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

 



Hello there,

I tried using pdo (www.php.net/pdo) as it would be nice for my projects to be portable to another database systems, but quickly ran into problems.

The lesser important: One time, there was a simple typo in one of my queries and I got an error that php is not able to save session variables at the given path - I'm not joking! I worked several hours to solve that session problem just to realize the query had a bracket to few. I already got other errors in my queries where I was given a correct error trace, this is quite confusing.

The bigger important: I was not able to build nested queries. For example: Imagine you are running a bulletin board, and you have to select 10 posts in a thread. To each post, there is another information which is needed to be resolved from the database, so I have 1 more query for each of these posts. This is possible only with one of two workarounds .. I can use pdoStatement::fetchall() to instantly load all result rows into one array and afterwards looping through this array. After years of programming in "classic php-mysql I am not used to this method at all and I do not think this is nice programming in concerns of memory usage as this array may become very big. The other option is to force queries to be buffered via the constantPDO::MYSQL_ATTR_USE_BUFFERED_QUERY, but then I would gave up independence as such code is not anymore compatible to other dbms than mysql.
In simple words: Can I have best of both worlds?

Big thanks in advance,
Thomas Tschernich
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux