[TYPO3-dev] Using Postgres in an Extension and use pure SQL
Martin Kutschker
martin.kutschker-n0spam at no5pam-blackbox.net
Wed Jan 28 17:01:42 CET 2009
Ansgar Brauner schrieb:
> 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.
Why don't you use the PG-functions directly? First of all
$GLOBALS['TYPO3_DB'] is ONLY meant to be used with the main DB
connection of TYPO3. You could create your own instance of t3lib_db
though. But in this case you'd gain little as the class works only
directly with Mysql.
If you don't like to write SQL directly you could use DBAL. You can
configure a mapping of tables, so that every query on your tables will
be sent to the Postgresql server (see DBAL docs). But that's quite an
overhead.
If you don't need a portable app and make only a few queries IMHO using
the PG-functions will be the best and fastest (development and
performance) solution.
Masi
More information about the TYPO3-dev
mailing list