Quote from: lossendae at Aug 27, 2009, 07:35 PM
That’s what i thought also, but as you can there are 512M allowed which was for testing and also very high.
Seems like a memory leak or something else to me, no?
I’ve read several forums where people encounter the same kind of issue with ORM or xmlppc.
I’ll keep searching since i really need to play with select statement.
edit:
It’s really confusing.
I’ve tested with Wamp -> Apache 2.2.10 - 2.2.11 - 2.2.12 -> PHP 5.2.9 - 5.2.9-1 - 5.2.9-2 - 5.3
and now with xampp -> Apache 2.2.12 -> PHP 5.3.0
And it’s always the same result.
How could the implementation of PDO can be wrong with all those configurations?
Ok, let’s back up.
The connection resetting is the only indicator that there is a problem with the PDO driver for MySQL. This can be wrong in all those configurations because the problems are in the MySQL client version that are compiled against PHP, and with all the controversy with MySQL and PDO in the last 2 years, the more recent configurations are the ones that are turning out buggy. BTW, what versions of MySQL server and client are being used in those MAMP/XAMPP versions?
That said, I now see that you have some problems with what you are attempting to do.
First, remember that xPDOObjects are a bit heavier in memory usage than just an associative array result set. When working with xPDO, you need to carefully decide if you want to return a collection of objects or just a result set to work with directly. You can manually instantiate objects from that result set as needed using the xPDOObject->fromArray() method, and that works well in some cases. It’s generally never a good idea to select all the rows with all the columns from the modResource (site_content) table; I don’t know how many rows, or how much content you have stored in the content field of those rows, but that could easily come to over 512Mb of data, no matter if you return objects or not.
Next and regardless of the above, you can achieve what you are trying to do in the second select() call (which is known as lazy loading), BUT YOU MUST INCLUDE ALL PRIMARY KEY COLUMNS, and you cannot rename columns that will be used to load the object, e.g.
<?php
$c->select('modResource.id, modResource.pagetitle, Author.username');
?>
That should work fine, and reduce the memory requirements of your objects since they will only include the data for the id and pagetitle fields.
But, with great power comes great responsibility; beware with lazy loading, because if you try to get() a field that you didn’t include (or all fields with toArray()) on a lazy object, a query will be executed to retrieve each additional column’s data to populate the field values.