Skip to content
Snippets Groups Projects

Issue #3245880: Oracle driver need upgrade as a normal module, and compatible with drupal up to 9.2

Open Issue #3245880: Oracle driver need upgrade as a normal module, and compatible with drupal up to 9.2
Open Lucas Yeung requested to merge issue/oracle-3245880:3.0.x into 8.x-1.x
41 files
+ 177
119
Compare changes
  • Side-by-side
  • Inline
Files
41
<?php
<?php
namespace Drupal\Driver\Database\oracle\Install;
namespace Drupal\oracle\Driver\Database\oracle\Install;
use Drupal\Core\Database\Install\Tasks as InstallTasks;
use Drupal\Core\Database\Database;
use Drupal\Driver\Database\oracle\Connection;
/**
/**
* Specifies installation tasks for Oracle and equivalent databases.
* Generate oracle database macros.
*/
*/
class Tasks extends InstallTasks {
class OracleInitial {
/**
* {@inheritdoc}
*/
protected $pdoDriver = 'oci';
/**
* {@inheritdoc}
*/
private $pdoBindLengthLimits = array(4000, 1332, 665);
private $pdoBindLengthLimits = array(4000, 1332, 665);
/**
protected $connection;
* {@inheritdoc}
*/
public function name() {
return t('Oracle');
}
/**
* {@inheritdoc}
*/
public function minimumVersion() {
// @TODO: add version validation.
return NULL;
}
/**
public function __construct($connection) {
* {@inheritdoc}
$this->connection = $connection;
*/
public function getFormOptions(array $database) {
$form = parent::getFormOptions($database);
if (empty($form['advanced_options']['port']['#default_value'])) {
$form['advanced_options']['port']['#default_value'] = '1521';
}
return $form;
}
}
/**
public function initial() {
* {@inheritdoc}
$dir = __DIR__ . '/../resources';
*/
$this->determineSupportedBindSize();
protected function connect() {
$this->createFailsafeObjects("{$dir}/table");
try {
$this->createFailsafeObjects("{$dir}/index");
// This doesn't actually test the connection.
$this->createFailsafeObjects("{$dir}/sequence");
Database::setActiveConnection();
$this->createObjects("{$dir}/function");
$this->createObjects("{$dir}/procedure");
$dir = DRUPAL_ROOT . '/drivers/lib/Drupal/Driver/Database/oracle/resources';
$this->createSpObjects("{$dir}/type");
$this->determineSupportedBindSize();
$this->createSpObjects("{$dir}/package");
$this->createFailsafeObjects("{$dir}/table");
$this->oracleQuery("begin dbms_utility.compile_schema(user); end;");
$this->createFailsafeObjects("{$dir}/index");
$this->createFailsafeObjects("{$dir}/sequence");
$this->createObjects("{$dir}/function");
$this->createObjects("{$dir}/procedure");
$this->createSpObjects("{$dir}/type");
$this->createSpObjects("{$dir}/package");
$this->oracleQuery("begin dbms_utility.compile_schema(user); end;");
$this->pass('Oracle has initialized itself.');
Database::getConnection('default')->makePrimary();
}
catch (\Exception $e) {
if ($e->getCode() == Connection::DATABASE_NOT_FOUND) {
// Remove the database string from connection info.
$connection_info = Database::getConnectionInfo();
$database = $connection_info['default']['database'];
unset($connection_info['default']['database']);
$this->fail(t('Database %database not found. The server reports the following message when attempting to create the database: %error.', array('%database' => $database, '%error' => $e->getMessage())));
}
return FALSE;
}
return TRUE;
}
}
/**
/**
* Oracle helper for install tasks.
* Oracle helper for install tasks.
*/
*/
private function oracleQuery($sql, $args = NULL) {
private function oracleQuery($sql, $args = NULL) {
return Database::getConnection()->queryOracle($sql, $args);
return $this->connection->queryOracle($sql, $args);
}
}
/**
/**
@@ -224,5 +168,4 @@ class Tasks extends InstallTasks {
@@ -224,5 +168,4 @@ class Tasks extends InstallTasks {
}
}
return FALSE;
return FALSE;
}
}
}
}
Loading