[TYPO3-dam] Bug in selection at backend (like Patrics)

Jonas Tränkner jonas.traenkner at airgamer.de
Fri Dec 15 12:59:19 CET 2006


Hi list,

with my installation of DAM 1.1 beta 03 i have the same bug like Patric has with selections in the backend.

In the generated SELECT clause, there is a missing 'tx_dam_cat' after FROM,
So the SELECT fails because he doesn't know where the tx_dam_cat.delete comes from.

I think what is missing is adding the tables of $select['enableFields'] to $queryParts['FROM'] in class.tx_dam_querygen.php function getQueryParts.
(I did a hack and I add 'tx_dam_cat' to queryParts['FROM'] if is in array of enabled Fields)

[Hack at line #437]
if(isset($select['enableFields']['tx_dam_cat'])){
	$queryParts['FROM'] .= 'tx_dam_cat, ';
}
[/Hack]


I have another question besides this:

For example, dam selection generates this sql:

//========================
SELECT DISTINCT tx_dam.title, tx_dam.uid, tx_dam.pid, tx_dam.media_type, tx_dam.tstamp, tx_dam.crdate, tx_dam.cruser_id, tx_dam.deleted, tx_dam.sys_language_uid, tx_dam.l18n_parent, tx_dam.hidden, tx_dam.starttime, tx_dam.endtime, tx_dam.fe_group, tx_dam.file_name, tx_dam.file_dl_name, tx_dam.file_path, tx_dam.file_size, tx_dam.file_type, tx_dam.file_ctime, tx_dam.file_hash, tx_dam.file_mime_type, tx_dam.file_mime_subtype, tx_dam.file_status, tx_dam.parent_id FROM tx_dam_cat, tx_dam LEFT JOIN tx_dam_mm_cat AS tx_dam_mm_cat_a ON tx_dam.uid=tx_dam_mm_cat_a.uid_local LEFT JOIN tx_dam_mm_cat AS tx_dam_mm_cat_b ON tx_dam.uid=tx_dam_mm_cat_b.uid_local LEFT JOIN tx_dam_mm_cat AS tx_dam_mm_cat_c ON tx_dam.uid=tx_dam_mm_cat_c.uid_local WHERE 1 AND tx_dam.pid IN (27) AND tx_dam.sys_language_uid=0 AND tx_dam.file_status!=255 AND tx_dam_mm_cat_c.uid_foreign IN (2) AND (tx_dam_mm_cat_a.uid_foreign IN (117,118,186,205,523,531,119,187,206,524,532) OR tx_dam_mm_cat_b.uid_foreign IN (2)) AND tx_dam.deleted=0 AND tx_dam_cat.deleted=0 ORDER BY tx_dam.title LIMIT 200,20
//========================

Database stats:
Tx_dam: about 3000 media
Tx_dam_cat: about 1043 categories
Tx_dam_cat_mm: about 6000 rows

Above SQL statement has an execution time about 30 seconds.
I am not an expert in SQL, so my question is: can this be optimized?
Or is this a 'common' sql query, which should be executed in a less time?

Greetings

Jonas

-----Ursprüngliche Nachricht-----
Von: typo3-project-dam-bounces at lists.netfielders.de [mailto:typo3-project-dam-bounces at lists.netfielders.de] Im Auftrag von Patric Pesch
Gesendet: Dienstag, 12. Dezember 2006 11:14
An: typo3-project-dam at lists.netfielders.de
Betreff: Re: [TYPO3-dam] DAM 1.1 beta03 for download

René Fritz schrieb:
> ... here
> 
> http://typo3lab.colorcube.de/dam.html
> 

Hi, i've updated to the new beta (from beta02).
But now i always get an SQL-error in the list-module.

SELECT COUNT(DISTINCT tx_dam.uid) as count FROM tx_dam LEFT JOIN
tx_dam_mm_cat AS tx_dam_mm_cat_a ON tx_dam.uid=tx_dam_mm_cat_a.uid_local
WHERE 1 AND tx_dam.pid IN (6) AND tx_dam.sys_language_uid=0 AND
tx_dam.file_status!=255 AND (tx_dam_mm_cat_a.uid_foreign IN (3)) AND
tx_dam.deleted=0 AND tx_dam_cat.deleted=0

ERROR	Unknown table 'tx_dam_cat' in where clause

What am i doing wrong? First i've just replaced the old files with the
new ones. After getting the error, i've deinstalled all DAM-Extensions
and reinstalled them. But the same Error occurs again.

I do not understand the missing JOIN to the category-table. This can't
be an general DAM-error, i think, cause it seems that nobody else has
this error. What can i do? I'd like to have the new features. :-)

Btw. many many many thanks to René Fritz for this great extension!

greetings
Patric
_______________________________________________
TYPO3-project-dam mailing list
TYPO3-project-dam at lists.netfielders.de
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-project-dam


More information about the TYPO3-project-dam mailing list