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

Thomas Hucke thucke at web.de
Sun Jun 24 14:53:43 CEST 2012


Hmm,

do not get working using extbase.
Now I choosed

$queryResult = $GLOBALS['TYPO3_DB']->exec_UPDATEquery ($rateTable,'uid = 
'.$rateUid,array($rateField => $currentRate)) ;




"Thomas Hucke"  schrieb im Newsbeitrag 
news:mailman.1.1340210665.15681.typo3-project-typo3v4mvc at lists.typo3.org...

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