[Typo3-dev] DBAL Drivers
Ries van Twisk
typo3 at rvt.dds.nl
Tue Mar 15 17:40:51 CET 2005
For reference,
this is our dbal setup (in localconf.php)
This will tell Typo3 to connect to 3 different databases
$TYPO3_CONF_VARS['EXTCONF']['dbal']['handlerCfg'] = array (
'_DEFAULT' => array (
'type' => 'native',
'config' => array(
'username' => '', // Set by default (overridden)
'password' => '', // Set by default (overridden)
'host' => '', // Set by default (overridden)
'database' => '', // Set by default (overridden)
)
),
'postgres' => array (
'type' => 'adodb',
'config' => array(
'username' => 'postgres',
'password' => 'secret',
'host' => 'localhost',
'database' => 'ltg',
'driver' => 'postgres'
)
),
'postgres_DEV' => array (
'type' => 'adodb',
'config' => array(
'username' => 'postgres',
'password' => 'secret',
'host' => 'localhost',
'database' => 'ltg_DEV',
'driver' => 'postgres'
)
),
);
Here we tell DBAL wich tables to find in what databases:
> $TYPO3_CONF_VARS['EXTCONF']['dbal']['table2handlerKeys'] = array (
> 'ltg_attr_types' =>'postgres',
> 'ltg_attractions' =>'postgres',
> 'ltg_attr_content_types' =>'postgres',
> 'ltg_attr_contents' =>'postgres',
> 'ltg_feature_types' =>'postgres',
> 'ltg_attr_features' =>'postgres',
> 'ltg_payment_types' =>'postgres',
> 'ltg_payments' =>'postgres',
> 'ltg_attr_payments' =>'postgres',
> 'ltg_price_types' =>'postgres',
> 'ltg_attr_prices' =>'postgres',
> 'ltg_attr_ratings' =>'postgres',
> 'ltg_resource_types' =>'postgres',
> 'ltg_resources' =>'postgres',
> 'ltg_attr_resources' =>'postgres',
> 'ltg_gallery' =>'postgres',
> 'ltg_review_types' =>'postgres',
> 'ltg_attr_reviews' =>'postgres',
> 'ltg_attr_seasons' =>'postgres',
> 'ltg_tour_types' =>'postgres',
> 'ltg_tour_operators' =>'postgres',
> 'ltg_attr_tours' =>'postgres',
> 'ltg_tour_content_types' =>'postgres',
> 'ltg_tour_contents' =>'postgres',
> 'ltg_transportation_types' =>'postgres',
> 'ltg_attr_transportations' =>'postgres',
> 'ltg_rating_types' =>'postgres',
> 'ltg_trip_reports' =>'postgres',
> 'ltg_rating_tables' =>'postgres_DEV',
> 'ltg_ratings' =>'postgres_DEV',
> );
But to be onest, I am not really happy with the situation.
Like told before by other people... Most extentions rely on mysql so
they really need
to be DBAL ready and I am afraid that not many extention develpers are
willing to do that.
The concept of connecting to more then one DB is nice but I rather have
everything in one
database and select on installation what system I want to use
(postgresql, mysql, oracle etc....)
Also DBAL doesn't use any SQL standard, for example:
This will NOT work:
$feu = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_rvtpermapi_ur.perm_rights perm_rights, tx_rvtpermapi_ur.extention
extention, fe_users.usergroup usergroup, fe_users.uid uid ',
'fe_users feu,
tx_rvtpermapi_ur fep',
"feu.uid =fep.uid
AND feu.uid=$uid AND fep.extention LIKE '$extention%';");
This will work
$feu = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'tx_rvtpermapi_ur.perm_rights perm_rights, tx_rvtpermapi_ur.extention
extention, fe_users.usergroup usergroup, fe_users.uid uid ',
'fe_users,
tx_rvtpermapi_ur',
"fe_users.uid =
tx_rvtpermapi_ur.uid AND fe_users.uid=$uid AND
tx_rvtpermapi_ur.extention LIKE '$extention%';");
and more, as long as DBAL IS a choice, then it will always be
'backwards' compatible (According to Karsten).
Then DBAL will never replace the current SQL functions AND more
importand, extentions will never be 100% DBAL compatible
since a lot of extention developers will not use DBAL!!!! This will
break installations with DBAL or without DBAL.
I have heard that DBAL DOES parse the SQL which will slow down any DB
not using MySQL which is kinda bad, not to mention really bad.
If it was for me, I would love to see a AdoDB interface instead of DBAL
and change all ext_tables.sql file to XML schema's (AdoDB can use the
.sql files aswell.)
Then we can use all native functions AdoDB supports (and the DB's), use
the docs that are available and the support AdoDB gives us already.
I think that DBAL at least is not ready for prime time (3.8.0?????) so
maby think about it a second time and use a AdoDB interface????
Maby I am wrong at some places above....
I wonder how many installations are out there that uses a connection to
more then one DB????
just my two cents....
Ries van twisk
>
>>
>> AFAIK DBAL _is_ already part of the core and is using ADODb-Package
>> written in PHP which is already capable of connection to most of the
>> DB-Servers (MSSQL, MySQL, Oracle, MS Access and DB2 are the one I use
>> it for in other projects)
>
> That sounds good, but I never saw any option to select the type of
> database TYPO3 should use. Where can I set that?
>
> You see I have no idea how the whole thing works, and so a
> documenation would be great. From the admin and the developers point
> of view.
>
>
>
>> Until every extension is rewritten in that manner, "only" the core is
>> DBAL-ready -> but that is already a great part of work the developers
>> of the core have done.
>
> This is undisputed... :)
>
>
> Greets
> Thomas
> _______________________________________________
> Typo3-dev mailing list
> Typo3-dev at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev
--
R. van Twisk
http://www.metamorf.net
Our Typo3 enabled website: http://www.livetravelguides.com
Instand help for Typo3? irc:/irc.freenode.net/typo3
Looking for documentation? http://typo3.org/documentation/
More information about the TYPO3-dev
mailing list