Raised DBAL version from 1.1.2 to 1.1.3
authorXavier Perseguers <typo3@perseguers.ch>
Fri, 30 Apr 2010 19:23:41 +0000 (19:23 +0000)
committerXavier Perseguers <typo3@perseguers.ch>
Fri, 30 Apr 2010 19:23:41 +0000 (19:23 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@7475 709f56b5-9817-0410-a4d7-c38de5d9e867

13 files changed:
ChangeLog
typo3/sysext/dbal/ChangeLog
typo3/sysext/dbal/class.tx_dbal_autoloader.php [new file with mode: 0644]
typo3/sysext/dbal/class.tx_dbal_installtool.php [new file with mode: 0644]
typo3/sysext/dbal/class.ux_t3lib_db.php
typo3/sysext/dbal/ext_emconf.php
typo3/sysext/dbal/ext_localconf.php
typo3/sysext/dbal/last_synched_target
typo3/sysext/dbal/res/Templates/install.html [new file with mode: 0644]
typo3/sysext/dbal/tests/db_mssql_testcase.php
typo3/sysext/dbal/tests/db_oracle_testcase.php
typo3/sysext/dbal/tests/db_postgresql_testcase.php
typo3/sysext/dbal/tests/sqlparser_general_testcase.php

index 644ad9a..0b4520a 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -17,6 +17,7 @@
 
 2010-04-30  Xavier Perseguers  <typo3@perseguers.ch>
 
+       * Raised DBAL version from 1.1.2 to 1.1.3
        * Added feature #14260: Allow DBAL to be configured [Install Tool]
        * Fixed bug #14055: Install Tool wants to remove static_template table (thanks to Gregor Hermens)
        * Fixed bug #14254: Fresh install does not redirect to Install Tool when mysql is not available
index df1f3b1..a47043b 100644 (file)
@@ -1,3 +1,19 @@
+2010-04-30  Xavier Perseguers  <typo3@perseguers.ch>
+
+       * Set version to 1.1.3
+
+2010-04-29  Xavier Perseguers  <typo3@perseguers.ch>
+
+       * Added autoloader for Install Tool
+
+2010-04-22  Xavier Perseguers  <typo3@perseguers.ch>
+
+       * Fixed bug #14182: Multiple join conditions are not supported
+
+2010-04-15  Xavier Perseguers  <typo3@perseguers.ch>
+
+       * Fixed bug #14120: Add a method to check if database is connected
+
 2010-04-14  Xavier Perseguers  <typo3@perseguers.ch>
 
        * Set version to 1.1.2
diff --git a/typo3/sysext/dbal/class.tx_dbal_autoloader.php b/typo3/sysext/dbal/class.tx_dbal_autoloader.php
new file mode 100644 (file)
index 0000000..799b8f0
--- /dev/null
@@ -0,0 +1,146 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 Xavier Perseguers <typo3@perseguers.ch>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Autoloader included from Install Tool that lets DBAL load itself
+ * if it makes sense.
+ *
+ * $Id$
+ *
+ * @author Xavier Perseguers <typo3@perseguers.ch>
+ *
+ * @package TYPO3
+ * @subpackage dbal
+ */
+class tx_dbal_autoloader {
+
+       /**
+        * Activates DBAL if it is supported.
+        *
+        * @param tx_install $instObj
+        * @return void
+        */
+       public function execute(tx_install $instObj) {
+               switch ($instObj->step) {
+                       case 1:
+                       case 2:
+                               if (!t3lib_extMgm::isLoaded('dbal') && $this->isDbalSupported()) {
+                                       $this->activateDbal();
+                               }
+                               break;
+                       case 3:
+                               $driver = $instObj->INSTALL['localconf.php']['typo_db_driver'];
+                               if ($driver === 'mysql' || $driver === 'mysqli') {
+                                       $this->deactivateDbal();
+                               }
+                               break;
+               }
+       }
+
+       /**
+        * Returns TRUE if PHP modules to run DBAL are loaded.
+        *
+        * @return boolean
+        */
+       protected function isDbalSupported() {
+               return extension_loaded('odbc')
+                       || extension_loaded('pdo')
+                       || extension_loaded('oci8');
+       }
+
+       /**
+        * Activates DBAL.
+        *
+        * @return void
+        */
+       protected function activateDbal() {
+               $extList = t3lib_div::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList']);
+               if (!t3lib_div::inArray($extList, 'adodb')) {
+                       $extList[] = 'adodb';
+               }
+               if (!t3lib_div::inArray($extList, 'dbal')) {
+                       $extList[] = 'dbal';
+               }
+               $this->updateExtensionList(implode(',', $extList));
+       }
+
+       /**
+        * Dectivates DBAL.
+        *
+        * @return void
+        */
+       protected function deactivateDbal() {
+               $extList = t3lib_div::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList']);
+               $extList = array_flip($extList);
+
+                       // Remove sysext dbal and adodb
+               if (isset($extList['dbal'])) {
+                       unset($extList['dbal']);
+               }
+               if (isset($extList['adodb'])) {
+                       unset($extList['adodb']);
+               }
+               $extList = array_flip($extList);
+
+               $this->updateExtensionList(implode(',', $extList));
+       }
+
+       /**
+        * Updates the list of extensions.
+        *
+        * @param string $newExtList
+        * @return void
+        */
+       protected function updateExtensionList($newExtList) {
+                       // Instance of install tool
+               $instObj = t3lib_div::makeInstance('t3lib_install');
+               $instObj->allowUpdateLocalConf = 1;
+               $instObj->updateIdentity = 'TYPO3 Core Update Manager';
+
+                       // Get lines from localconf file
+               $lines = $instObj->writeToLocalconf_control();
+               $instObj->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'EXT\'][\'extList\']', $newExtList);
+               $instObj->writeToLocalconf_control($lines);
+
+               $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList'] = $newExtList;
+                       // Make sure to get cache file for backend, not frontend
+               $cacheFilePrefix = $GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE'];
+               $GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE'] = str_replace('temp_CACHED_FE', 'temp_CACHED', $cacheFilePrefix);
+               t3lib_extMgm::removeCacheFiles();
+       }
+
+}
+
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dbal/class.tx_dbal_autoloader.php']) {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dbal/class.tx_dbal_autoloader.php']);
+}
+
+       // Make instance:
+$SOBE = t3lib_div::makeInstance('tx_dbal_autoloader');
+$SOBE->execute($this);
+?>
\ No newline at end of file
diff --git a/typo3/sysext/dbal/class.tx_dbal_installtool.php b/typo3/sysext/dbal/class.tx_dbal_installtool.php
new file mode 100644 (file)
index 0000000..219386e
--- /dev/null
@@ -0,0 +1,518 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 Xavier Perseguers <typo3@perseguers.ch>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Hooks for TYPO3 Install Tool.
+ *
+ * $Id$
+ *
+ * @author Xavier Perseguers <typo3@perseguers.ch>
+ *
+ * @package TYPO3
+ * @subpackage dbal
+ */
+class tx_dbal_installtool {
+
+       /**
+        * @var string
+        */
+       protected $templateFilePath = 'res/Templates/';
+
+       /**
+        * @var array
+        */
+       protected $supportedDrivers;
+
+       /**
+        * @var array
+        */
+       protected $availableDrivers;
+
+       /**
+        * Default constructor.
+        */
+       public function __construct() {
+               $this->supportedDrivers = $this->getSupportedDrivers();
+               $this->availableDrivers = $this->getAvailableDrivers();
+       }
+
+       /**
+        * Hooks into Installer to let a non-MySQL database to be configured.
+        * 
+        * @param array $markers
+        * @param integer $step
+        * @param tx_install $instObj
+        * @return void
+        */
+       public function executeStepOutput(array &$markers, $step, tx_install $instObj) {
+               switch ($step) {
+                       case 2:
+                               $this->createConnectionForm(t3lib_div::_GET('driver'), $markers, $instObj);
+                               break;
+                       case 3:
+                               $this->createDatabaseForm($markers, $instObj);
+                               break;
+               }
+       }
+
+       /**
+        * Hooks into Installer to modify lines to be written to localconf.php.
+        * 
+        * @param array $lines
+        * @param integer $step
+        * @param tx_install $instObj
+        * @return void
+        */
+       public function executeWriteLocalconf(array &$lines, $step, tx_install $instObj) {
+               switch ($step) {
+                       case 3:
+                       case 4:
+                               $driver = $instObj->INSTALL['localconf.php']['typo_db_driver'];
+                               $driverConfig = '';
+                               switch ($driver) {
+                                       case 'oci8':
+                                               $driverConfig = '\'driverOptions\' => array(' .
+                                                       '\'connectSID\' => ' . ($instObj->INSTALL['localconf.php']['typo_db_type'] === 'sid' ? 'TRUE' : 'FALSE') .
+                                               ')' ;
+                                               break;
+                                       case 'mssql':
+                                       case 'odbc_mssql':
+                                               $driverConfig = '\'useNameQuote\' => TRUE';
+                                               break;
+                                       case 'mysql':
+                                       case 'mysqli':
+                                               return;
+                               }
+                               $config = 'array(' .
+                                       '\'_DEFAULT\' => array(' .
+                                               '\'type\' => \'adodb\',' .
+                                               '\'config\' => array(' .
+                                                       '\'driver\' => \'' . $driver . '\',' .
+                                                       $driverConfig .
+                                               ')' .
+                                       ')' .
+                               ');';
+                               $instObj->setValueInLocalconfFile($lines, '$TYPO3_CONF_VARS[\'EXTCONF\'][\'dbal\'][\'handlerCfg\']', $config, FALSE);
+                               break;
+               }
+       }
+
+       /**
+        * Creates a specialized form to configure the DBMS connection.
+        * 
+        * @param string $driver
+        * @param array $markers
+        * @param tx_install $instObj
+        * @return void
+        */
+       protected function createConnectionForm($driver, array &$markers, tx_install $instObj) {
+                       // Get the template file
+               $templateFile = @file_get_contents(
+                       t3lib_extMgm::extPath('dbal') . $this->templateFilePath . 'install.html'
+               );
+                       // Get the template part from the file
+               $template = t3lib_parsehtml::getSubpart(
+                       $templateFile, '###TEMPLATE###'
+               );
+
+                       // Get the subpart for the connection form
+               $formSubPart = t3lib_parsehtml::getSubpart(
+                       $template, '###CONNECTION_FORM###'
+               );
+               $driverTemplate = t3lib_parsehtml::getSubpart(
+                       $formSubPart, '###DATABASE_DRIVER###'
+               );
+               $driverSubPart = $this->prepareDatabaseDrivers($driverTemplate);
+               $formSubPart = t3lib_parsehtml::substituteSubpart(
+                       $formSubPart,
+                       '###DATABASE_DRIVER###',
+                       $driverSubPart
+               );
+
+               if (!$driver) {  
+                       $driver = $this->getDefaultDriver();
+               }
+                       // Get the subpart related to selected database driver
+               if ($driver === '' || $driver === 'mysql' || $driver === 'mysqli') {
+                       $driverOptionsSubPart = t3lib_parsehtml::getSubpart(
+                               $template, '###DRIVER_MYSQL###'
+                       );
+               } else {
+                       $driverOptionsSubPart = t3lib_parsehtml::getSubpart(
+                               $template, '###DRIVER_' . t3lib_div::strtoupper($driver) . '###'
+                       );
+                       if ($driverOptionsSubPart === '') {
+                               $driverOptionsSubPart = t3lib_parsehtml::getSubpart(
+                                       $template, '###DRIVER_DEFAULT###'
+                               );
+                       }
+               }
+
+                       // Define driver-specific markers
+               $driverMarkers = array();
+               switch ($driver) {
+                       case 'mssql':
+                               $driverMarkers = array(
+                                       'labelUsername' => 'Username',
+                                       'username' => TYPO3_db_username,
+                                       'labelPassword' => 'Password',
+                                       'password' => TYPO3_db_password,
+                                       'labelHost' => 'Host',
+                                       'host' => TYPO3_db_host ? TYPO3_db_host : 'windows',
+                                       'labelDatabase' => 'Database',
+                                       'database' => TYPO3_db,
+                               );
+                               $nextStep = $instObj->step + 2;
+                               break;
+                       case 'odbc_mssql':
+                               $driverMarkers = array(
+                                       'labelUsername' => 'Username',
+                                       'username' => TYPO3_db_username,
+                                       'labelPassword' => 'Password',
+                                       'password' => TYPO3_db_password,
+                                       'labelHost' => 'Host',
+                                       'host' => TYPO3_db_host ? TYPO3_db_host : 'windows',
+                                       'database' => 'dummy_string',
+                               );
+                               $nextStep = $instObj->step + 2;
+                               break;
+                       case 'oci8':
+                               $driverMarkers = array(
+                                       'labelUsername' => 'Username',
+                                       'username' => TYPO3_db_username,
+                                       'labelPassword' => 'Password',
+                                       'password' => TYPO3_db_password,
+                                       'labelHost' => 'Host',
+                                       'host' => TYPO3_db_host ? TYPO3_db_host : 'localhost',
+                                       'labelType' => 'Type',
+                                       'labelSID' => 'SID',
+                                       'labelServiceName' => 'Service Name',
+                                       'labelDatabase' => 'Name',
+                                       'database' => TYPO3_db,
+                               );
+                               $nextStep = $instObj->step + 2;
+                               break;
+                       default:
+                               $driverMarkers = array(
+                                       'labelUsername' => 'Username',
+                                       'username' => TYPO3_db_username,
+                                       'labelPassword' => 'Password',
+                                       'password' => TYPO3_db_password,
+                                       'labelHost' => 'Host',
+                                       'host' => TYPO3_db_host ? TYPO3_db_host : 'localhost',
+                                       'labelDatabase' => 'Database',
+                                       'database' => TYPO3_db,
+                               );
+                               $nextStep = $instObj->step + 1;
+                               break;
+               }
+
+                       // Add header marker for main template
+               $markers['header'] = 'Connect to your database host';
+                       // Define the markers content for the subpart
+               $subPartMarkers = array(
+                       'step' => $nextStep,
+                       'action' => htmlspecialchars($instObj->action),
+                       'encryptionKey' => $instObj->createEncryptionKey(),
+                       'branch' => TYPO3_branch,
+                       'driver_options' => $driverOptionsSubPart,
+                       'continue' => 'Continue'
+               );
+               $subPartMarkers = array_merge($subPartMarkers, $driverMarkers);
+
+                       // Add step marker for main template
+               $markers['step'] = t3lib_parsehtml::substituteMarkerArray(
+                       $formSubPart,
+                       $subPartMarkers,
+                       '###|###',
+                       1,
+                       1
+               );
+       }
+
+       /**
+        * Prepares the list of database drivers for step 2.
+        *
+        * @param string $template
+        * @return string
+        */
+       protected function prepareDatabaseDrivers($template) {
+               $subParts = array(
+                       'abstractionLayer' => t3lib_parsehtml::getSubpart($template, '###ABSTRACTION_LAYER###'),
+                       'vendor' => t3lib_parsehtml::getSubpart($template, '###VENDOR###'),
+               );
+
+                       // Create the drop-down list of available drivers
+               $dropdown = '';
+               $activeDriver = t3lib_div::_GET('driver');
+               foreach ($this->availableDrivers as $abstractionLayer => $drivers) {
+                       $options = array();
+                       foreach ($drivers as $driver => $label) {
+                               $markers = array(
+                                       'driver'      => $driver,
+                                       'labelvendor' => $label,
+                                       'onclick'     => 'document.location=\'index.php?TYPO3_INSTALL[type]=config&mode=123&step=2&driver=' . $driver . '\';',
+                                       'selected'    => '',
+                               );
+                               if ($driver === $activeDriver) {
+                                       $markers['selected'] .= ' selected="selected"';
+                               }
+                               $options[] = t3lib_parsehtml::substituteMarkerArray(
+                                       $subParts['vendor'],
+                                       $markers,
+                                       '###|###',
+                                       1
+                               );
+                       }
+                       $subPart = t3lib_parsehtml::substituteSubpart(
+                               $subParts['abstractionLayer'],
+                               '###VENDOR###',
+                               implode("\n", $options)
+                       );
+                       $dropdown .= t3lib_parsehtml::substituteMarker(
+                               $subPart,
+                               '###LABELABSTRACTIONLAYER###',
+                               $abstractionLayer
+                       );
+               }
+               $form = t3lib_parsehtml::substituteSubpart(
+                       $template,
+                       '###ABSTRACTION_LAYER###',
+                       $dropdown
+               );
+               $form = t3lib_parsehtml::substituteMarker(
+                       $form,
+                       '###LABELDRIVER###',
+                       'Driver'
+               );
+               return $form;
+       }
+
+       /**
+        * Returns a list of DBAL supported database drivers, with a user-friendly name
+        * and any PHP module dependency.
+        *
+        * @return array
+        */
+       protected function getSupportedDrivers() {
+               $supportedDrivers = array(
+                       'Native' => array(
+                               'mysql' => array(
+                                       'label'      => 'MySQL/MySQLi (recommended)',
+                                       'combine'    => 'OR',
+                                       'extensions' => array('mysql', 'mysqli'),
+                               ),
+                               'mssql' => array(
+                                       'label'      => 'Microsoft SQL Server',
+                                       'extensions' => array('mssql'),
+                               ),
+                               'oci8' => array(
+                                       'label'      => 'Oracle OCI8',
+                                       'extensions' => array('oci8'),
+                               ),
+                               'postgres' => array(
+                                       'label'      => 'PostgreSQL',
+                                       'extensions' => array('pgsql'),
+                               )
+                       ),
+                       'ODBC' => array(
+                               'odbc_mssql' => array(
+                                       'label'      => 'Microsoft SQL Server',
+                                       'extensions' => array('odbc', 'mssql'),
+                               ),
+                       ),
+               );
+               return $supportedDrivers;
+       }
+
+       /**
+        * Returns a list of database drivers that are available on current server.
+        *
+        * @return array
+        */
+       protected function getAvailableDrivers() {
+               $availableDrivers = array();
+               foreach ($this->supportedDrivers as $abstractionLayer => $drivers) {
+                       foreach ($drivers as $driver => $info) {
+                               if (isset($info['combine']) && $info['combine'] === 'OR') {
+                                       $isAvailable = FALSE;
+                               } else {
+                                       $isAvailable = TRUE;
+                               }
+
+                                       // Loop through each PHP module dependency to ensure it is loaded
+                               foreach ($info['extensions'] as $extension) {
+                                       if (isset($info['combine']) && $info['combine'] === 'OR') {
+                                               $isAvailable |= extension_loaded($extension);
+                                       } else {
+                                               $isAvailable &= extension_loaded($extension);
+                                       }
+                               }
+
+                               if ($isAvailable) {
+                                       if (!isset($availableDrivers[$abstractionLayer])) {
+                                               $availableDrivers[$abstractionLayer] = array();
+                                       }
+                                       $availableDrivers[$abstractionLayer][$driver] = $info['label'];
+                               }
+                       }
+               }
+               return $availableDrivers;
+       }
+
+       /**
+        * Returns the driver that is selected by default in the
+        * Install Tool dropdown list.
+        *
+        * @return string
+        */
+       protected function getDefaultDriver() {
+               $defaultDriver = '';
+               if (count($this->availableDrivers)) {
+                       $abstractionLayers = array_keys($this->availableDrivers);
+                       $drivers = array_keys($this->availableDrivers[$abstractionLayers[0]]);
+                       $defaultDriver = $drivers[0];
+               }
+               return $defaultDriver;
+       }
+
+       /**
+        * Creates a specialized form to configure the database.
+        * 
+        * @param array $markers
+        * @param tx_install $instObj
+        */
+       protected function createDatabaseForm(array &$markers, tx_install $instObj) {
+               $error_missingConnect = '
+                       <p class="typo3-message message-error">
+                               <strong>
+                                       There is no connection to the database!
+                               </strong>
+                               <br />
+                               (Username: <em>' . TYPO3_db_username . '</em>,
+                               Host: <em>' . TYPO3_db_host . '</em>,
+                               Using Password: YES)
+                               <br />
+                               Go to Step 1 and enter a proper username/password!
+                       </p>
+               ';
+
+                       // Add header marker for main template
+               $markers['header'] = 'Select database';
+                       // There should be a database host connection at this point
+               if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(
+                       TYPO3_db_host, TYPO3_db_username, TYPO3_db_password
+               )) {
+                               // Get the template file
+                       $templateFile = @file_get_contents(
+                               t3lib_extMgm::extPath('dbal') . $this->templateFilePath . 'install.html'
+                       );
+                               // Get the template part from the file
+                       $template = t3lib_parsehtml::getSubpart(
+                               $templateFile, '###TEMPLATE###'
+                       );
+                               // Get the subpart for the database choice step
+                       $formSubPart = t3lib_parsehtml::getSubpart(
+                               $template, '###DATABASE_FORM###'
+                       );
+                               // Get the subpart for the database options
+                       $step3DatabaseOptionsSubPart = t3lib_parsehtml::getSubpart(
+                               $formSubPart, '###DATABASEOPTIONS###'
+                       );
+
+                       $dbArr = $instObj->getDatabaseList();
+                       $dbIncluded = FALSE;
+                       foreach ($dbArr as $dbname) {
+                                       // Define the markers content for database options
+                               $step3DatabaseOptionMarkers = array(
+                                       'databaseValue' => htmlspecialchars($dbname),
+                                       'databaseSelected' => ($dbname === TYPO3_db) ? 'selected="selected"' : '',
+                                       'databaseName' => htmlspecialchars($dbname)
+                               );
+                                       // Add the option HTML to an array
+                               $step3DatabaseOptions[] = t3lib_parsehtml::substituteMarkerArray(
+                                       $step3DatabaseOptionsSubPart,
+                                       $step3DatabaseOptionMarkers,
+                                       '###|###',
+                                       1,
+                                       1
+                               );
+                               if ($dbname === TYPO3_db) {
+                                       $dbIncluded = TRUE;
+                               }
+                       }
+                       if (!$dbIncluded && TYPO3_db) {
+                                       // // Define the markers content when no access
+                               $step3DatabaseOptionMarkers = array(
+                                       'databaseValue' => htmlspecialchars(TYPO3_db),
+                                       'databaseSelected' => 'selected="selected"',
+                                       'databaseName' => htmlspecialchars(TYPO3_db) . ' (NO ACCESS!)'
+                               );
+                                       // Add the option HTML to an array
+                               $step3DatabaseOptions[] = t3lib_parsehtml::substituteMarkerArray(
+                                       $step3DatabaseOptionsSubPart,
+                                       $step3DatabaseOptionMarkers,
+                                       '###|###',
+                                       1,
+                                       1
+                               );
+                       }
+                               // Substitute the subpart for the database options
+                       $content = t3lib_parsehtml::substituteSubpart(
+                               $formSubPart,
+                               '###DATABASEOPTIONS###',
+                               implode(chr(10), $step3DatabaseOptions)
+                       );
+                               // Define the markers content
+                       $step3SubPartMarkers = array(
+                               'step' => $instObj->step + 1,
+                               'action' => htmlspecialchars($instObj->action),
+                               'llOption2' => 'Select an EMPTY existing database:',
+                               'llRemark2' => 'All tables used by TYPO3 will be overwritten in step 3.',
+                               'continue' => 'Continue'
+                       );
+                               // Add step marker for main template
+                       $markers['step'] = t3lib_parsehtml::substituteMarkerArray(
+                               $content,
+                               $step3SubPartMarkers,
+                               '###|###',
+                               1,
+                               1
+                       );
+               } else {
+                               // Add step marker for main template when no connection
+                       $markers['step'] = $error_missingConnect;
+               }
+       }
+
+}
+
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dbal/class.tx_dbal_installtool.php']) {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dbal/class.tx_dbal_installtool.php']);
+}
+?>
\ No newline at end of file
index 1af1f68..4318d17 100644 (file)
@@ -1254,10 +1254,12 @@ class ux_t3lib_DB extends t3lib_DB {
                                foreach ($v['JOIN'] as $joinCnt => $join) {
                                        $from_table[$k]['JOIN'][$joinCnt]['withTable'] = $this->quoteName($join['withTable']);
                                        $from_table[$k]['JOIN'][$joinCnt]['as'] = ($join['as']) ? $this->quoteName($join['as']) : '';
-                                       $from_table[$k]['JOIN'][$joinCnt]['ON'][0]['table'] = ($join['ON'][0]['table']) ? $this->quoteName($join['ON'][0]['table']) : '';
-                                       $from_table[$k]['JOIN'][$joinCnt]['ON'][0]['field'] = $this->quoteName($join['ON'][0]['field']);
-                                       $from_table[$k]['JOIN'][$joinCnt]['ON'][1]['table'] = ($join['ON'][1]['table']) ? $this->quoteName($join['ON'][1]['table']) : '';
-                                       $from_table[$k]['JOIN'][$joinCnt]['ON'][1]['field'] = $this->quoteName($join['ON'][1]['field']);
+                                       foreach ($from_table[$k]['JOIN'][$joinCnt]['ON'] as &$condition) {
+                                               $condition['left']['table'] = ($condition['left']['table']) ? $this->quoteName($condition['left']['table']) : '';
+                                               $condition['left']['field'] = $this->quoteName($condition['left']['field']);
+                                               $condition['right']['table'] = ($condition['right']['table']) ? $this->quoteName($condition['right']['table']) : '';
+                                               $condition['right']['field'] = $this->quoteName($condition['right']['field']);
+                                       }
                                }
                        }
                }
