Skip to content

Commit c51b319

Browse files
author
Francois Suter
committed
[TASK] Removed dependency on "adodb", updated documentation
Change-Id: Ie3abee86cc02b7a05e4996a044073a743ad27639
1 parent 69e95a1 commit c51b319

File tree

6 files changed

+28
-28
lines changed

6 files changed

+28
-28
lines changed

Classes/Service/ConnectorSql.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616

1717
use Cobweb\Svconnector\Service\ConnectorBase;
1818
use Cobweb\SvconnectorSql\Database\DatabaseConnectionFactory;
19+
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
1920
use TYPO3\CMS\Core\Utility\GeneralUtility;
21+
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
2022

2123
/**
2224
* Service "SQL connector" for the "svconnector_sql" extension.
@@ -40,6 +42,13 @@ public function init()
4042
{
4143
parent::init();
4244
$this->extConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConfiguration'][$this->extKey]);
45+
// If running TYPO3 7...
46+
if (VersionNumberUtility::convertVersionNumberToInteger(TYPO3_branch) < VersionNumberUtility::convertVersionNumberToInteger('8.0.0')) {
47+
// ...and extension "adodb" is not loaded, flag the service as unavailable
48+
if (!ExtensionManagementUtility::isLoaded('adodb')) {
49+
return false;
50+
}
51+
}
4352
return true;
4453
}
4554

Documentation/Configuration/Index.rst

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ parameters:
2020
| driver | string | Name of the database system to connect to, taken from the list of |
2121
| | | available drivers. |
2222
| | | |
23-
| | | | |
24-
| | | |
2523
| | | For ADODB, see http://phplens.com/adodb/supported.databases.html |
24+
| | | |
2625
| | | For Doctrine DBAL, see http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#driver |
2726
+-----------------+---------------+------------------------------------------------------------------------------------------------------------------------------+
2827
| server | string | Address of the server to connect to. |
@@ -36,8 +35,6 @@ parameters:
3635
| uri | string | Connection information in URI-like syntax. **Used only with Doctrine DBAL.** Reference: |
3736
| | | http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url |
3837
| | | |
39-
| | | | |
40-
| | | |
4138
| | | **Example:** |
4239
| | | |
4340
| | | .. code-block:: text |
@@ -50,8 +47,6 @@ parameters:
5047
| | | parameter :code:`query`) is executed. This is typically used to |
5148
| | | temporarily change the encoding. |
5249
| | | |
53-
| | | | |
54-
| | | |
5550
| | | **Example:** |
5651
| | | |
5752
| | | .. code-block:: sql |
@@ -63,8 +58,6 @@ parameters:
6358
| | | Used to choose the fetch mode, which influences the type of |
6459
| | | array returned by the recordset (numerical, associative or both) |
6560
| | | |
66-
| | | | |
67-
| | | |
6861
| | | For ADODB, use numerical values. Reference: http://phplens.com/lens/adodb/docs-adodb.htm#adodb_fetch_mode |
6962
| | | |
7063
| | | For Doctrine DBAL, use the name of the constants from the PDO drivers. |
@@ -77,24 +70,15 @@ parameters:
7770
Connection methods
7871
^^^^^^^^^^^^^^^^^^
7972

80-
The current implementation of the SQL Connector only uses the classic way of setting up a connection:
81-
82-
.. code-block:: php
83-
84-
$adodbObject = ADONewConnection($parameters['driver']);
85-
$adodbObject->Connect(
86-
$parameters['server'],
87-
$parameters['user'],
88-
$parameters['password'],
89-
$parameters['database']
90-
);
73+
The connections are established by the classes found in :file:`Classes\\Database`.
74+
The ADODB library is a bit tricky to use, as not all connections are made the same
75+
way, using the same parameters. Thus you may find that some connections don't work.
9176

92-
that is, with the four standard parameters: server, user, password and database.
93-
This does not work for all database systems, but I currently had no use for more,
94-
nor a proper setup to test with other database system.
95-
The current version of the SQL connector was tested only with MySQL and PostgreSQL.
77+
In that regard, Doctrine DBAL is far better structured and should connect
78+
seamlessly with all officially supported DBMS.
9679

9780
If you encounter problems connecting to some database system,
9881
please report an issue in the
99-
`dedicated bug tracker <http://forge.typo3.org/projects/extension-svconnector_sql/issues>`_
100-
indicating as clearly as possible what connection syntax you would need.
82+
`dedicated bug tracker <https://github.com/cobwebch/svconnector_sql/issues>`_
83+
indicating as clearly as possible what connection syntax you would need
84+
(for ADODB).

Documentation/Developer/Index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ easy task. The first step is to get the proper service object:
1717
.. code-block:: php
1818
1919
$services = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::findService('connector', 'sql');
20-
if ($services === FALSE) {
20+
if ($services === false) {
2121
// Issue an error
2222
} else {
2323
$connector = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstanceService('connector', 'sql');

Documentation/Index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ SQL Connector Service
2727
sql, database, adodb, data import, fetch data
2828

2929
:Copyright:
30-
2009-2016
30+
2009-2017
3131

3232
:Author:
3333
François Suter (Cobweb)

Documentation/Installation/Index.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ system extension "adodb" to load the ADODB library. With
2222
TYPO3 v8, the Doctrine DBAL library is anyway loaded via the
2323
base Composer configuration.
2424

25+
.. important::
26+
27+
Which abstraction layer is used is determined automatically
28+
depending on TYPO3 version. However this means that "adodb"
29+
does not appear explicitely as a dependency anymore. Running
30+
"svconnector_sql" in TYPO3 v7 without "adodb" loaded will
31+
result in the SQL connector service being flagged as unavailable.
32+
2533
.. note::
2634

2735
The whole compatibility layer which makes it possible to use both

ext_emconf.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
'depends' =>
2626
array (
2727
'typo3' => '7.6.0-8.99.99',
28-
'adodb' => '',
2928
'svconnector' => '3.0.0-0.0.0',
3029
),
3130
'conflicts' =>

0 commit comments

Comments
 (0)