Skip to content
Snippets Groups Projects
Select Git revision
  • a668402ed1cf9a6b75a7cfdc60fb8019d8628aa6
  • master default protected
  • php84
  • ll-api-test
  • 6.x
  • release_6.2.0
  • modif_maintenance_phtml
  • 6.0.x
  • detached2
  • detached
  • php82
  • feature_SearchAndSelectFilter
  • 5.x
  • 4.x
  • 7.2.1
  • 7.2.0
  • 6.2.0
  • 7.1.0
  • 7.0.0
  • 1.1.1
  • 6.1.7
  • 6.1.6
  • 6.1.5
  • 6.0.16
  • 6.0.15
  • 6.1.4
  • 6.0.14
  • 6.1.3
  • 6.0.13
  • 6.1.2
  • 6.0.12
  • 6.1.1
  • 6.1.0
  • 6.0.11
34 results

RunSQLProcess.php

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    RunSQLProcess.php 7.47 KiB
    <?php
    
    namespace UnicaenApp\Service\SQL;
    
    use Doctrine\DBAL\Connection;
    use Exception;
    use UnicaenApp\Exception\RuntimeException;
    use Zend\Log\LoggerAwareTrait;
    use Zend\Stdlib\Glob;
    
    class RunSQLProcess
    {
        use LoggerAwareTrait;
    
        const QUERIES_SPLIT_PATTERN = "#^/$#m";
        const LOG_FILE_EXT = '.log.sql';
        const LOG_FILE_EXT_PATTERN = '.log.*.sql';
        const LOG_FILE_EXT_TEMPLATE = '.log.%d.sql';
    
        /**
         * @var string
         */
        private $scriptPath;
    
        /**
         * @var string
         */
        private $logFilePath;
    
        /**
         * @var Connection
         */
        private $connection;
    
        /**
         * @var string[]
         */
        private $queries;
    
        /**
         * @var RunSQLQueryStack
         */
        private $executedQueriesStack;
    
        /**
         * @param string $scriptPath
         * @return self
         */
        public function setScriptPath(string $scriptPath)
        {
            $this->scriptPath = $scriptPath;
    
            return $this;
        }
    
        /**
         * @param Connection $connection
         * @return RunSQLProcess
         */
        public function setConnection(Connection $connection)
        {
            $this->connection = $connection;
    
            return $this;
        }
    
        /**
         * @param null|string $logFilePath
         * @return self
         */