@@ -2106,10 +2108,14 @@ class ux_t3lib_DB extends t3lib_DB {
                                }
                                break;
                        case 'adodb':
-                               $sqlTables = $this->handlerInstance['_DEFAULT']->MetaTables('TABLES');
-                               while (list($k, $theTable) = each($sqlTables)) {
-                                       if (preg_match('/BIN\$/', $theTable)) continue; // skip tables from the Oracle 10 Recycle Bin
-                                       $whichTables[$theTable] = $theTable;
+                                       // check needed for install tool - otherwise it will just die because the call to
+                                       // MetaTables is done on a stdClass instance
+                               if (method_exists($this->handlerInstance['_DEFAULT'], 'MetaTables')) {
+                                       $sqlTables = $this->handlerInstance['_DEFAULT']->MetaTables('TABLES');
+                                       while (list($k, $theTable) = each($sqlTables)) {
+                                               if (preg_match('/BIN\$/', $theTable)) continue; // skip tables from the Oracle 10 Recycle Bin
+                                               $whichTables[$theTable] = $theTable;
+                                       }
                                }
                                break;
                        case 'userdefined':
@@ -2478,6 +2484,10 @@ class ux_t3lib_DB extends t3lib_DB {
                $output = FALSE;
 
                if (is_array($cfgArray)) {
+                       if (!$cfgArray['config']['database']) {
+                                       // Configuration is incomplete
+                               return;
+                       }
                        switch ($handlerType) {
                                case 'native':
                                        if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['no_pconnect']) {
@@ -2580,6 +2590,26 @@ class ux_t3lib_DB extends t3lib_DB {
 
 
        /**
+        * Checks if database is connected.
+        *
+        * @return boolean
+        */
+       public function isConnected() {
+               $result = FALSE;
+               switch ((string)$this->handlerCfg[$this->lastHandlerKey]['type']) {
+                       case 'native':
+                               $result = is_resource($this->link);
+                               break;
+                       case 'adodb':
+                       case 'userdefined':
+                               $result = is_object($this->handlerInstance[$this->lastHandlerKey]) && $this->handlerInstance[$this->lastHandlerKey]->isConnected();
+                               break;
+               }
+               return $result;
+       }
+
+
+       /**
         * Checks whether the DBAL is currently inside an operation running on the "native" DB handler (i.e. MySQL)
         *
         * @return boolean      True if running on "native" DB handler (i.e. MySQL)
@@ -2735,17 +2765,23 @@ class ux_t3lib_DB extends t3lib_DB {
                                        }
                                        $onPartsArray = array();
                                                // Mapping ON parts of the JOIN
-                                       if (is_array($join['ON'])) {
-                                               foreach ($join['ON'] as $onParts) {
-                                                       if (isset($this->mapping[$onParts['table']]['mapFieldNames'][$onParts['field']])) {
-                                                               $onParts['field'] = $this->mapping[$onParts['table']]['mapFieldNames'][$onParts['field']];
+                                       if (is_array($tables[$k]['JOIN'][$joinCnt]['ON'])) {
+                                               foreach ($tables[$k]['JOIN'][$joinCnt]['ON'] as &$condition) {
+                                                               // Left side of the comparator
+                                                       if (isset($this->mapping[$condition['left']['table']]['mapFieldNames'][$condition['left']['field']])) {
+                                                               $condition['left']['field'] = $this->mapping[$condition['left']['table']]['mapFieldNames'][$condition['left']['field']];
+                                                       }
+                                                       if (isset($this->mapping[$condition['left']['table']]['mapTableName'])) {
+                                                               $condition['left']['table'] = $this->mapping[$condition['left']['table']]['mapTableName'];
+                                                       }
+                                                               // Right side of the comparator
+                                                       if (isset($this->mapping[$condition['right']['table']]['mapFieldNames'][$condition['right']['field']])) {
+                                                               $condition['right']['field'] = $this->mapping[$condition['right']['table']]['mapFieldNames'][$condition['right']['field']];
                                                        }
-                                                       if (isset($this->mapping[$onParts['table']]['mapTableName'])) {
-                                                               $onParts['table'] = $this->mapping[$onParts['table']]['mapTableName'];
+                                                       if (isset($this->mapping[$condition['right']['table']]['mapTableName'])) {
+                                                               $condition['right']['table'] = $this->mapping[$condition['right']['table']]['mapTableName'];
                                                        }
-                                                       $onPartsArray[] = $onParts;
                                                }
-                                               $tables[$k]['JOIN'][$joinCnt]['ON'] = $onPartsArray;
                                        }
                                }
                        }
index f6edfa1..4953b46 100644 (file)
@@ -3,7 +3,7 @@
 ########################################################################
 # Extension Manager/Repository config file for ext "dbal".
 #
-# Auto generated 14-04-2010 00:05
+# Auto generated 30-04-2010 21:11
 #
 # Manual updates:
 # Only the data in the array - everything else is removed by next
@@ -32,13 +32,13 @@ $EM_CONF[$_EXTKEY] = array(
        'author_company' => '',
        'CGLcompliance' => '',
        'CGLcompliance_note' => '',
-       'version' => '1.1.2',
-       '_md5_values_when_last_written' => 'a:39:{s:9:"ChangeLog";s:4:"91de";s:26:"class.ux_db_list_extra.php";s:4:"60d9";s:21:"class.ux_t3lib_db.php";s:4:"6cc1";s:28:"class.ux_t3lib_sqlparser.php";s:4:"a9d4";s:16:"ext_autoload.php";s:4:"821a";s:21:"ext_conf_template.txt";s:4:"f5cf";s:12:"ext_icon.gif";s:4:"c9ba";s:17:"ext_localconf.php";s:4:"5280";s:14:"ext_tables.php";s:4:"8414";s:14:"ext_tables.sql";s:4:"1f95";s:27:"doc/class.tslib_fe.php.diff";s:4:"0083";s:14:"doc/manual.sxw";s:4:"b022";s:45:"handlers/class.tx_dbal_handler_openoffice.php";s:4:"775f";s:43:"handlers/class.tx_dbal_handler_rawmysql.php";s:4:"2f1b";s:40:"handlers/class.tx_dbal_handler_xmldb.php";s:4:"e363";s:31:"lib/class.tx_dbal_sqlengine.php";s:4:"f1bb";s:33:"lib/class.tx_dbal_tsparserext.php";s:4:"862d";s:14:"mod1/clear.gif";s:4:"cc11";s:13:"mod1/conf.php";s:4:"6e63";s:14:"mod1/index.php";s:4:"4a5e";s:18:"mod1/locallang.xml";s:4:"0b57";s:22:"mod1/locallang_mod.xml";s:4:"86ef";s:19:"mod1/moduleicon.gif";s:4:"2b8f";s:10:"res/README";s:4:"be19";s:30:"res/oracle/indexed_search.diff";s:4:"ec81";s:23:"res/oracle/realurl.diff";s:4:"86da";s:25:"res/oracle/scheduler.diff";s:4:"7c06";s:27:"res/oracle/templavoila.diff";s:4:"1fd5";s:43:"res/postgresql/postgresql-compatibility.sql";s:4:"034c";s:22:"tests/BaseTestCase.php";s:4:"f736";s:26:"tests/FakeDbConnection.php";s:4:"7bab";s:29:"tests/db_general_testcase.php";s:4:"42f4";s:27:"tests/db_mssql_testcase.php";s:4:"106d";s:28:"tests/db_oracle_testcase.php";s:4:"e710";s:32:"tests/db_postgresql_testcase.php";s:4:"5f32";s:36:"tests/sqlparser_general_testcase.php";s:4:"cc6d";s:31:"tests/fixtures/mssql.config.php";s:4:"ff95";s:30:"tests/fixtures/oci8.config.php";s:4:"7179";s:36:"tests/fixtures/postgresql.config.php";s:4:"87a1";}',
+       'version' => '1.1.3',
+       '_md5_values_when_last_written' => 'a:42:{s:9:"ChangeLog";s:4:"a252";s:28:"class.tx_dbal_autoloader.php";s:4:"bb38";s:29:"class.tx_dbal_installtool.php";s:4:"0564";s:26:"class.ux_db_list_extra.php";s:4:"60d9";s:21:"class.ux_t3lib_db.php";s:4:"1839";s:28:"class.ux_t3lib_sqlparser.php";s:4:"a9d4";s:16:"ext_autoload.php";s:4:"821a";s:21:"ext_conf_template.txt";s:4:"f5cf";s:12:"ext_icon.gif";s:4:"c9ba";s:17:"ext_localconf.php";s:4:"afdd";s:14:"ext_tables.php";s:4:"8414";s:14:"ext_tables.sql";s:4:"1f95";s:27:"doc/class.tslib_fe.php.diff";s:4:"0083";s:14:"doc/manual.sxw";s:4:"b022";s:45:"handlers/class.tx_dbal_handler_openoffice.php";s:4:"775f";s:43:"handlers/class.tx_dbal_handler_rawmysql.php";s:4:"2f1b";s:40:"handlers/class.tx_dbal_handler_xmldb.php";s:4:"e363";s:31:"lib/class.tx_dbal_sqlengine.php";s:4:"f1bb";s:33:"lib/class.tx_dbal_tsparserext.php";s:4:"862d";s:14:"mod1/clear.gif";s:4:"cc11";s:13:"mod1/conf.php";s:4:"6e63";s:14:"mod1/index.php";s:4:"4a5e";s:18:"mod1/locallang.xml";s:4:"0b57";s:22:"mod1/locallang_mod.xml";s:4:"86ef";s:19:"mod1/moduleicon.gif";s:4:"2b8f";s:10:"res/README";s:4:"be19";s:26:"res/Templates/install.html";s:4:"6a62";s:30:"res/oracle/indexed_search.diff";s:4:"ec81";s:23:"res/oracle/realurl.diff";s:4:"86da";s:25:"res/oracle/scheduler.diff";s:4:"7c06";s:27:"res/oracle/templavoila.diff";s:4:"1fd5";s:43:"res/postgresql/postgresql-compatibility.sql";s:4:"034c";s:22:"tests/BaseTestCase.php";s:4:"f736";s:26:"tests/FakeDbConnection.php";s:4:"7bab";s:29:"tests/db_general_testcase.php";s:4:"42f4";s:27:"tests/db_mssql_testcase.php";s:4:"5593";s:28:"tests/db_oracle_testcase.php";s:4:"4dfc";s:32:"tests/db_postgresql_testcase.php";s:4:"4851";s:36:"tests/sqlparser_general_testcase.php";s:4:"9c10";s:31:"tests/fixtures/mssql.config.php";s:4:"ff95";s:30:"tests/fixtures/oci8.config.php";s:4:"7179";s:36:"tests/fixtures/postgresql.config.php";s:4:"87a1";}',
        'constraints' => array(
                'depends' => array(
                        'adodb' => '5.10.0-',
                        'php' => '5.2.0-0.0.0',
-                       'typo3' => '4.4.0beta1-0.0.0',
+                       'typo3' => '4.4.0beta1-4.4.99',
                ),
                'conflicts' => array(
                ),
index 8ee482c..925f9da 100644 (file)
@@ -7,4 +7,7 @@ $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_db.php'] = t3lib_extMg
 $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_sqlparser.php'] = t3lib_extMgm::extPath('dbal') . 'class.ux_t3lib_sqlparser.php';
 $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.db_list_extra.inc'] = t3lib_extMgm::extPath('dbal') . 'class.ux_db_list_extra.php';
 
+// Register a hook for the installer
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install/mod/class.tx_install.php']['stepOutput'][] = 'EXT:dbal/class.tx_dbal_installtool.php:tx_dbal_installtool';
+$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install/mod/class.tx_install.php']['writeLocalconf'][] = 'EXT:dbal/class.tx_dbal_installtool.php:tx_dbal_installtool';
 ?>
index cf9eea5..b7d0814 100644 (file)
@@ -1 +1 @@
-https://svn.typo3.org/TYPO3v4/Extensions/dbal/tags/1.1.2/
+https://svn.typo3.org/TYPO3v4/Extensions/dbal/tags/1.1.3/
diff --git a/typo3/sysext/dbal/res/Templates/install.html b/typo3/sysext/dbal/res/Templates/install.html
new file mode 100644 (file)
index 0000000..36f9990
--- /dev/null
@@ -0,0 +1,201 @@
+?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html
+     PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+     "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+       <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+       <title>Template: Step Output</title>
+</head>
+<body>
+<!-- ###TEMPLATE### begin -->
+
+<!-- ###CONNECTION_FORM### begin -->
+<script type="text/javascript" src="../contrib/prototype/prototype.js"></script>
+<script type="text/javascript" src="../sysext/install/Resources/Public/Javascript/install.js"></script>
+
+<form method="post" action="###ACTION###">
+       <fieldset class="t3-install-form-label-width-7">
+               <ol>
+                       <li class="t3-install-hidden">
+                               <input type="hidden" value="###STEP###" name="step" />
+                               <input type="hidden" value="###ENCRYPTIONKEY###" name="TYPO3_INSTALL[localconf.php][encryptionKey]" />
+                               <input type="hidden" value="###BRANCH###" name="TYPO3_INSTALL[localconf.php][compat_version]" />
+                       </li>
+                       <!-- ###DATABASE_DRIVER### begin -->
+                       <li>
+                               <label>###LABELDRIVER###</label>
+                               <select name="TYPO3_INSTALL[localconf.php][typo_db_driver]">
+                                       <!-- ###ABSTRACTION_LAYER### begin -->
+                                       <optgroup label="###LABELABSTRACTIONLAYER###">
+                                               <!-- ###VENDOR### begin -->
+                                               <option value="###DRIVER###"###SELECTED### onclick="###ONCLICK###">###LABELVENDOR###</option>
+                                               <!-- ###VENDOR### end -->
+                                       </optgroup>
+                                       <!-- ###ABSTRACTION_LAYER### end -->
+                               </select>
+                       </li>
+                       <!-- ###DATABASE_DRIVER### end -->
+
+                       ###DRIVER_OPTIONS###
+               </ol>
+       </fieldset>
+       <fieldset class="t3-install-form-submit">
+               <ol>
+                       <li>
+                               <button type="submit">###CONTINUE###<span class="t3-install-form-button-icon-positive">&nbsp;</span></button>
+                       </li>
+               </ol>
+       </fieldset>
+</form>
+<!-- ###CONNECTION_FORM### end -->
+
+
+
+
+<!-- ###DATABASE_FORM### begin -->
+<form id="t3-install-123-step3" method="post" action="###ACTION###">
+       <fieldset>
+               <ol>
+                       <li class="t3-install-hidden">
+                               <input type="hidden" value="###STEP###" name="step" />
+                       </li>
+                       <li>
+                               <label for="t3-install-123-database">###LLOPTION2###</label>
+                               <p>###LLREMARK2###</p>
+                               <select id="t3-install-123-database" name="TYPO3_INSTALL[localconf.php][typo_db]">
+                                       <option value="">Select database</option>
+                                       <!-- ###DATABASEOPTIONS### begin -->
+                                       <option value="###DATABASEVALUE###" ###DATABASESELECTED###>###DATABASENAME###</option>
+                                       <!-- ###DATABASEOPTIONS### end -->
+                               </select>
+                       </li>
+               </ol>
+       </fieldset>
+       <fieldset class="t3-install-form-submit">
+               <ol>
+                       <li>
+                               <button type="submit">###CONTINUE###<span class="t3-install-form-button-icon-positive">&nbsp;</span></button>
+                       </li>
+               </ol>
+       </fieldset>
+</form>
+<!-- ###DATABASE_FORM### end -->
+
+
+
+
+
+<!-- ###DRIVER_MYSQL### begin -->
+<!-- ###DRIVER_MYSQLI### begin -->
+<li>
+       <label for="t3-install-form-username">###LABELUSERNAME###</label>
+       <input id="t3-install-form-username" class="t3-install-form-input-text" type="text" value="###USERNAME###" name="TYPO3_INSTALL[localconf.php][typo_db_username]" />
+</li>
+<li>
+       <label for="t3-install-form-password">###LABELPASSWORD###</label>
+       <input id="t3-install-form-password" class="t3-install-form-input-text" type="password" value="###PASSWORD###" name="TYPO3_INSTALL[localconf.php][typo_db_password]" />
+</li>
+<li>
+       <label for="t3-install-form-host">###LABELHOST###</label>
+       <input id="t3-install-form-host" class="t3-install-form-input-text" type="text" value="###HOST###" name="TYPO3_INSTALL[localconf.php][typo_db_host]" />
+</li>
+<!-- ###DRIVER_MYSQLI### end -->
+<!-- ###DRIVER_MYSQL### end -->
+
+
+
+
+<!-- ###DRIVER_DEFAULT### begin -->
+<li>
+       <label for="t3-install-form-username">###LABELUSERNAME###</label>
+       <input id="t3-install-form-username" class="t3-install-form-input-text" type="text" value="###USERNAME###" name="TYPO3_INSTALL[localconf.php][typo_db_username]" />
+</li>
+<li>
+       <label for="t3-install-form-password">###LABELPASSWORD###</label>
+       <input id="t3-install-form-password" class="t3-install-form-input-text" type="password" value="###PASSWORD###" name="TYPO3_INSTALL[localconf.php][typo_db_password]" />
+</li>
+<li>
+       <label for="t3-install-form-host">###LABELHOST###</label>
+       <input id="t3-install-form-host" class="t3-install-form-input-text" type="text" value="###HOST###" name="TYPO3_INSTALL[localconf.php][typo_db_host]" />
+</li>
+<li>
+       <label for="t3-install-form-database">###LABELDATABASE###</label>
+       <input id="t3-install-form-database" class="t3-install-form-input-text" type="text" value="###DATABASE###" name="TYPO3_INSTALL[localconf.php][typo_db]" />
+</li>
+<!-- ###DRIVER_DEFAULT### end -->
+
+
+
+
+<!-- ###DRIVER_MSSQL### begin -->
+<li>
+       <label for="t3-install-form-username">###LABELUSERNAME###</label>
+       <input id="t3-install-form-username" class="t3-install-form-input-text" type="text" value="###USERNAME###" name="TYPO3_INSTALL[localconf.php][typo_db_username]" />
+</li>
+<li>
+       <label for="t3-install-form-password">###LABELPASSWORD###</label>
+       <input id="t3-install-form-password" class="t3-install-form-input-text" type="password" value="###PASSWORD###" name="TYPO3_INSTALL[localconf.php][typo_db_password]" />
+</li>
+<li>
+       <label for="t3-install-form-host">###LABELHOST###</label>
+       <input id="t3-install-form-host" class="t3-install-form-input-text" type="text" value="###HOST###" name="TYPO3_INSTALL[localconf.php][typo_db_host]" />
+</li>
+<li>
+       <label for="t3-install-form-database">###LABELDATABASE###</label>
+       <input id="t3-install-form-database" class="t3-install-form-input-text" type="text" value="###DATABASE###" name="TYPO3_INSTALL[localconf.php][typo_db]" />
+</li>
+<!-- ###DRIVER_MSSQL### end -->
+
+
+
+
+
+<!-- ###DRIVER_ODBC_MSSQL### begin -->
+<li>
+       <label for="t3-install-form-username">###LABELUSERNAME###</label>
+       <input id="t3-install-form-username" class="t3-install-form-input-text" type="text" value="###USERNAME###" name="TYPO3_INSTALL[localconf.php][typo_db_username]" />
+</li>
+<li>
+       <label for="t3-install-form-password">###LABELPASSWORD###</label>
+       <input id="t3-install-form-password" class="t3-install-form-input-text" type="password" value="###PASSWORD###" name="TYPO3_INSTALL[localconf.php][typo_db_password]" />
+</li>
+<li>
+       <label for="t3-install-form-host">###LABELHOST###</label>
+       <input id="t3-install-form-host" class="t3-install-form-input-text" type="text" value="###HOST###" name="TYPO3_INSTALL[localconf.php][typo_db_host]" />
+</li>
+<input type="hidden" value="###DATABASE###" name="TYPO3_INSTALL[localconf.php][typo_db]" />
+<!-- ###DRIVER_ODBC_MSSQL### end -->
+
+
+
+
+<!-- ###DRIVER_OCI8### begin -->
+<li>
+       <label for="t3-install-form-username">###LABELUSERNAME###</label>
+       <input id="t3-install-form-username" class="t3-install-form-input-text" type="text" value="###USERNAME###" name="TYPO3_INSTALL[localconf.php][typo_db_username]" />
+</li>
+<li>
+       <label for="t3-install-form-password">###LABELPASSWORD###</label>
+       <input id="t3-install-form-password" class="t3-install-form-input-text" type="password" value="###PASSWORD###" name="TYPO3_INSTALL[localconf.php][typo_db_password]" />
+</li>
+<li>
+       <label for="t3-install-form-host">###LABELHOST###</label>
+       <input id="t3-install-form-host" class="t3-install-form-input-text" type="text" value="###HOST###" name="TYPO3_INSTALL[localconf.php][typo_db_host]" />
+</li>
+<li>
+       <label for="t3-install-form-type">###LABELTYPE###</label>
+       <select id="t3-install-form-type" name="TYPO3_INSTALL[localconf.php][typo_db_type]">
+               <option value="sid">###LABELSID###</option>
+               <option value="servicename">###LABELSERVICENAME###</option>
+       </select>
+</li>
+<li>
+       <label for="t3-install-form-database">###LABELDATABASE###</label>
+       <input id="t3-install-form-database" class="t3-install-form-input-text" type="text" value="###DATABASE###" name="TYPO3_INSTALL[localconf.php][typo_db]" />
+</li>
+<!-- ###DRIVER_OCI8### end -->
+
+<!-- ###TEMPLATE### end -->
+</body>
+</html>
\ No newline at end of file
index ec98b1c..88eaa6c 100644 (file)
@@ -64,10 +64,12 @@ class db_mssql_testcase extends BaseTestCase {
                $parserClassName = self::buildAccessibleProxy('ux_t3lib_sqlparser');
                $GLOBALS['TYPO3_DB']->SQLparser = new $parserClassName;
 
+               $this->assertFalse($GLOBALS['TYPO3_DB']->isConnected());
+
                        // Initialize a fake MS SQL connection
                FakeDbConnection::connect($GLOBALS['TYPO3_DB'], 'mssql');
 
-               $this->assertTrue($GLOBALS['TYPO3_DB']->handlerInstance['_DEFAULT']->isConnected());
+               $this->assertTrue($GLOBALS['TYPO3_DB']->isConnected());
        }
 
        /**
index 77ea8a3..0913a38 100644 (file)
@@ -64,10 +64,12 @@ class db_oracle_testcase extends BaseTestCase {
                $parserClassName = self::buildAccessibleProxy('ux_t3lib_sqlparser');
                $GLOBALS['TYPO3_DB']->SQLparser = new $parserClassName;
 
+               $this->assertFalse($GLOBALS['TYPO3_DB']->isConnected());
+
                        // Initialize a fake Oracle connection
                FakeDbConnection::connect($GLOBALS['TYPO3_DB'], 'oci8');
 
-               $this->assertTrue($GLOBALS['TYPO3_DB']->handlerInstance['_DEFAULT']->isConnected());
+               $this->assertTrue($GLOBALS['TYPO3_DB']->isConnected());
        }
 
        /**
index 4e8daba..103def4 100644 (file)
@@ -64,10 +64,12 @@ class db_postgresql_testcase extends BaseTestCase {
                $parserClassName = self::buildAccessibleProxy('ux_t3lib_sqlparser');
                $GLOBALS['TYPO3_DB']->SQLparser = new $parserClassName;
 
+               $this->assertFalse($GLOBALS['TYPO3_DB']->isConnected());
+
                        // Initialize a fake PostgreSQL connection (using 'postgres7' as 'postgres' is remapped to it in AdoDB)
                FakeDbConnection::connect($GLOBALS['TYPO3_DB'], 'postgres7');
 
-               $this->assertTrue($GLOBALS['TYPO3_DB']->handlerInstance['_DEFAULT']->isConnected());
+               $this->assertTrue($GLOBALS['TYPO3_DB']->isConnected());
        }
 
        /**
index 4e6abbd..17ac9f8 100644 (file)
@@ -420,6 +420,30 @@ class sqlparser_general_testcase extends BaseTestCase {
                $this->assertEquals($expected, $actual);
        }
 
+       /**
+        * @test
+        * @see http://bugs.typo3.org/view.php?id=14182
+        */
+       public function canParseMultipleJoinConditions() {
+               $sql = 'SELECT * FROM T1 LEFT OUTER JOIN T2 ON T2.pid = T1.uid AND T2.size = 4 WHERE T1.cr_userid = 1';
+               $expected = 'SELECT * FROM T1 LEFT OUTER JOIN T2 ON T2.pid=T1.uid AND T2.size=4 WHERE T1.cr_userid = 1';
+               $actual = $this->cleanSql($this->fixture->debug_testSQL($sql));
+
+               $this->assertEquals($expected, $actual);
+       }
+
+       /**
+        * @test
+        * @see http://bugs.typo3.org/view.php?id=14182 
+        */
+       public function canParseMultipleJoinConditionsWithLessThanOperator() {
+               $sql = 'SELECT * FROM T1 LEFT OUTER JOIN T2 ON T2.size < 4 OR T2.pid = T1.uid WHERE T1.cr_userid = 1';
+               $expected = 'SELECT * FROM T1 LEFT OUTER JOIN T2 ON T2.size<4 OR T2.pid=T1.uid WHERE T1.cr_userid = 1';
+               $actual = $this->cleanSql($this->fixture->debug_testSQL($sql));
+
+               $this->assertEquals($expected, $actual);
+       }
+
        ///////////////////////////////////////
        // Tests concerning DB management
        ///////////////////////////////////////