[TYPO3-mvc] Custom query against foreign tables in cotroller

Thomas Hucke thucke at web.de
Wed Jun 20 18:44:24 CEST 2012


Hi all,
I need to execute custom queries against foreign tables.
I used to inject the Tx_Extbase_Persistence_QueryFactory in my controller 
and used the create method to get a query  object.

   $sql =  'UPDATE '.$rateTable.' SET '.$rateField.'='.$currentRate.' WHERE 
uid='.$rateUid;
   $query=$this->queryFactory->create('Tx_ThRating_Controller_VoteController');
   $query->getQuerySettings()->setReturnRawQueryResult( TRUE );
   $query->statement( $sql );
   return $query->execute();

The result is empty and I get the following warni´ngs:
    PHP Warning
    PHP Warning: mysql_fetch_assoc() expects parameter 1 to be resource, 
boolean given in /volume1/web/typo3_src-4.5.16/t3lib/class.t3lib_db.php line 
1026
    PHP Warning
    PHP Warning: mysql_free_result() expects parameter 1 to be resource, 
boolean given in /volume1/web/typo3_src-4.5.16/t3lib/class.t3lib_db.php line 
1059

The foreign field dos not get updated.
Could anyone place me a hint how to get it working?

Thanks in advance
Thomas



More information about the TYPO3-project-typo3v4mvc mailing list