ZenphotoCMS Forum
select * from zp_albums again - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: select * from zp_albums again (/thread-8904.html)



select * from zp_albums again - Grimeton - 2011-07-30

Hi,

I just installed the latest version from trunk and got this in my queries again:

`

              307 Query     SELECT * FROM ``zp_albums` WHERE `parentid` IS NULL
              307 Query     SELECT * FROM `zp_albums`

I haven't debugged it yet maybe you know where the select comes from.

Thanks!

KR,

Grimeton




select * from zp_albums again - Grimeton - 2011-07-30

Hi,

found it. It's method cache() from PersistenObject...

KR,

Grimeton




select * from zp_albums again - sbillard - 2011-07-30

You do not say what you are running, but if it is not the development build then this is expected.




select * from zp_albums again - Grimeton - 2011-07-30

Hi,

latest version from trunk, as I said before:

`

$ svn info trunk/

Path: trunk

URL: http://www.zenphoto.org/svn/trunk

Repository Root: http://www.zenphoto.org/svn

Repository UUID: 46129fc4-274e-7f48-8cfa-5da4c607681c

Revision: 7829

Node Kind: directory

Schedule: normal

Last Changed Author: acrylian

Last Changed Rev: 7829

Last Changed Date: 2011-07-30 13:04:17 +0200 (Sa, 30 Jul 2011)

`

The "problem" comes from the method cache() of PersistentObject.

When the system tries to array_diff_assoc the two arrays for the Gallery, the array $cache_set is of size 0 (line 99 in classes.php), so the getWhereClause() function returns just nothing and "SELECT * from zp_albums;" is send to the database (line 118).

I just changed line 117 from "} else {" to } elsif (sizeof($cache_set) > 0) {" to avoid queries without a where clause.

cu




select * from zp_albums again - sbillard - 2011-07-30

As said, use the dev branch