[TYPO3-mvc] $query-count() bei suche mit JOIN / Sortierung deutscher Wörter

Illi, Cornelius Cornelius.Illi at student.hpi.uni-potsdam.de
Mon Aug 9 10:53:56 CEST 2010


I added some code to the getObjectCountByQuery() method in Typo3DbBackend.php:

		if( !isset($statementParts['keywords']['distinct']) ) {
			$statementParts['fields'] = array( 'COUNT(*)' );
		} else {
			$className = $query->getSource()->getNodeTypeName();
			$tableName = $this->dataMapper->getDataMap($className)->getTableName();
			$statementParts['fields'] = array( 'COUNT(DISTINCT '.$tableName.'.uid)' );
			unset( $statementParts['keywords']['distinct'] );
		}

That does solve the problem. If no one disagrees I gonna create a RFC for that.
Cheers, Cornelius

-----Original Message-----
From: typo3-project-typo3v4mvc-bounces at lists.typo3.org [mailto:typo3-project-typo3v4mvc-bounces at lists.typo3.org] On Behalf Of Illi, Cornelius
Sent: Friday, August 06, 2010 3:29 PM
To: TYPO3 v4 MVC project
Subject: [TYPO3-mvc] $query-count() bei suche mit JOIN / Sortierung deutscher Wörter

Hi everyone

I am racking my head on two problems and could need your advice:
First, I implemented a search-function, which also examines properties of aggregated objects. For example:

SELECT u.* FROM u LEFT JOIN x WHERE (x.uid=1 OR x.uid=2)

Where "u" is a company and "x" is an option. A company hence appears twice if it has both options.
As for the actual query it is automatically resolved by a DISTINCT u.*.
In the Count-Query ($query->count()) the DISTINCT is just put in front of a COUNT(*), which cannot work, the way it is supposed to.

A COUNT(DISTINCT u.uid) or a GROUP BY u.uid would work, tough. I think that this is something that requires an extension of the framework, but I could be wrong.

Furthermore, I'd like to know how you resolve comparison of german words? Usually words with german umlauts are put to the end, but a and ä should be in the same place.
One possibility would be to put a "COLLATE 'latin1_german2_ci" to the end of a query, as the collation of the table itself isn't used for a utf8-connection. Any good solutions?

Thanks & Kind regards,

Cornelius
_______________________________________________
TYPO3-project-typo3v4mvc mailing list
TYPO3-project-typo3v4mvc at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc


More information about the TYPO3-project-typo3v4mvc mailing list