Commit cbcaa6cc authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Fix provisoire : inscription manuelle du listener OracleSessionInit car elle...

Fix provisoire : inscription manuelle du listener OracleSessionInit car elle n'est pas faite automatiquement!
parent d85dc4cd
Loading
Loading
Loading
Loading
+17 −11
Original line number Diff line number Diff line
@@ -3,7 +3,9 @@
namespace UnicaenDbImport;

use Doctrine\Common\EventManager;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Event\Listeners\OracleSessionInit;
use Doctrine\DBAL\Platforms\OraclePlatform;
use DoctrineORMModule\Options\EntityManager;
use UnicaenApp\Exception\RuntimeException;
use UnicaenDbImport\CodeGenerator\Common\AbstractCodeGenerator;
@@ -180,17 +182,21 @@ class DatabaseFacade

        $selectSql = $this->codeGenerator->generateSQLForSelectFromSource($source);

        // select from source
        //$a = $source->getConnection();
        //var_dump($a);
        //die("fin populate");
//        $evm = new EventManager();
//        $evm->addEventSubscriber(new OracleSessionInit(array(
//            'NLS_NUMERIC_CHARACTERS' => '.',
//        )));
        //
        // Inscription manuelle du listener OracleSessionInit.
        // TODO: trouver pourquoi l'inscription automatique ne fonctionne pas.
        //
        try {
            $sourcePlatform = $source->getConnection()->getDatabasePlatform();
        } catch (DBALException $e) {
            throw new RuntimeException("Impossible de déterminer le type de SGBD", null, $e);
        }
        if ($sourcePlatform instanceof OraclePlatform) {
            $a = $source->getConnection();
            $a->getEventManager()->addEventSubscriber(new OracleSessionInit());
            $result = $this->queryExecutor->fetchAll($selectSql, $a);
        }
        //

        $insertsSQL = '';
        foreach ($result as $row) {