DEPRECATION WARNING
This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.
EXT: rvt_adodb¶
Author: | Kasper Skårhøj |
---|---|
Created: | 2002-11-01T00:32:00 |
Changed by: | ries van Twisk |
Changed: | 2006-09-10T08:28:50 |
Author: | (R.van Twisk) |
Email: | ries@vantwisk.nl |
Info 3: | |
Info 4: |
EXT: rvt_adodb¶
Extension Key: ltg_ADOdb
Copyright 2005-2006, (R.van Twisk), <ries@vantwisk.nl>
This document is published under the Open Content License
available from http://www.opencontent.org/opl.shtml
The content of this document is related to TYPO3
- a GNU/GPL CMS/Framework available from www.typo3.com
Table of Contents¶
EXT: rvt_adodb 1
Introduction 1
What does it do? 1
Users manual 2
FAQ 2
Administration 2
Configuration 2
FAQ 3
Known problems 3
To-Do list 3
Introduction¶
What does it do?¶
Not Like Roberts Lemkes this extension it initializes the ADOdb library in your typo3 installation. It will automatically connect to the appropriate databases as provided by the Database Abstraction Layer (DBAL in short) structures found in your typo3temp/ directory. ADOdb is NOT included to keep TER polluted with space, it uses Robert Lemkes extention (called adodb).
So WHY you might ask??? Well, I had in the past numerous problems with DBAL (SQL parser, minor speed issues, problems with same tables names in two different databases etc....)
Of course this method has down and upsides.
Using this extention as one downside:
You cannot move a single table to a other database, for example sys_stat cannot be moved to PostgreSQL for example. Normally this would not be a problem because your 'other' database is something you want to connect to, not moving your typo3 tables to a other DB. Also... at least 50% of the extensions, and properly more are not DBAL ready anyways so better stick to MySQL for now and wait until extension developers are really moving to DBAL (IMHO).
The upside is this:
1) Using direct ADOdb interface, no sql parser what-so-ever... means fast interface. 2) Can have the same table name in both databases. 3) Can use cross database schema's using the ADOdb schema class (can import and export schema's to and from XML, which will be used by typo3 in feature at some point I hope...) 4) Can convert your SQL to the new DBAL later on with only minor changes (you have special needs anyways... so this needs to be done no mater what ....). 5) ADOdb is mature and thus stable, and even faster then some standard calls using the ADOdb extension.6) You can use any SQL (joins etc....) BUT bear in mind NOT to use any specific DB functions when you want to make you extension cross database capable!!!! Try to test on more then just your favorite DB!!!
For now I would advice you to use it (adodb & rvt_adodb) when you have your own special needs, or when a project really requires it (intranet or when you run you own webserver and have full access to everything).
Users manual¶
The extension will automatically initialize the required databases and brings them into the globals var space to
$GLOBALS['TYPO3-ADOdb'][<database key name>]]
For example in the configuration below it brings it to:
$GLOBALS['TYPO3-ADODB']['postgresq_hostip']
$GLOBALS['TYPO3-ADODB']['mysql_hostip']
From then you can use all ADOdb calls directly:
$resource = $GLOBALS['TYPO3-ADODB']['postgresq_hostip'] -> Execute("SELECT * FROM table WHERE key=123");
while ($array = $resource -> FetchRow()) {
print_r($array);
}
$resource = $GLOBALS['TYPO3-ADODB']['mysql_hostip'] -> Execute("SELECT * FROM table WHERE key=123");
while ($array = $resource -> FetchRow()) {
print_r($array);
}
FAQ¶
- I don't have any.... do you?
Administration¶
- No administration needed, only a configuration
Configuration¶
Configuration is done at the same way as DBAL would do it, so we can easily move back to DBAL when it's stable and mature.
That means we are using this array:
$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)
)
),
'postgresq_hostip' => array (
'type' => 'adodb',
'config' => array(
'username' => 'username',
'password' => 'password',
'host' => 'localhost',
'database' => 'databasename',
'driver' => 'postgres'
),
),
'mysql_hostip' => array (
'type' => 'adodb',
'config' => array(
'username' => 'username',
'password' => 'password',
'host' => 'localhost',
'database' => 'databasename',
'driver' => 'mysql'
),
),
);
The name 'postgresq_hostip & mysql_hostip'are just a names and is used for recognition later on in your extension (see above).
::¶
Config Option
type
Meaning
This MUST be ADOdb, otherwise this extension will not initialize the database!
::¶
Config Option
config
Meaning
A array with configuration options for the DB
::¶
Config Option
username
Meaning
User name of the database
::¶
Config Option
password
Meaning
Password of the database
::¶
Config Option
host
Meaning
What system to find the database
::¶
Config Option
database
Meaning
The name of the database
::¶
Config Option
driver
Meaning
The driver that ADOdb is going to use (postgres, mysql, mssql etc... etc...)
Notes:
Note that the configuration '$TYPO3_CONF_VARS['EXTCONF']['dbal']['table2handlerKeys'] ' is NOT used!!!
The _DEFAULT option is IGNORED by this extension!
The type MUST be ado db (lowecase)
FAQ¶
- Q) I have seen that you have a adodb/ directory, I can put the ADOdb library in there from adodb.sf.net?
- A) Yes you can, then it will NOT Robert Lemkes library anymore but the version found in the adodb/ directory. The system checks for the file 'adodb/adodb.inc.php' and if found, it assumes that ADOdb is installed there and will be initialized. This is really handy if you want to use a updated of ADOdb. The version of Robert L. is patched for TYPO3 anyways...
Known problems¶
- Not know yet...
To-Do list¶
- Make a BE plugin to show database statistics.
- Make a BE plugin for export/import XML schema's
EXT: rvt_adodb - 3