Select Git revision
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
*/