[TYPO3-dev] Using Postgres in an Extension and use pure SQL

Ansgar Brauner ansgarb at gmail.com
Wed Jan 28 16:42:01 CET 2009


ries van Twisk schrieb:
> 
> Can you explain a bit better what you are trying to do?
> 
> Ries
> 
> 
> 
> 
> 

Hi,

I'd like to write my own direct query to a postgres DB. And for that I'd
like to know if I have to write direct AdoDB-Code or if there is any
possibility to use a function like "$GLOBALS['TYPO3_DB']->exec_pureSQL".
Some function which will pass the SQL to the Database without removing
any DISTINCTS or other parts.

At the moment I'm trying to send the following query:

$where  = 'user_id = '.$GLOBALS['TSFE']->fe_user->user['myext_userid'];
$select = "DISTINCT(to_char(date, 'DD.MM.YYYY')) AS date_only";

dates   = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
            $select,
            $this->table, $eWhere
          );

The problem is that the part between SELECT and FROM is wiped out and i
got an error message like this:

FEHLER: Syntaxfehler bei »FROM« at character 12
SELECT
FROM "myext_table"
WHERE
"user_id" = 402


It seems like the part between SELECT and FROM is removed by dbal.


Thanks

regards

Ansgar




More information about the TYPO3-dev mailing list