Skip to content
Snippets Groups Projects
Select Git revision
  • 4.0.3
  • master default protected
  • php84
  • detached7
  • detached6
  • detached5
  • detached
  • detached2
  • detached3
  • detached4
  • 4.x
  • origin/1.0.3
  • origin/1.0.2
  • 6.1.0
  • 6.0.6
  • 6.0.5
  • 6.0.4
  • 6.0.3
  • 6.0.2
  • 6.0.1
  • 6.0.0
  • 4.0.2
  • 4.0.1
  • 4.0
  • 3.1.7
  • 3.1.6
  • 3.1.5
  • 3.1.4
  • 3.1.3
  • 3.1.2
  • 3.1.1
  • 3.1.0
32 results

Module.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
         */