Commit 88548a92 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Prise en compte des microsecondes dans les dates de début/fin inscrites dans...

Prise en compte des microsecondes dans les dates de début/fin inscrites dans la table de logs et donc dans la durée d'exécution calculée (nécessite le type TIMESTAMP sous Oracle).
parent 39468e7c
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ Changelog
7.2.0
-----
- Suppression de la dépendance avec unicaen/app, et avec laminas/laminas-dependency-plugin.
- Prise en compte des microsecondes dans les dates de début/fin inscrites dans la table de logs et donc dans la durée d'exécution calculée (nécessite le type TIMESTAMP sous Oracle).
- [FIX] Le générateur SQL de la destination était utilisé aussi pour interroger la source, désormais la source a le sien propre.

7.1.0
+2 −2
Original line number Diff line number Diff line
@@ -82,8 +82,8 @@ create table IMPORT_LOG
    name varchar2(128) not null,
    success int(1) not null,
    log clob not null,
    started_on date not null,
    ended_on date not null,
    started_on TIMESTAMP not null,
    ended_on TIMESTAMP not null,
    import_hash varchar2(64)
);
create sequence IMPORT_LOG_ID_SEQ;
+7 −4
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace UnicaenDbImport\CodeGenerator\Helper;

use DateTime;
use Exception;
use UnicaenDbImport\CodeGenerator\Helper;
use UnicaenDbImport\Domain\ImportResult;
@@ -82,8 +83,8 @@ EOT;
                $log .= PHP_EOL . 'Previous : ' . $exception->getMessage();
            }
        }
        $startDate = $result->getStartDate()->format("Y-m-d H:i:s");
        $endDate = $result->getEndDate()->format("Y-m-d H:i:s");
        $startDate = $this->generateSQLForDateTimeColumnValueInsert($result->getStartDate());
        $endDate = $this->generateSQLForDateTimeColumnValueInsert($result->getEndDate());

        try {
            $hash = $result->getHash();
@@ -98,11 +99,13 @@ EOT;
            $success,
            $hasProblems,
            $this->platform->quoteStringLiteral($log),
            $this->platform->quoteStringLiteral($startDate),
            $this->platform->quoteStringLiteral($endDate),
            $startDate,
            $endDate,
            $this->platform->quoteStringLiteral($hash)
        );

        return $sql;
    }

    abstract protected function generateSQLForDateTimeColumnValueInsert(DateTime $datetime): string;
}
 No newline at end of file
+5 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace UnicaenDbImport\CodeGenerator\Oracle\Helper;

use DateTime;
use UnicaenDbImport\Platforms\OraclePlatform;

/**
@@ -26,4 +27,8 @@ class LogTableHelper extends \UnicaenDbImport\CodeGenerator\Helper\LogTableHelpe
        $this->platform = new OraclePlatform();
    }

    protected function generateSQLForDateTimeColumnValueInsert(DateTime $datetime): string
    {
        return sprintf("to_timestamp('%s', 'YYYY-MM-DD HH24:MI:SS.FF')", $datetime->format("Y-m-d H:i:s.u"));
    }
}
 No newline at end of file
+5 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace UnicaenDbImport\CodeGenerator\PostgreSQL\Helper;

use DateTime;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;

/**
@@ -26,4 +27,8 @@ class LogTableHelper extends \UnicaenDbImport\CodeGenerator\Helper\LogTableHelpe
        $this->platform = new PostgreSqlPlatform();
    }

    protected function generateSQLForDateTimeColumnValueInsert(DateTime $datetime): string
    {
        return $this->platform->quoteStringLiteral($datetime->format("Y-m-d H:i:s.u"));
    }
}
 No newline at end of file
Loading