the whole shebang
This commit is contained in:
148
vendor/doctrine/dbal/lib/Doctrine/DBAL/Cache/ArrayStatement.php
vendored
Normal file
148
vendor/doctrine/dbal/lib/Doctrine/DBAL/Cache/ArrayStatement.php
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Cache;
|
||||
|
||||
use Doctrine\DBAL\Driver\ResultStatement;
|
||||
use PDO;
|
||||
|
||||
class ArrayStatement implements \IteratorAggregate, ResultStatement
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $data;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
private $columnCount = 0;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
private $num = 0;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
private $defaultFetchMode = PDO::FETCH_BOTH;
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
*/
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->data = $data;
|
||||
if (count($data)) {
|
||||
$this->columnCount = count($data[0]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function closeCursor()
|
||||
{
|
||||
unset ($this->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function columnCount()
|
||||
{
|
||||
return $this->columnCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null)
|
||||
{
|
||||
if ($arg2 !== null || $arg3 !== null) {
|
||||
throw new \InvalidArgumentException("Caching layer does not support 2nd/3rd argument to setFetchMode()");
|
||||
}
|
||||
|
||||
$this->defaultFetchMode = $fetchMode;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
$data = $this->fetchAll();
|
||||
|
||||
return new \ArrayIterator($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetch($fetchMode = null)
|
||||
{
|
||||
if (isset($this->data[$this->num])) {
|
||||
$row = $this->data[$this->num++];
|
||||
$fetchMode = $fetchMode ?: $this->defaultFetchMode;
|
||||
if ($fetchMode === PDO::FETCH_ASSOC) {
|
||||
return $row;
|
||||
} else if ($fetchMode === PDO::FETCH_NUM) {
|
||||
return array_values($row);
|
||||
} else if ($fetchMode === PDO::FETCH_BOTH) {
|
||||
return array_merge($row, array_values($row));
|
||||
} else if ($fetchMode === PDO::FETCH_COLUMN) {
|
||||
return reset($row);
|
||||
} else {
|
||||
throw new \InvalidArgumentException("Invalid fetch-style given for fetching result.");
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchAll($fetchMode = null)
|
||||
{
|
||||
$rows = array();
|
||||
while ($row = $this->fetch($fetchMode)) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchColumn($columnIndex = 0)
|
||||
{
|
||||
$row = $this->fetch(PDO::FETCH_NUM);
|
||||
if (!isset($row[$columnIndex])) {
|
||||
// TODO: verify this is correct behavior
|
||||
return false;
|
||||
}
|
||||
|
||||
return $row[$columnIndex];
|
||||
}
|
||||
}
|
||||
43
vendor/doctrine/dbal/lib/Doctrine/DBAL/Cache/CacheException.php
vendored
Normal file
43
vendor/doctrine/dbal/lib/Doctrine/DBAL/Cache/CacheException.php
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Cache;
|
||||
|
||||
/**
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @since 2.2
|
||||
*/
|
||||
class CacheException extends \Doctrine\DBAL\DBALException
|
||||
{
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Cache\CacheException
|
||||
*/
|
||||
static public function noCacheKey()
|
||||
{
|
||||
return new self("No cache key was set.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Cache\CacheException
|
||||
*/
|
||||
static public function noResultDriverConfigured()
|
||||
{
|
||||
return new self("Trying to cache a query but no result driver is configured.");
|
||||
}
|
||||
}
|
||||
141
vendor/doctrine/dbal/lib/Doctrine/DBAL/Cache/QueryCacheProfile.php
vendored
Normal file
141
vendor/doctrine/dbal/lib/Doctrine/DBAL/Cache/QueryCacheProfile.php
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Cache;
|
||||
|
||||
use Doctrine\Common\Cache\Cache;
|
||||
|
||||
/**
|
||||
* Query Cache Profile handles the data relevant for query caching.
|
||||
*
|
||||
* It is a value object, setter methods return NEW instances.
|
||||
*
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class QueryCacheProfile
|
||||
{
|
||||
/**
|
||||
* @var \Doctrine\Common\Cache\Cache|null
|
||||
*/
|
||||
private $resultCacheDriver;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
private $lifetime = 0;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $cacheKey;
|
||||
|
||||
/**
|
||||
* @param integer $lifetime
|
||||
* @param string|null $cacheKey
|
||||
* @param \Doctrine\Common\Cache\Cache|null $resultCache
|
||||
*/
|
||||
public function __construct($lifetime = 0, $cacheKey = null, Cache $resultCache = null)
|
||||
{
|
||||
$this->lifetime = $lifetime;
|
||||
$this->cacheKey = $cacheKey;
|
||||
$this->resultCacheDriver = $resultCache;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\Common\Cache\Cache|null
|
||||
*/
|
||||
public function getResultCacheDriver()
|
||||
{
|
||||
return $this->resultCacheDriver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getLifetime()
|
||||
{
|
||||
return $this->lifetime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*
|
||||
* @throws \Doctrine\DBAL\Cache\CacheException
|
||||
*/
|
||||
public function getCacheKey()
|
||||
{
|
||||
if ($this->cacheKey === null) {
|
||||
throw CacheException::noCacheKey();
|
||||
}
|
||||
|
||||
return $this->cacheKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the real cache key from query, params and types.
|
||||
*
|
||||
* @param string $query
|
||||
* @param array $params
|
||||
* @param array $types
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function generateCacheKeys($query, $params, $types)
|
||||
{
|
||||
$realCacheKey = $query . "-" . serialize($params) . "-" . serialize($types);
|
||||
// should the key be automatically generated using the inputs or is the cache key set?
|
||||
if ($this->cacheKey === null) {
|
||||
$cacheKey = sha1($realCacheKey);
|
||||
} else {
|
||||
$cacheKey = $this->cacheKey;
|
||||
}
|
||||
|
||||
return array($cacheKey, $realCacheKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Doctrine\Common\Cache\Cache $cache
|
||||
*
|
||||
* @return \Doctrine\DBAL\Cache\QueryCacheProfile
|
||||
*/
|
||||
public function setResultCacheDriver(Cache $cache)
|
||||
{
|
||||
return new QueryCacheProfile($this->lifetime, $this->cacheKey, $cache);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $cacheKey
|
||||
*
|
||||
* @return \Doctrine\DBAL\Cache\QueryCacheProfile
|
||||
*/
|
||||
public function setCacheKey($cacheKey)
|
||||
{
|
||||
return new QueryCacheProfile($this->lifetime, $cacheKey, $this->resultCacheDriver);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $lifetime
|
||||
*
|
||||
* @return \Doctrine\DBAL\Cache\QueryCacheProfile
|
||||
*/
|
||||
public function setLifetime($lifetime)
|
||||
{
|
||||
return new QueryCacheProfile($lifetime, $this->cacheKey, $this->resultCacheDriver);
|
||||
}
|
||||
}
|
||||
221
vendor/doctrine/dbal/lib/Doctrine/DBAL/Cache/ResultCacheStatement.php
vendored
Normal file
221
vendor/doctrine/dbal/lib/Doctrine/DBAL/Cache/ResultCacheStatement.php
vendored
Normal file
@@ -0,0 +1,221 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Cache;
|
||||
|
||||
use Doctrine\DBAL\Driver\Statement;
|
||||
use Doctrine\DBAL\Driver\ResultStatement;
|
||||
use Doctrine\Common\Cache\Cache;
|
||||
use PDO;
|
||||
|
||||
/**
|
||||
* Cache statement for SQL results.
|
||||
*
|
||||
* A result is saved in multiple cache keys, there is the originally specified
|
||||
* cache key which is just pointing to result rows by key. The following things
|
||||
* have to be ensured:
|
||||
*
|
||||
* 1. lifetime of the original key has to be longer than that of all the individual rows keys
|
||||
* 2. if any one row key is missing the query has to be re-executed.
|
||||
*
|
||||
* Also you have to realize that the cache will load the whole result into memory at once to ensure 2.
|
||||
* This means that the memory usage for cached results might increase by using this feature.
|
||||
*/
|
||||
class ResultCacheStatement implements \IteratorAggregate, ResultStatement
|
||||
{
|
||||
/**
|
||||
* @var \Doctrine\Common\Cache\Cache
|
||||
*/
|
||||
private $resultCache;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $cacheKey;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $realKey;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
private $lifetime;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Driver\Statement
|
||||
*/
|
||||
private $statement;
|
||||
|
||||
/**
|
||||
* Did we reach the end of the statement?
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $emptied = false;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $data;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
private $defaultFetchMode = PDO::FETCH_BOTH;
|
||||
|
||||
/**
|
||||
* @param \Doctrine\DBAL\Driver\Statement $stmt
|
||||
* @param \Doctrine\Common\Cache\Cache $resultCache
|
||||
* @param string $cacheKey
|
||||
* @param string $realKey
|
||||
* @param integer $lifetime
|
||||
*/
|
||||
public function __construct(Statement $stmt, Cache $resultCache, $cacheKey, $realKey, $lifetime)
|
||||
{
|
||||
$this->statement = $stmt;
|
||||
$this->resultCache = $resultCache;
|
||||
$this->cacheKey = $cacheKey;
|
||||
$this->realKey = $realKey;
|
||||
$this->lifetime = $lifetime;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function closeCursor()
|
||||
{
|
||||
$this->statement->closeCursor();
|
||||
if ($this->emptied && $this->data !== null) {
|
||||
$data = $this->resultCache->fetch($this->cacheKey);
|
||||
if ( ! $data) {
|
||||
$data = array();
|
||||
}
|
||||
$data[$this->realKey] = $this->data;
|
||||
|
||||
$this->resultCache->save($this->cacheKey, $data, $this->lifetime);
|
||||
unset($this->data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function columnCount()
|
||||
{
|
||||
return $this->statement->columnCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null)
|
||||
{
|
||||
$this->defaultFetchMode = $fetchMode;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
$data = $this->fetchAll();
|
||||
|
||||
return new \ArrayIterator($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetch($fetchMode = null)
|
||||
{
|
||||
if ($this->data === null) {
|
||||
$this->data = array();
|
||||
}
|
||||
|
||||
$row = $this->statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($row) {
|
||||
$this->data[] = $row;
|
||||
|
||||
$fetchMode = $fetchMode ?: $this->defaultFetchMode;
|
||||
|
||||
if ($fetchMode == PDO::FETCH_ASSOC) {
|
||||
return $row;
|
||||
} else if ($fetchMode == PDO::FETCH_NUM) {
|
||||
return array_values($row);
|
||||
} else if ($fetchMode == PDO::FETCH_BOTH) {
|
||||
return array_merge($row, array_values($row));
|
||||
} else if ($fetchMode == PDO::FETCH_COLUMN) {
|
||||
return reset($row);
|
||||
} else {
|
||||
throw new \InvalidArgumentException("Invalid fetch-style given for caching result.");
|
||||
}
|
||||
}
|
||||
$this->emptied = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchAll($fetchMode = null)
|
||||
{
|
||||
$rows = array();
|
||||
while ($row = $this->fetch($fetchMode)) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchColumn($columnIndex = 0)
|
||||
{
|
||||
$row = $this->fetch(PDO::FETCH_NUM);
|
||||
if (!isset($row[$columnIndex])) {
|
||||
// TODO: verify this is correct behavior
|
||||
return false;
|
||||
}
|
||||
|
||||
return $row[$columnIndex];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement
|
||||
* executed by the corresponding object.
|
||||
*
|
||||
* If the last SQL statement executed by the associated Statement object was a SELECT statement,
|
||||
* some databases may return the number of rows returned by that statement. However,
|
||||
* this behaviour is not guaranteed for all databases and should not be
|
||||
* relied on for portable applications.
|
||||
*
|
||||
* @return integer The number of rows.
|
||||
*/
|
||||
public function rowCount()
|
||||
{
|
||||
return $this->statement->rowCount();
|
||||
}
|
||||
}
|
||||
120
vendor/doctrine/dbal/lib/Doctrine/DBAL/Configuration.php
vendored
Normal file
120
vendor/doctrine/dbal/lib/Doctrine/DBAL/Configuration.php
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL;
|
||||
|
||||
use Doctrine\DBAL\Logging\SQLLogger;
|
||||
use Doctrine\Common\Cache\Cache;
|
||||
|
||||
/**
|
||||
* Configuration container for the Doctrine DBAL.
|
||||
*
|
||||
* @since 2.0
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @internal When adding a new configuration option just write a getter/setter
|
||||
* pair and add the option to the _attributes array with a proper default value.
|
||||
*/
|
||||
class Configuration
|
||||
{
|
||||
/**
|
||||
* The attributes that are contained in the configuration.
|
||||
* Values are default values.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_attributes = array();
|
||||
|
||||
/**
|
||||
* Sets the SQL logger to use. Defaults to NULL which means SQL logging is disabled.
|
||||
*
|
||||
* @param \Doctrine\DBAL\Logging\SQLLogger|null $logger
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSQLLogger(SQLLogger $logger = null)
|
||||
{
|
||||
$this->_attributes['sqlLogger'] = $logger;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the SQL logger that is used.
|
||||
*
|
||||
* @return \Doctrine\DBAL\Logging\SQLLogger
|
||||
*/
|
||||
public function getSQLLogger()
|
||||
{
|
||||
return isset($this->_attributes['sqlLogger']) ?
|
||||
$this->_attributes['sqlLogger'] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cache driver implementation that is used for query result caching.
|
||||
*
|
||||
* @return \Doctrine\Common\Cache\Cache|null
|
||||
*/
|
||||
public function getResultCacheImpl()
|
||||
{
|
||||
return isset($this->_attributes['resultCacheImpl']) ?
|
||||
$this->_attributes['resultCacheImpl'] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cache driver implementation that is used for query result caching.
|
||||
*
|
||||
* @param \Doctrine\Common\Cache\Cache $cacheImpl
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setResultCacheImpl(Cache $cacheImpl)
|
||||
{
|
||||
$this->_attributes['resultCacheImpl'] = $cacheImpl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the filter schema assets expression.
|
||||
*
|
||||
* Only include tables/sequences matching the filter expression regexp in
|
||||
* schema instances generated for the active connection when calling
|
||||
* {AbstractSchemaManager#createSchema()}.
|
||||
*
|
||||
* @param string $filterExpression
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setFilterSchemaAssetsExpression($filterExpression)
|
||||
{
|
||||
$this->_attributes['filterSchemaAssetsExpression'] = $filterExpression;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns filter schema assets expression.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getFilterSchemaAssetsExpression()
|
||||
{
|
||||
if (isset($this->_attributes['filterSchemaAssetsExpression'])) {
|
||||
return $this->_attributes['filterSchemaAssetsExpression'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
1410
vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php
vendored
Normal file
1410
vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
60
vendor/doctrine/dbal/lib/Doctrine/DBAL/ConnectionException.php
vendored
Normal file
60
vendor/doctrine/dbal/lib/Doctrine/DBAL/ConnectionException.php
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL;
|
||||
|
||||
/**
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Jonathan H. Wage <jonwage@gmail.com
|
||||
*/
|
||||
class ConnectionException extends DBALException
|
||||
{
|
||||
/**
|
||||
* @return \Doctrine\DBAL\ConnectionException
|
||||
*/
|
||||
public static function commitFailedRollbackOnly()
|
||||
{
|
||||
return new self("Transaction commit failed because the transaction has been marked for rollback only.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\ConnectionException
|
||||
*/
|
||||
public static function noActiveTransaction()
|
||||
{
|
||||
return new self("There is no active transaction.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\ConnectionException
|
||||
*/
|
||||
public static function savepointsNotSupported()
|
||||
{
|
||||
return new self("Savepoints are not supported by this driver.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\ConnectionException
|
||||
*/
|
||||
public static function mayNotAlterNestedTransactionWithSavepointsInTransaction()
|
||||
{
|
||||
return new self("May not alter the nested transaction with savepoints behavior while a transaction is open.");
|
||||
}
|
||||
}
|
||||
375
vendor/doctrine/dbal/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php
vendored
Normal file
375
vendor/doctrine/dbal/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php
vendored
Normal file
@@ -0,0 +1,375 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Connections;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Doctrine\DBAL\Driver;
|
||||
use Doctrine\DBAL\Configuration;
|
||||
use Doctrine\Common\EventManager;
|
||||
use Doctrine\DBAL\Event\ConnectionEventArgs;
|
||||
use Doctrine\DBAL\Events;
|
||||
|
||||
/**
|
||||
* Master-Slave Connection
|
||||
*
|
||||
* Connection can be used with master-slave setups.
|
||||
*
|
||||
* Important for the understanding of this connection should be how and when
|
||||
* it picks the slave or master.
|
||||
*
|
||||
* 1. Slave if master was never picked before and ONLY if 'getWrappedConnection'
|
||||
* or 'executeQuery' is used.
|
||||
* 2. Master picked when 'exec', 'executeUpdate', 'insert', 'delete', 'update', 'createSavepoint',
|
||||
* 'releaseSavepoint', 'beginTransaction', 'rollback', 'commit', 'query' or
|
||||
* 'prepare' is called.
|
||||
* 3. If master was picked once during the lifetime of the connection it will always get picked afterwards.
|
||||
* 4. One slave connection is randomly picked ONCE during a request.
|
||||
*
|
||||
* ATTENTION: You can write to the slave with this connection if you execute a write query without
|
||||
* opening up a transaction. For example:
|
||||
*
|
||||
* $conn = DriverManager::getConnection(...);
|
||||
* $conn->executeQuery("DELETE FROM table");
|
||||
*
|
||||
* Be aware that Connection#executeQuery is a method specifically for READ
|
||||
* operations only.
|
||||
*
|
||||
* This connection is limited to slave operations using the
|
||||
* Connection#executeQuery operation only, because it wouldn't be compatible
|
||||
* with the ORM or SchemaManager code otherwise. Both use all the other
|
||||
* operations in a context where writes could happen to a slave, which makes
|
||||
* this restricted approach necessary.
|
||||
*
|
||||
* You can manually connect to the master at any time by calling:
|
||||
*
|
||||
* $conn->connect('master');
|
||||
*
|
||||
* Instantiation through the DriverManager looks like:
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* $conn = DriverManager::getConnection(array(
|
||||
* 'wrapperClass' => 'Doctrine\DBAL\Connections\MasterSlaveConnection',
|
||||
* 'driver' => 'pdo_mysql',
|
||||
* 'master' => array('user' => '', 'password' => '', 'host' => '', 'dbname' => ''),
|
||||
* 'slaves' => array(
|
||||
* array('user' => 'slave1', 'password', 'host' => '', 'dbname' => ''),
|
||||
* array('user' => 'slave2', 'password', 'host' => '', 'dbname' => ''),
|
||||
* )
|
||||
* ));
|
||||
*
|
||||
* You can also pass 'driverOptions' and any other documented option to each of this drivers to pass additional information.
|
||||
*
|
||||
* @author Lars Strojny <lstrojny@php.net>
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class MasterSlaveConnection extends Connection
|
||||
{
|
||||
/**
|
||||
* Master and slave connection (one of the randomly picked slaves).
|
||||
*
|
||||
* @var \Doctrine\DBAL\Driver\Connection[]
|
||||
*/
|
||||
protected $connections = array('master' => null, 'slave' => null);
|
||||
|
||||
/**
|
||||
* You can keep the slave connection and then switch back to it
|
||||
* during the request if you know what you are doing.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $keepSlave = false;
|
||||
|
||||
/**
|
||||
* Creates Master Slave Connection.
|
||||
*
|
||||
* @param array $params
|
||||
* @param \Doctrine\DBAL\Driver $driver
|
||||
* @param \Doctrine\DBAL\Configuration|null $config
|
||||
* @param \Doctrine\Common\EventManager|null $eventManager
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function __construct(array $params, Driver $driver, Configuration $config = null, EventManager $eventManager = null)
|
||||
{
|
||||
if ( !isset($params['slaves']) || !isset($params['master']) ) {
|
||||
throw new \InvalidArgumentException('master or slaves configuration missing');
|
||||
}
|
||||
if ( count($params['slaves']) == 0 ) {
|
||||
throw new \InvalidArgumentException('You have to configure at least one slaves.');
|
||||
}
|
||||
|
||||
$params['master']['driver'] = $params['driver'];
|
||||
foreach ($params['slaves'] as $slaveKey => $slave) {
|
||||
$params['slaves'][$slaveKey]['driver'] = $params['driver'];
|
||||
}
|
||||
|
||||
$this->keepSlave = isset($params['keepSlave']) ? (bool)$params['keepSlave'] : false;
|
||||
|
||||
parent::__construct($params, $driver, $config, $eventManager);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the connection is currently towards the master or not.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isConnectedToMaster()
|
||||
{
|
||||
return $this->_conn !== null && $this->_conn === $this->connections['master'];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function connect($connectionName = null)
|
||||
{
|
||||
$requestedConnectionChange = ($connectionName !== null);
|
||||
$connectionName = $connectionName ?: 'slave';
|
||||
|
||||
if ( $connectionName !== 'slave' && $connectionName !== 'master' ) {
|
||||
throw new \InvalidArgumentException("Invalid option to connect(), only master or slave allowed.");
|
||||
}
|
||||
|
||||
// If we have a connection open, and this is not an explicit connection
|
||||
// change request, then abort right here, because we are already done.
|
||||
// This prevents writes to the slave in case of "keepSlave" option enabled.
|
||||
if ($this->_conn && !$requestedConnectionChange) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$forceMasterAsSlave = false;
|
||||
|
||||
if ($this->getTransactionNestingLevel() > 0) {
|
||||
$connectionName = 'master';
|
||||
$forceMasterAsSlave = true;
|
||||
}
|
||||
|
||||
if ($this->connections[$connectionName]) {
|
||||
if ($forceMasterAsSlave) {
|
||||
$this->connections['slave'] = $this->_conn = $this->connections['master'];
|
||||
} else {
|
||||
$this->_conn = $this->connections[$connectionName];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($connectionName === 'master') {
|
||||
// Set slave connection to master to avoid invalid reads
|
||||
if ($this->connections['slave'] && ! $this->keepSlave) {
|
||||
unset($this->connections['slave']);
|
||||
}
|
||||
|
||||
$this->connections['master'] = $this->_conn = $this->connectTo($connectionName);
|
||||
|
||||
if ( ! $this->keepSlave) {
|
||||
$this->connections['slave'] = $this->connections['master'];
|
||||
}
|
||||
} else {
|
||||
$this->connections['slave'] = $this->_conn = $this->connectTo($connectionName);
|
||||
}
|
||||
|
||||
if ($this->_eventManager->hasListeners(Events::postConnect)) {
|
||||
$eventArgs = new ConnectionEventArgs($this);
|
||||
$this->_eventManager->dispatchEvent(Events::postConnect, $eventArgs);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connects to a specific connection.
|
||||
*
|
||||
* @param string $connectionName
|
||||
*
|
||||
* @return \Doctrine\DBAL\Driver
|
||||
*/
|
||||
protected function connectTo($connectionName)
|
||||
{
|
||||
$params = $this->getParams();
|
||||
|
||||
$driverOptions = isset($params['driverOptions']) ? $params['driverOptions'] : array();
|
||||
|
||||
$connectionParams = $this->chooseConnectionConfiguration($connectionName, $params);
|
||||
|
||||
$user = isset($connectionParams['user']) ? $connectionParams['user'] : null;
|
||||
$password = isset($connectionParams['password']) ? $connectionParams['password'] : null;
|
||||
|
||||
return $this->_driver->connect($connectionParams, $user, $password, $driverOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $connectionName
|
||||
* @param array $params
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function chooseConnectionConfiguration($connectionName, $params)
|
||||
{
|
||||
if ($connectionName === 'master') {
|
||||
return $params['master'];
|
||||
}
|
||||
|
||||
return $params['slaves'][array_rand($params['slaves'])];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function executeUpdate($query, array $params = array(), array $types = array())
|
||||
{
|
||||
$this->connect('master');
|
||||
|
||||
return parent::executeUpdate($query, $params, $types);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function beginTransaction()
|
||||
{
|
||||
$this->connect('master');
|
||||
|
||||
return parent::beginTransaction();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function commit()
|
||||
{
|
||||
$this->connect('master');
|
||||
|
||||
return parent::commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function rollBack()
|
||||
{
|
||||
$this->connect('master');
|
||||
|
||||
return parent::rollBack();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function delete($tableName, array $identifier, array $types = array())
|
||||
{
|
||||
$this->connect('master');
|
||||
|
||||
return parent::delete($tableName, $identifier, $types);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function update($tableName, array $data, array $identifier, array $types = array())
|
||||
{
|
||||
$this->connect('master');
|
||||
|
||||
return parent::update($tableName, $data, $identifier, $types);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function insert($tableName, array $data, array $types = array())
|
||||
{
|
||||
$this->connect('master');
|
||||
|
||||
return parent::insert($tableName, $data, $types);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function exec($statement)
|
||||
{
|
||||
$this->connect('master');
|
||||
|
||||
return parent::exec($statement);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function createSavepoint($savepoint)
|
||||
{
|
||||
$this->connect('master');
|
||||
|
||||
return parent::createSavepoint($savepoint);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function releaseSavepoint($savepoint)
|
||||
{
|
||||
$this->connect('master');
|
||||
|
||||
return parent::releaseSavepoint($savepoint);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function rollbackSavepoint($savepoint)
|
||||
{
|
||||
$this->connect('master');
|
||||
|
||||
return parent::rollbackSavepoint($savepoint);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function query()
|
||||
{
|
||||
$this->connect('master');
|
||||
|
||||
$args = func_get_args();
|
||||
|
||||
$logger = $this->getConfiguration()->getSQLLogger();
|
||||
if ($logger) {
|
||||
$logger->startQuery($args[0]);
|
||||
}
|
||||
|
||||
$statement = call_user_func_array(array($this->_conn, 'query'), $args);
|
||||
|
||||
if ($logger) {
|
||||
$logger->stopQuery();
|
||||
}
|
||||
|
||||
return $statement;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function prepare($statement)
|
||||
{
|
||||
$this->connect('master');
|
||||
|
||||
return parent::prepare($statement);
|
||||
}
|
||||
}
|
||||
202
vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php
vendored
Normal file
202
vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL;
|
||||
|
||||
class DBALException extends \Exception
|
||||
{
|
||||
/**
|
||||
* @param string $method
|
||||
*
|
||||
* @return \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
public static function notSupported($method)
|
||||
{
|
||||
return new self("Operation '$method' is not supported by platform.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
public static function invalidPlatformSpecified()
|
||||
{
|
||||
return new self(
|
||||
"Invalid 'platform' option specified, need to give an instance of ".
|
||||
"\Doctrine\DBAL\Platforms\AbstractPlatform.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
public static function invalidPdoInstance()
|
||||
{
|
||||
return new self(
|
||||
"The 'pdo' option was used in DriverManager::getConnection() but no ".
|
||||
"instance of PDO was given."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
public static function driverRequired()
|
||||
{
|
||||
return new self("The options 'driver' or 'driverClass' are mandatory if no PDO ".
|
||||
"instance is given to DriverManager::getConnection().");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $unknownDriverName
|
||||
* @param array $knownDrivers
|
||||
*
|
||||
* @return \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
public static function unknownDriver($unknownDriverName, array $knownDrivers)
|
||||
{
|
||||
return new self("The given 'driver' ".$unknownDriverName." is unknown, ".
|
||||
"Doctrine currently supports only the following drivers: ".implode(", ", $knownDrivers));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Exception $driverEx
|
||||
* @param string $sql
|
||||
* @param array $params
|
||||
*
|
||||
* @return \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
public static function driverExceptionDuringQuery(\Exception $driverEx, $sql, array $params = array())
|
||||
{
|
||||
$msg = "An exception occurred while executing '".$sql."'";
|
||||
if ($params) {
|
||||
$msg .= " with params " . self::formatParameters($params);
|
||||
}
|
||||
$msg .= ":\n\n".$driverEx->getMessage();
|
||||
|
||||
return new self($msg, 0, $driverEx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a human-readable representation of an array of parameters.
|
||||
* This properly handles binary data by returning a hex representation.
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function formatParameters(array $params)
|
||||
{
|
||||
return '[' . implode(', ', array_map(function($param) {
|
||||
$json = @json_encode($param);
|
||||
|
||||
if (! is_string($json) || $json == 'null' && is_string($param)) {
|
||||
// JSON encoding failed, this is not a UTF-8 string.
|
||||
return '"\x' . implode('\x', str_split(bin2hex($param), 2)) . '"';
|
||||
}
|
||||
|
||||
return $json;
|
||||
}, $params)) . ']';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $wrapperClass
|
||||
*
|
||||
* @return \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
public static function invalidWrapperClass($wrapperClass)
|
||||
{
|
||||
return new self("The given 'wrapperClass' ".$wrapperClass." has to be a ".
|
||||
"subtype of \Doctrine\DBAL\Connection.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $driverClass
|
||||
*
|
||||
* @return \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
public static function invalidDriverClass($driverClass)
|
||||
{
|
||||
return new self("The given 'driverClass' ".$driverClass." has to implement the ".
|
||||
"\Doctrine\DBAL\Driver interface.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $tableName
|
||||
*
|
||||
* @return \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
public static function invalidTableName($tableName)
|
||||
{
|
||||
return new self("Invalid table name specified: ".$tableName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $tableName
|
||||
*
|
||||
* @return \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
public static function noColumnsSpecifiedForTable($tableName)
|
||||
{
|
||||
return new self("No columns specified for table ".$tableName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
public static function limitOffsetInvalid()
|
||||
{
|
||||
return new self("Invalid Offset in Limit Query, it has to be larger or equal to 0.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*
|
||||
* @return \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
public static function typeExists($name)
|
||||
{
|
||||
return new self('Type '.$name.' already exists.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*
|
||||
* @return \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
public static function unknownColumnType($name)
|
||||
{
|
||||
return new self('Unknown column type "'.$name.'" requested. Any Doctrine type that you use has ' .
|
||||
'to be registered with \Doctrine\DBAL\Types\Type::addType(). You can get a list of all the ' .
|
||||
'known types with \Doctrine\DBAL\Types\Type::getTypesMap(). If this error occurs during database ' .
|
||||
'introspection then you might have forgot to register all database types for a Doctrine Type. Use ' .
|
||||
'AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement ' .
|
||||
'Type#getMappedDatabaseTypes(). If the type name is empty you might ' .
|
||||
'have a problem with the cache or forgot some mapping information.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*
|
||||
* @return \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
public static function typeNotFound($name)
|
||||
{
|
||||
return new self('Type to be overwritten '.$name.' does not exist.');
|
||||
}
|
||||
}
|
||||
75
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver.php
vendored
Normal file
75
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver.php
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL;
|
||||
|
||||
/**
|
||||
* Driver interface.
|
||||
* Interface that all DBAL drivers must implement.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
interface Driver
|
||||
{
|
||||
/**
|
||||
* Attempts to create a connection with the database.
|
||||
*
|
||||
* @param array $params All connection parameters passed by the user.
|
||||
* @param string|null $username The username to use when connecting.
|
||||
* @param string|null $password The password to use when connecting.
|
||||
* @param array $driverOptions The driver options to use when connecting.
|
||||
*
|
||||
* @return \Doctrine\DBAL\Driver\Connection The database connection.
|
||||
*/
|
||||
public function connect(array $params, $username = null, $password = null, array $driverOptions = array());
|
||||
|
||||
/**
|
||||
* Gets the DatabasePlatform instance that provides all the metadata about
|
||||
* the platform this driver connects to.
|
||||
*
|
||||
* @return \Doctrine\DBAL\Platforms\AbstractPlatform The database platform.
|
||||
*/
|
||||
public function getDatabasePlatform();
|
||||
|
||||
/**
|
||||
* Gets the SchemaManager that can be used to inspect and change the underlying
|
||||
* database schema of the platform this driver connects to.
|
||||
*
|
||||
* @param \Doctrine\DBAL\Connection $conn
|
||||
*
|
||||
* @return \Doctrine\DBAL\Schema\AbstractSchemaManager
|
||||
*/
|
||||
public function getSchemaManager(Connection $conn);
|
||||
|
||||
/**
|
||||
* Gets the name of the driver.
|
||||
*
|
||||
* @return string The name of the driver.
|
||||
*/
|
||||
public function getName();
|
||||
|
||||
/**
|
||||
* Gets the name of the database connected to for this driver.
|
||||
*
|
||||
* @param \Doctrine\DBAL\Connection $conn
|
||||
*
|
||||
* @return string The name of the database.
|
||||
*/
|
||||
public function getDatabase(Connection $conn);
|
||||
}
|
||||
110
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Connection.php
vendored
Normal file
110
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Connection.php
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver;
|
||||
|
||||
/**
|
||||
* Connection interface.
|
||||
* Driver connections must implement this interface.
|
||||
*
|
||||
* This resembles (a subset of) the PDO interface.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
interface Connection
|
||||
{
|
||||
/**
|
||||
* Prepares a statement for execution and returns a Statement object.
|
||||
*
|
||||
* @param string $prepareString
|
||||
*
|
||||
* @return \Doctrine\DBAL\Driver\Statement
|
||||
*/
|
||||
function prepare($prepareString);
|
||||
|
||||
/**
|
||||
* Executes an SQL statement, returning a result set as a Statement object.
|
||||
*
|
||||
* @return \Doctrine\DBAL\Driver\Statement
|
||||
*/
|
||||
function query();
|
||||
|
||||
/**
|
||||
* Quotes a string for use in a query.
|
||||
*
|
||||
* @param string $input
|
||||
* @param integer $type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function quote($input, $type=\PDO::PARAM_STR);
|
||||
|
||||
/**
|
||||
* Executes an SQL statement and return the number of affected rows.
|
||||
*
|
||||
* @param string $statement
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
function exec($statement);
|
||||
|
||||
/**
|
||||
* Returns the ID of the last inserted row or sequence value.
|
||||
*
|
||||
* @param string|null $name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function lastInsertId($name = null);
|
||||
|
||||
/**
|
||||
* Initiates a transaction.
|
||||
*
|
||||
* @return boolean TRUE on success or FALSE on failure.
|
||||
*/
|
||||
function beginTransaction();
|
||||
|
||||
/**
|
||||
* Commits a transaction.
|
||||
*
|
||||
* @return boolean TRUE on success or FALSE on failure.
|
||||
*/
|
||||
function commit();
|
||||
|
||||
/**
|
||||
* Rolls back the current transaction, as initiated by beginTransaction().
|
||||
*
|
||||
* @return boolean TRUE on success or FALSE on failure.
|
||||
*/
|
||||
function rollBack();
|
||||
|
||||
/**
|
||||
* Returns the error code associated with the last operation on the database handle.
|
||||
*
|
||||
* @return string|null The error code, or null if no operation has been run on the database handle.
|
||||
*/
|
||||
function errorCode();
|
||||
|
||||
/**
|
||||
* Returns extended error information associated with the last operation on the database handle.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function errorInfo();
|
||||
}
|
||||
41
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/DrizzlePDOMySql/Connection.php
vendored
Normal file
41
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/DrizzlePDOMySql/Connection.php
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\DrizzlePDOMySql;
|
||||
|
||||
/**
|
||||
* @author Kim Hemsø Rasmussen <kimhemsoe@gmail.com>
|
||||
*/
|
||||
class Connection extends \Doctrine\DBAL\Driver\PDOConnection
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function quote($value, $type=\PDO::PARAM_STR)
|
||||
{
|
||||
if (\PDO::PARAM_BOOL === $type) {
|
||||
if ($value) {
|
||||
return 'true';
|
||||
} else {
|
||||
return 'false';
|
||||
}
|
||||
}
|
||||
return parent::quote($value, $type);
|
||||
}
|
||||
}
|
||||
102
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/DrizzlePDOMySql/Driver.php
vendored
Normal file
102
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/DrizzlePDOMySql/Driver.php
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\DrizzlePDOMySql;
|
||||
|
||||
/**
|
||||
* Drizzle driver using PDO MySql.
|
||||
*
|
||||
* @author Kim Hemsø Rasmussen <kimhemsoe@gmail.com>
|
||||
*/
|
||||
class Driver implements \Doctrine\DBAL\Driver
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
|
||||
{
|
||||
$conn = new Connection(
|
||||
$this->_constructPdoDsn($params),
|
||||
$username,
|
||||
$password,
|
||||
$driverOptions
|
||||
);
|
||||
return $conn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the Drizzle MySql PDO DSN.
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return string The DSN.
|
||||
*/
|
||||
private function _constructPdoDsn(array $params)
|
||||
{
|
||||
$dsn = 'mysql:';
|
||||
if (isset($params['host']) && $params['host'] != '') {
|
||||
$dsn .= 'host=' . $params['host'] . ';';
|
||||
}
|
||||
if (isset($params['port'])) {
|
||||
$dsn .= 'port=' . $params['port'] . ';';
|
||||
}
|
||||
if (isset($params['dbname'])) {
|
||||
$dsn .= 'dbname=' . $params['dbname'] . ';';
|
||||
}
|
||||
if (isset($params['unix_socket'])) {
|
||||
$dsn .= 'unix_socket=' . $params['unix_socket'] . ';';
|
||||
}
|
||||
|
||||
return $dsn;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabasePlatform()
|
||||
{
|
||||
return new \Doctrine\DBAL\Platforms\DrizzlePlatform();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
return new \Doctrine\DBAL\Schema\DrizzleSchemaManager($conn);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'drizzle_pdo_mysql';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabase(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
$params = $conn->getParams();
|
||||
|
||||
return $params['dbname'];
|
||||
}
|
||||
}
|
||||
154
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php
vendored
Normal file
154
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\IBMDB2;
|
||||
|
||||
class DB2Connection implements \Doctrine\DBAL\Driver\Connection
|
||||
{
|
||||
/**
|
||||
* @var resource
|
||||
*/
|
||||
private $_conn = null;
|
||||
|
||||
/**
|
||||
* @param array $params
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param array $driverOptions
|
||||
*
|
||||
* @throws \Doctrine\DBAL\Driver\IBMDB2\DB2Exception
|
||||
*/
|
||||
public function __construct(array $params, $username, $password, $driverOptions = array())
|
||||
{
|
||||
$isPersistant = (isset($params['persistent']) && $params['persistent'] == true);
|
||||
|
||||
if ($isPersistant) {
|
||||
$this->_conn = db2_pconnect($params['dbname'], $username, $password, $driverOptions);
|
||||
} else {
|
||||
$this->_conn = db2_connect($params['dbname'], $username, $password, $driverOptions);
|
||||
}
|
||||
if ( ! $this->_conn) {
|
||||
throw new DB2Exception(db2_conn_errormsg());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function prepare($sql)
|
||||
{
|
||||
$stmt = @db2_prepare($this->_conn, $sql);
|
||||
if ( ! $stmt) {
|
||||
throw new DB2Exception(db2_stmt_errormsg());
|
||||
}
|
||||
return new DB2Statement($stmt);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$sql = $args[0];
|
||||
$stmt = $this->prepare($sql);
|
||||
$stmt->execute();
|
||||
return $stmt;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function quote($input, $type=\PDO::PARAM_STR)
|
||||
{
|
||||
$input = db2_escape_string($input);
|
||||
if ($type == \PDO::PARAM_INT ) {
|
||||
return $input;
|
||||
} else {
|
||||
return "'".$input."'";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function exec($statement)
|
||||
{
|
||||
$stmt = $this->prepare($statement);
|
||||
$stmt->execute();
|
||||
return $stmt->rowCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function lastInsertId($name = null)
|
||||
{
|
||||
return db2_last_insert_id($this->_conn);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function beginTransaction()
|
||||
{
|
||||
db2_autocommit($this->_conn, DB2_AUTOCOMMIT_OFF);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function commit()
|
||||
{
|
||||
if (!db2_commit($this->_conn)) {
|
||||
throw new DB2Exception(db2_conn_errormsg($this->_conn));
|
||||
}
|
||||
db2_autocommit($this->_conn, DB2_AUTOCOMMIT_ON);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rollBack()
|
||||
{
|
||||
if (!db2_rollback($this->_conn)) {
|
||||
throw new DB2Exception(db2_conn_errormsg($this->_conn));
|
||||
}
|
||||
db2_autocommit($this->_conn, DB2_AUTOCOMMIT_ON);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function errorCode()
|
||||
{
|
||||
return db2_conn_error($this->_conn);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function errorInfo()
|
||||
{
|
||||
return array(
|
||||
0 => db2_conn_errormsg($this->_conn),
|
||||
1 => $this->errorCode(),
|
||||
);
|
||||
}
|
||||
}
|
||||
94
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Driver.php
vendored
Normal file
94
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Driver.php
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\IBMDB2;
|
||||
|
||||
use Doctrine\DBAL\Driver;
|
||||
use Doctrine\DBAL\Connection;
|
||||
|
||||
/**
|
||||
* IBM DB2 Driver.
|
||||
*
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class DB2Driver implements Driver
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
|
||||
{
|
||||
if ( ! isset($params['protocol'])) {
|
||||
$params['protocol'] = 'TCPIP';
|
||||
}
|
||||
|
||||
if ($params['host'] !== 'localhost' && $params['host'] != '127.0.0.1') {
|
||||
// if the host isn't localhost, use extended connection params
|
||||
$params['dbname'] = 'DRIVER={IBM DB2 ODBC DRIVER}' .
|
||||
';DATABASE=' . $params['dbname'] .
|
||||
';HOSTNAME=' . $params['host'] .
|
||||
';PROTOCOL=' . $params['protocol'] .
|
||||
';UID=' . $username .
|
||||
';PWD=' . $password .';';
|
||||
if (isset($params['port'])) {
|
||||
$params['dbname'] .= 'PORT=' . $params['port'];
|
||||
}
|
||||
|
||||
$username = null;
|
||||
$password = null;
|
||||
}
|
||||
|
||||
return new DB2Connection($params, $username, $password, $driverOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabasePlatform()
|
||||
{
|
||||
return new \Doctrine\DBAL\Platforms\DB2Platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSchemaManager(Connection $conn)
|
||||
{
|
||||
return new \Doctrine\DBAL\Schema\DB2SchemaManager($conn);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'ibm_db2';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabase(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
$params = $conn->getParams();
|
||||
|
||||
return $params['dbname'];
|
||||
}
|
||||
}
|
||||
24
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Exception.php
vendored
Normal file
24
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Exception.php
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\IBMDB2;
|
||||
|
||||
class DB2Exception extends \Exception
|
||||
{
|
||||
}
|
||||
234
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php
vendored
Normal file
234
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php
vendored
Normal file
@@ -0,0 +1,234 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\IBMDB2;
|
||||
|
||||
use \Doctrine\DBAL\Driver\Statement;
|
||||
|
||||
class DB2Statement implements \IteratorAggregate, Statement
|
||||
{
|
||||
/**
|
||||
* @var resource
|
||||
*/
|
||||
private $_stmt = null;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $_bindParam = array();
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
private $_defaultFetchMode = \PDO::FETCH_BOTH;
|
||||
|
||||
/**
|
||||
* DB2_BINARY, DB2_CHAR, DB2_DOUBLE, or DB2_LONG
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
static private $_typeMap = array(
|
||||
\PDO::PARAM_INT => DB2_LONG,
|
||||
\PDO::PARAM_STR => DB2_CHAR,
|
||||
);
|
||||
|
||||
/**
|
||||
* @param resource $stmt
|
||||
*/
|
||||
public function __construct($stmt)
|
||||
{
|
||||
$this->_stmt = $stmt;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function bindValue($param, $value, $type = null)
|
||||
{
|
||||
return $this->bindParam($param, $value, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function bindParam($column, &$variable, $type = null, $length = null)
|
||||
{
|
||||
$this->_bindParam[$column] =& $variable;
|
||||
|
||||
if ($type && isset(self::$_typeMap[$type])) {
|
||||
$type = self::$_typeMap[$type];
|
||||
} else {
|
||||
$type = DB2_CHAR;
|
||||
}
|
||||
|
||||
if (!db2_bind_param($this->_stmt, $column, "variable", DB2_PARAM_IN, $type)) {
|
||||
throw new DB2Exception(db2_stmt_errormsg());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function closeCursor()
|
||||
{
|
||||
if ( ! $this->_stmt) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->_bindParam = array();
|
||||
db2_free_result($this->_stmt);
|
||||
$ret = db2_free_stmt($this->_stmt);
|
||||
$this->_stmt = false;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function columnCount()
|
||||
{
|
||||
if ( ! $this->_stmt) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return db2_num_fields($this->_stmt);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function errorCode()
|
||||
{
|
||||
return db2_stmt_error();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function errorInfo()
|
||||
{
|
||||
return array(
|
||||
0 => db2_stmt_errormsg(),
|
||||
1 => db2_stmt_error(),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function execute($params = null)
|
||||
{
|
||||
if ( ! $this->_stmt) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*$retval = true;
|
||||
if ($params !== null) {
|
||||
$retval = @db2_execute($this->_stmt, $params);
|
||||
} else {
|
||||
$retval = @db2_execute($this->_stmt);
|
||||
}*/
|
||||
if ($params === null) {
|
||||
ksort($this->_bindParam);
|
||||
$params = array_values($this->_bindParam);
|
||||
}
|
||||
$retval = @db2_execute($this->_stmt, $params);
|
||||
|
||||
if ($retval === false) {
|
||||
throw new DB2Exception(db2_stmt_errormsg());
|
||||
}
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null)
|
||||
{
|
||||
$this->_defaultFetchMode = $fetchMode;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
$data = $this->fetchAll();
|
||||
|
||||
return new \ArrayIterator($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetch($fetchMode = null)
|
||||
{
|
||||
$fetchMode = $fetchMode ?: $this->_defaultFetchMode;
|
||||
switch ($fetchMode) {
|
||||
case \PDO::FETCH_BOTH:
|
||||
return db2_fetch_both($this->_stmt);
|
||||
case \PDO::FETCH_ASSOC:
|
||||
return db2_fetch_assoc($this->_stmt);
|
||||
case \PDO::FETCH_NUM:
|
||||
return db2_fetch_array($this->_stmt);
|
||||
default:
|
||||
throw new DB2Exception("Given Fetch-Style " . $fetchMode . " is not supported.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchAll($fetchMode = null)
|
||||
{
|
||||
$rows = array();
|
||||
while ($row = $this->fetch($fetchMode)) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchColumn($columnIndex = 0)
|
||||
{
|
||||
$row = $this->fetch(\PDO::FETCH_NUM);
|
||||
if ($row && isset($row[$columnIndex])) {
|
||||
return $row[$columnIndex];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rowCount()
|
||||
{
|
||||
return (@db2_num_rows($this->_stmt))?:0;
|
||||
}
|
||||
}
|
||||
70
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Driver.php
vendored
Normal file
70
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Driver.php
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\Mysqli;
|
||||
|
||||
use Doctrine\DBAL\Driver as DriverInterface;
|
||||
|
||||
/**
|
||||
* @author Kim Hemsø Rasmussen <kimhemsoe@gmail.com>
|
||||
*/
|
||||
class Driver implements DriverInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
|
||||
{
|
||||
return new MysqliConnection($params, $username, $password, $driverOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'mysqli';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
return new \Doctrine\DBAL\Schema\MySqlSchemaManager($conn);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabasePlatform()
|
||||
{
|
||||
return new \Doctrine\DBAL\Platforms\MySqlPlatform();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabase(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
$params = $conn->getParams();
|
||||
|
||||
return $params['dbname'];
|
||||
}
|
||||
}
|
||||
154
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php
vendored
Normal file
154
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\Mysqli;
|
||||
|
||||
use Doctrine\DBAL\Driver\Connection as Connection;
|
||||
|
||||
/**
|
||||
* @author Kim Hemsø Rasmussen <kimhemsoe@gmail.com>
|
||||
*/
|
||||
class MysqliConnection implements Connection
|
||||
{
|
||||
/**
|
||||
* @var \mysqli
|
||||
*/
|
||||
private $_conn;
|
||||
|
||||
/**
|
||||
* @param array $params
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param array $driverOptions
|
||||
*
|
||||
* @throws \Doctrine\DBAL\Driver\Mysqli\MysqliException
|
||||
*/
|
||||
public function __construct(array $params, $username, $password, array $driverOptions = array())
|
||||
{
|
||||
$port = isset($params['port']) ? $params['port'] : ini_get('mysqli.default_port');
|
||||
$socket = isset($params['unix_socket']) ? $params['unix_socket'] : ini_get('mysqli.default_socket');
|
||||
|
||||
$this->_conn = mysqli_init();
|
||||
if ( ! $this->_conn->real_connect($params['host'], $username, $password, $params['dbname'], $port, $socket)) {
|
||||
throw new MysqliException($this->_conn->connect_error, $this->_conn->connect_errno);
|
||||
}
|
||||
|
||||
if (isset($params['charset'])) {
|
||||
$this->_conn->set_charset($params['charset']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves mysqli native resource handle.
|
||||
*
|
||||
* Could be used if part of your application is not using DBAL.
|
||||
*
|
||||
* @return \mysqli
|
||||
*/
|
||||
public function getWrappedResourceHandle()
|
||||
{
|
||||
return $this->_conn;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function prepare($prepareString)
|
||||
{
|
||||
return new MysqliStatement($this->_conn, $prepareString);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$sql = $args[0];
|
||||
$stmt = $this->prepare($sql);
|
||||
$stmt->execute();
|
||||
return $stmt;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function quote($input, $type=\PDO::PARAM_STR)
|
||||
{
|
||||
return "'". $this->_conn->escape_string($input) ."'";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function exec($statement)
|
||||
{
|
||||
$this->_conn->query($statement);
|
||||
return $this->_conn->affected_rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function lastInsertId($name = null)
|
||||
{
|
||||
return $this->_conn->insert_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function beginTransaction()
|
||||
{
|
||||
$this->_conn->query('START TRANSACTION');
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function commit()
|
||||
{
|
||||
return $this->_conn->commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}non-PHPdoc)
|
||||
*/
|
||||
public function rollBack()
|
||||
{
|
||||
return $this->_conn->rollback();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function errorCode()
|
||||
{
|
||||
return $this->_conn->errno;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function errorInfo()
|
||||
{
|
||||
return $this->_conn->error;
|
||||
}
|
||||
}
|
||||
27
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliException.php
vendored
Normal file
27
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliException.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\Mysqli;
|
||||
|
||||
/**
|
||||
* @author Kim Hemsø Rasmussen <kimhemsoe@gmail.com>
|
||||
*/
|
||||
class MysqliException extends \Exception
|
||||
{
|
||||
}
|
||||
372
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php
vendored
Normal file
372
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php
vendored
Normal file
@@ -0,0 +1,372 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\Mysqli;
|
||||
|
||||
use Doctrine\DBAL\Driver\Statement;
|
||||
use PDO;
|
||||
|
||||
/**
|
||||
* @author Kim Hemsø Rasmussen <kimhemsoe@gmail.com>
|
||||
*/
|
||||
class MysqliStatement implements \IteratorAggregate, Statement
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $_paramTypeMap = array(
|
||||
PDO::PARAM_STR => 's',
|
||||
PDO::PARAM_BOOL => 'i',
|
||||
PDO::PARAM_NULL => 's',
|
||||
PDO::PARAM_INT => 'i',
|
||||
PDO::PARAM_LOB => 's' // TODO Support LOB bigger then max package size.
|
||||
);
|
||||
|
||||
/**
|
||||
* @var \mysqli
|
||||
*/
|
||||
protected $_conn;
|
||||
|
||||
/**
|
||||
* @var \mysqli_stmt
|
||||
*/
|
||||
protected $_stmt;
|
||||
|
||||
/**
|
||||
* @var null|boolean|array
|
||||
*/
|
||||
protected $_columnNames;
|
||||
|
||||
/**
|
||||
* @var null|array
|
||||
*/
|
||||
protected $_rowBindedValues;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_bindedValues;
|
||||
|
||||
/**
|
||||
* Contains ref values for bindValue().
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_values = array();
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
protected $_defaultFetchMode = PDO::FETCH_BOTH;
|
||||
|
||||
/**
|
||||
* @param \mysqli $conn
|
||||
* @param string $prepareString
|
||||
*
|
||||
* @throws \Doctrine\DBAL\Driver\Mysqli\MysqliException
|
||||
*/
|
||||
public function __construct(\mysqli $conn, $prepareString)
|
||||
{
|
||||
$this->_conn = $conn;
|
||||
$this->_stmt = $conn->prepare($prepareString);
|
||||
if (false === $this->_stmt) {
|
||||
throw new MysqliException($this->_conn->error, $this->_conn->errno);
|
||||
}
|
||||
|
||||
$paramCount = $this->_stmt->param_count;
|
||||
if (0 < $paramCount) {
|
||||
// Index 0 is types
|
||||
// Need to init the string else php think we are trying to access it as a array.
|
||||
$bindedValues = array(0 => str_repeat('s', $paramCount));
|
||||
$null = null;
|
||||
for ($i = 1; $i < $paramCount; $i++) {
|
||||
$bindedValues[] =& $null;
|
||||
}
|
||||
$this->_bindedValues = $bindedValues;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function bindParam($column, &$variable, $type = null, $length = null)
|
||||
{
|
||||
if (null === $type) {
|
||||
$type = 's';
|
||||
} else {
|
||||
if (isset(self::$_paramTypeMap[$type])) {
|
||||
$type = self::$_paramTypeMap[$type];
|
||||
} else {
|
||||
throw new MysqliException("Unknown type: '{$type}'");
|
||||
}
|
||||
}
|
||||
|
||||
$this->_bindedValues[$column] =& $variable;
|
||||
$this->_bindedValues[0][$column - 1] = $type;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function bindValue($param, $value, $type = null)
|
||||
{
|
||||
if (null === $type) {
|
||||
$type = 's';
|
||||
} else {
|
||||
if (isset(self::$_paramTypeMap[$type])) {
|
||||
$type = self::$_paramTypeMap[$type];
|
||||
} else {
|
||||
throw new MysqliException("Unknown type: '{$type}'");
|
||||
}
|
||||
}
|
||||
|
||||
$this->_values[$param] = $value;
|
||||
$this->_bindedValues[$param] =& $this->_values[$param];
|
||||
$this->_bindedValues[0][$param - 1] = $type;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function execute($params = null)
|
||||
{
|
||||
if (null !== $this->_bindedValues) {
|
||||
if (null !== $params) {
|
||||
if ( ! $this->_bindValues($params)) {
|
||||
throw new MysqliException($this->_stmt->error, $this->_stmt->errno);
|
||||
}
|
||||
} else {
|
||||
if (!call_user_func_array(array($this->_stmt, 'bind_param'), $this->_bindedValues)) {
|
||||
throw new MysqliException($this->_stmt->error, $this->_stmt->errno);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $this->_stmt->execute()) {
|
||||
throw new MysqliException($this->_stmt->error, $this->_stmt->errno);
|
||||
}
|
||||
|
||||
if (null === $this->_columnNames) {
|
||||
$meta = $this->_stmt->result_metadata();
|
||||
if (false !== $meta) {
|
||||
$columnNames = array();
|
||||
foreach ($meta->fetch_fields() as $col) {
|
||||
$columnNames[] = $col->name;
|
||||
}
|
||||
$meta->free();
|
||||
|
||||
$this->_columnNames = $columnNames;
|
||||
$this->_rowBindedValues = array_fill(0, count($columnNames), NULL);
|
||||
|
||||
$refs = array();
|
||||
foreach ($this->_rowBindedValues as $key => &$value) {
|
||||
$refs[$key] =& $value;
|
||||
}
|
||||
|
||||
if (!call_user_func_array(array($this->_stmt, 'bind_result'), $refs)) {
|
||||
throw new MysqliException($this->_stmt->error, $this->_stmt->errno);
|
||||
}
|
||||
} else {
|
||||
$this->_columnNames = false;
|
||||
}
|
||||
}
|
||||
|
||||
// We have a result.
|
||||
if (false !== $this->_columnNames) {
|
||||
$this->_stmt->store_result();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Binds a array of values to bound parameters.
|
||||
*
|
||||
* @param array $values
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
private function _bindValues($values)
|
||||
{
|
||||
$params = array();
|
||||
$types = str_repeat('s', count($values));
|
||||
$params[0] = $types;
|
||||
|
||||
foreach ($values as &$v) {
|
||||
$params[] =& $v;
|
||||
}
|
||||
|
||||
return call_user_func_array(array($this->_stmt, 'bind_param'), $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean|array
|
||||
*/
|
||||
private function _fetch()
|
||||
{
|
||||
$ret = $this->_stmt->fetch();
|
||||
|
||||
if (true === $ret) {
|
||||
$values = array();
|
||||
foreach ($this->_rowBindedValues as $v) {
|
||||
// Mysqli converts them to a scalar type it can fit in.
|
||||
$values[] = null === $v ? null : (string)$v;
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetch($fetchMode = null)
|
||||
{
|
||||
$values = $this->_fetch();
|
||||
if (null === $values) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (false === $values) {
|
||||
throw new MysqliException($this->_stmt->error, $this->_stmt->errno);
|
||||
}
|
||||
|
||||
$fetchMode = $fetchMode ?: $this->_defaultFetchMode;
|
||||
|
||||
switch ($fetchMode) {
|
||||
case PDO::FETCH_NUM:
|
||||
return $values;
|
||||
|
||||
case PDO::FETCH_ASSOC:
|
||||
return array_combine($this->_columnNames, $values);
|
||||
|
||||
case PDO::FETCH_BOTH:
|
||||
$ret = array_combine($this->_columnNames, $values);
|
||||
$ret += $values;
|
||||
return $ret;
|
||||
|
||||
default:
|
||||
throw new MysqliException("Unknown fetch type '{$fetchMode}'");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchAll($fetchMode = null)
|
||||
{
|
||||
$fetchMode = $fetchMode ?: $this->_defaultFetchMode;
|
||||
|
||||
$rows = array();
|
||||
if (PDO::FETCH_COLUMN == $fetchMode) {
|
||||
while (($row = $this->fetchColumn()) !== false) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
} else {
|
||||
while (($row = $this->fetch($fetchMode)) !== null) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchColumn($columnIndex = 0)
|
||||
{
|
||||
$row = $this->fetch(PDO::FETCH_NUM);
|
||||
if (null === $row) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $row[$columnIndex];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function errorCode()
|
||||
{
|
||||
return $this->_stmt->errno;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function errorInfo()
|
||||
{
|
||||
return $this->_stmt->error;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function closeCursor()
|
||||
{
|
||||
$this->_stmt->free_result();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rowCount()
|
||||
{
|
||||
if (false === $this->_columnNames) {
|
||||
return $this->_stmt->affected_rows;
|
||||
}
|
||||
return $this->_stmt->num_rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function columnCount()
|
||||
{
|
||||
return $this->_stmt->field_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null)
|
||||
{
|
||||
$this->_defaultFetchMode = $fetchMode;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
$data = $this->fetchAll();
|
||||
|
||||
return new \ArrayIterator($data);
|
||||
}
|
||||
}
|
||||
116
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/Driver.php
vendored
Normal file
116
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/Driver.php
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\OCI8;
|
||||
|
||||
use Doctrine\DBAL\Platforms;
|
||||
|
||||
/**
|
||||
* A Doctrine DBAL driver for the Oracle OCI8 PHP extensions.
|
||||
*
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @since 2.0
|
||||
*/
|
||||
class Driver implements \Doctrine\DBAL\Driver
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
|
||||
{
|
||||
return new OCI8Connection(
|
||||
$username,
|
||||
$password,
|
||||
$this->_constructDsn($params),
|
||||
isset($params['charset']) ? $params['charset'] : null,
|
||||
isset($params['sessionMode']) ? $params['sessionMode'] : OCI_DEFAULT,
|
||||
isset($params['persistent']) ? $params['persistent'] : false
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the Oracle DSN.
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return string The DSN.
|
||||
*/
|
||||
protected function _constructDsn(array $params)
|
||||
{
|
||||
$dsn = '';
|
||||
if (isset($params['host']) && $params['host'] != '') {
|
||||
$dsn .= '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)' .
|
||||
'(HOST=' . $params['host'] . ')';
|
||||
|
||||
if (isset($params['port'])) {
|
||||
$dsn .= '(PORT=' . $params['port'] . ')';
|
||||
} else {
|
||||
$dsn .= '(PORT=1521)';
|
||||
}
|
||||
|
||||
if (isset($params['service']) && $params['service'] == true) {
|
||||
$dsn .= '))(CONNECT_DATA=(SERVICE_NAME=' . $params['dbname'] . '))';
|
||||
} else {
|
||||
$dsn .= '))(CONNECT_DATA=(SID=' . $params['dbname'] . '))';
|
||||
}
|
||||
if (isset($params['pooled']) && $params['pooled'] == true) {
|
||||
$dsn .= '(SERVER=POOLED)';
|
||||
}
|
||||
$dsn .= ')';
|
||||
} else {
|
||||
$dsn .= $params['dbname'];
|
||||
}
|
||||
|
||||
return $dsn;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabasePlatform()
|
||||
{
|
||||
return new \Doctrine\DBAL\Platforms\OraclePlatform();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
return new \Doctrine\DBAL\Schema\OracleSchemaManager($conn);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'oci8';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabase(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
$params = $conn->getParams();
|
||||
|
||||
return $params['user'];
|
||||
}
|
||||
}
|
||||
202
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php
vendored
Normal file
202
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\OCI8;
|
||||
|
||||
use Doctrine\DBAL\Platforms\OraclePlatform;
|
||||
|
||||
/**
|
||||
* OCI8 implementation of the Connection interface.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
class OCI8Connection implements \Doctrine\DBAL\Driver\Connection
|
||||
{
|
||||
/**
|
||||
* @var resource
|
||||
*/
|
||||
protected $dbh;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
protected $executeMode = OCI_COMMIT_ON_SUCCESS;
|
||||
|
||||
/**
|
||||
* Creates a Connection to an Oracle Database using oci8 extension.
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @param string $db
|
||||
* @param string|null $charset
|
||||
* @param integer $sessionMode
|
||||
* @param boolean $persistent
|
||||
*
|
||||
* @throws OCI8Exception
|
||||
*/
|
||||
public function __construct($username, $password, $db, $charset = null, $sessionMode = OCI_DEFAULT, $persistent = false)
|
||||
{
|
||||
if (!defined('OCI_NO_AUTO_COMMIT')) {
|
||||
define('OCI_NO_AUTO_COMMIT', 0);
|
||||
}
|
||||
|
||||
$this->dbh = $persistent
|
||||
? @oci_pconnect($username, $password, $db, $charset, $sessionMode)
|
||||
: @oci_connect($username, $password, $db, $charset, $sessionMode);
|
||||
|
||||
if ( ! $this->dbh) {
|
||||
throw OCI8Exception::fromErrorInfo(oci_error());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function prepare($prepareString)
|
||||
{
|
||||
return new OCI8Statement($this->dbh, $prepareString, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$sql = $args[0];
|
||||
//$fetchMode = $args[1];
|
||||
$stmt = $this->prepare($sql);
|
||||
$stmt->execute();
|
||||
|
||||
return $stmt;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function quote($value, $type=\PDO::PARAM_STR)
|
||||
{
|
||||
if (is_int($value) || is_float($value)) {
|
||||
return $value;
|
||||
}
|
||||
$value = str_replace("'", "''", $value);
|
||||
|
||||
return "'" . addcslashes($value, "\000\n\r\\\032") . "'";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function exec($statement)
|
||||
{
|
||||
$stmt = $this->prepare($statement);
|
||||
$stmt->execute();
|
||||
|
||||
return $stmt->rowCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function lastInsertId($name = null)
|
||||
{
|
||||
if ($name === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
OraclePlatform::assertValidIdentifier($name);
|
||||
|
||||
$sql = 'SELECT ' . $name . '.CURRVAL FROM DUAL';
|
||||
$stmt = $this->query($sql);
|
||||
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
|
||||
if ($result === false || !isset($result['CURRVAL'])) {
|
||||
throw new OCI8Exception("lastInsertId failed: Query was executed but no result was returned.");
|
||||
}
|
||||
|
||||
return (int) $result['CURRVAL'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current execution mode.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getExecuteMode()
|
||||
{
|
||||
return $this->executeMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function beginTransaction()
|
||||
{
|
||||
$this->executeMode = OCI_NO_AUTO_COMMIT;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function commit()
|
||||
{
|
||||
if (!oci_commit($this->dbh)) {
|
||||
throw OCI8Exception::fromErrorInfo($this->errorInfo());
|
||||
}
|
||||
$this->executeMode = OCI_COMMIT_ON_SUCCESS;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rollBack()
|
||||
{
|
||||
if (!oci_rollback($this->dbh)) {
|
||||
throw OCI8Exception::fromErrorInfo($this->errorInfo());
|
||||
}
|
||||
$this->executeMode = OCI_COMMIT_ON_SUCCESS;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function errorCode()
|
||||
{
|
||||
$error = oci_error($this->dbh);
|
||||
if ($error !== false) {
|
||||
$error = $error['code'];
|
||||
}
|
||||
|
||||
return $error;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function errorInfo()
|
||||
{
|
||||
return oci_error($this->dbh);
|
||||
}
|
||||
}
|
||||
33
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Exception.php
vendored
Normal file
33
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Exception.php
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\OCI8;
|
||||
|
||||
class OCI8Exception extends \Exception
|
||||
{
|
||||
/**
|
||||
* @param array $error
|
||||
*
|
||||
* @return \Doctrine\DBAL\Driver\OCI8\OCI8Exception
|
||||
*/
|
||||
static public function fromErrorInfo($error)
|
||||
{
|
||||
return new self($error['message'], $error['code']);
|
||||
}
|
||||
}
|
||||
303
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
vendored
Normal file
303
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
vendored
Normal file
@@ -0,0 +1,303 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\OCI8;
|
||||
|
||||
use PDO;
|
||||
use IteratorAggregate;
|
||||
use Doctrine\DBAL\Driver\Statement;
|
||||
|
||||
/**
|
||||
* The OCI8 implementation of the Statement interface.
|
||||
*
|
||||
* @since 2.0
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class OCI8Statement implements \IteratorAggregate, Statement
|
||||
{
|
||||
/**
|
||||
* @var resource
|
||||
*/
|
||||
protected $_dbh;
|
||||
|
||||
/**
|
||||
* @var resource
|
||||
*/
|
||||
protected $_sth;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Driver\OCI8\OCI8Connection
|
||||
*/
|
||||
protected $_conn;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected static $_PARAM = ':param';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $fetchModeMap = array(
|
||||
PDO::FETCH_BOTH => OCI_BOTH,
|
||||
PDO::FETCH_ASSOC => OCI_ASSOC,
|
||||
PDO::FETCH_NUM => OCI_NUM,
|
||||
PDO::PARAM_LOB => OCI_B_BLOB,
|
||||
PDO::FETCH_COLUMN => OCI_NUM,
|
||||
);
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
protected $_defaultFetchMode = PDO::FETCH_BOTH;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_paramMap = array();
|
||||
|
||||
/**
|
||||
* Creates a new OCI8Statement that uses the given connection handle and SQL statement.
|
||||
*
|
||||
* @param resource $dbh The connection handle.
|
||||
* @param string $statement The SQL statement.
|
||||
* @param \Doctrine\DBAL\Driver\OCI8\OCI8Connection $conn
|
||||
*/
|
||||
public function __construct($dbh, $statement, OCI8Connection $conn)
|
||||
{
|
||||
list($statement, $paramMap) = self::convertPositionalToNamedPlaceholders($statement);
|
||||
$this->_sth = oci_parse($dbh, $statement);
|
||||
$this->_dbh = $dbh;
|
||||
$this->_paramMap = $paramMap;
|
||||
$this->_conn = $conn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts positional (?) into named placeholders (:param<num>).
|
||||
*
|
||||
* Oracle does not support positional parameters, hence this method converts all
|
||||
* positional parameters into artificially named parameters. Note that this conversion
|
||||
* is not perfect. All question marks (?) in the original statement are treated as
|
||||
* placeholders and converted to a named parameter.
|
||||
*
|
||||
* The algorithm uses a state machine with two possible states: InLiteral and NotInLiteral.
|
||||
* Question marks inside literal strings are therefore handled correctly by this method.
|
||||
* This comes at a cost, the whole sql statement has to be looped over.
|
||||
*
|
||||
* @todo extract into utility class in Doctrine\DBAL\Util namespace
|
||||
* @todo review and test for lost spaces. we experienced missing spaces with oci8 in some sql statements.
|
||||
*
|
||||
* @param string $statement The SQL statement to convert.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
static public function convertPositionalToNamedPlaceholders($statement)
|
||||
{
|
||||
$count = 1;
|
||||
$inLiteral = false; // a valid query never starts with quotes
|
||||
$stmtLen = strlen($statement);
|
||||
$paramMap = array();
|
||||
for ($i = 0; $i < $stmtLen; $i++) {
|
||||
if ($statement[$i] == '?' && !$inLiteral) {
|
||||
// real positional parameter detected
|
||||
$paramMap[$count] = ":param$count";
|
||||
$len = strlen($paramMap[$count]);
|
||||
$statement = substr_replace($statement, ":param$count", $i, 1);
|
||||
$i += $len-1; // jump ahead
|
||||
$stmtLen = strlen($statement); // adjust statement length
|
||||
++$count;
|
||||
} else if ($statement[$i] == "'" || $statement[$i] == '"') {
|
||||
$inLiteral = ! $inLiteral; // switch state!
|
||||
}
|
||||
}
|
||||
|
||||
return array($statement, $paramMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function bindValue($param, $value, $type = null)
|
||||
{
|
||||
return $this->bindParam($param, $value, $type, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function bindParam($column, &$variable, $type = null, $length = null)
|
||||
{
|
||||
$column = isset($this->_paramMap[$column]) ? $this->_paramMap[$column] : $column;
|
||||
|
||||
if ($type == \PDO::PARAM_LOB) {
|
||||
$lob = oci_new_descriptor($this->_dbh, OCI_D_LOB);
|
||||
$lob->writeTemporary($variable, OCI_TEMP_BLOB);
|
||||
|
||||
return oci_bind_by_name($this->_sth, $column, $lob, -1, OCI_B_BLOB);
|
||||
} else if ($length !== null) {
|
||||
return oci_bind_by_name($this->_sth, $column, $variable, $length);
|
||||
}
|
||||
|
||||
return oci_bind_by_name($this->_sth, $column, $variable);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function closeCursor()
|
||||
{
|
||||
return oci_free_statement($this->_sth);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function columnCount()
|
||||
{
|
||||
return oci_num_fields($this->_sth);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function errorCode()
|
||||
{
|
||||
$error = oci_error($this->_sth);
|
||||
if ($error !== false) {
|
||||
$error = $error['code'];
|
||||
}
|
||||
|
||||
return $error;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function errorInfo()
|
||||
{
|
||||
return oci_error($this->_sth);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function execute($params = null)
|
||||
{
|
||||
if ($params) {
|
||||
$hasZeroIndex = array_key_exists(0, $params);
|
||||
foreach ($params as $key => $val) {
|
||||
if ($hasZeroIndex && is_numeric($key)) {
|
||||
$this->bindValue($key + 1, $val);
|
||||
} else {
|
||||
$this->bindValue($key, $val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ret = @oci_execute($this->_sth, $this->_conn->getExecuteMode());
|
||||
if ( ! $ret) {
|
||||
throw OCI8Exception::fromErrorInfo($this->errorInfo());
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null)
|
||||
{
|
||||
$this->_defaultFetchMode = $fetchMode;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
$data = $this->fetchAll();
|
||||
|
||||
return new \ArrayIterator($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetch($fetchMode = null)
|
||||
{
|
||||
$fetchMode = $fetchMode ?: $this->_defaultFetchMode;
|
||||
if ( ! isset(self::$fetchModeMap[$fetchMode])) {
|
||||
throw new \InvalidArgumentException("Invalid fetch style: " . $fetchMode);
|
||||
}
|
||||
|
||||
return oci_fetch_array($this->_sth, self::$fetchModeMap[$fetchMode] | OCI_RETURN_NULLS | OCI_RETURN_LOBS);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchAll($fetchMode = null)
|
||||
{
|
||||
$fetchMode = $fetchMode ?: $this->_defaultFetchMode;
|
||||
if ( ! isset(self::$fetchModeMap[$fetchMode])) {
|
||||
throw new \InvalidArgumentException("Invalid fetch style: " . $fetchMode);
|
||||
}
|
||||
|
||||
$result = array();
|
||||
if (self::$fetchModeMap[$fetchMode] === OCI_BOTH) {
|
||||
while ($row = $this->fetch($fetchMode)) {
|
||||
$result[] = $row;
|
||||
}
|
||||
} else {
|
||||
$fetchStructure = OCI_FETCHSTATEMENT_BY_ROW;
|
||||
if ($fetchMode == PDO::FETCH_COLUMN) {
|
||||
$fetchStructure = OCI_FETCHSTATEMENT_BY_COLUMN;
|
||||
}
|
||||
|
||||
oci_fetch_all($this->_sth, $result, 0, -1,
|
||||
self::$fetchModeMap[$fetchMode] | OCI_RETURN_NULLS | $fetchStructure | OCI_RETURN_LOBS);
|
||||
|
||||
if ($fetchMode == PDO::FETCH_COLUMN) {
|
||||
$result = $result[0];
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchColumn($columnIndex = 0)
|
||||
{
|
||||
$row = oci_fetch_array($this->_sth, OCI_NUM | OCI_RETURN_NULLS | OCI_RETURN_LOBS);
|
||||
|
||||
return isset($row[$columnIndex]) ? $row[$columnIndex] : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rowCount()
|
||||
{
|
||||
return oci_num_rows($this->_sth);
|
||||
}
|
||||
}
|
||||
44
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php
vendored
Normal file
44
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver;
|
||||
|
||||
use PDO;
|
||||
|
||||
/**
|
||||
* PDO implementation of the Connection interface.
|
||||
* Used by all PDO-based drivers.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
class PDOConnection extends PDO implements Connection
|
||||
{
|
||||
/**
|
||||
* @param string $dsn
|
||||
* @param string|null $user
|
||||
* @param string|null $password
|
||||
* @param array|null $options
|
||||
*/
|
||||
public function __construct($dsn, $user = null, $password = null, array $options = null)
|
||||
{
|
||||
parent::__construct($dsn, $user, $password, $options);
|
||||
$this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('Doctrine\DBAL\Driver\PDOStatement', array()));
|
||||
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
}
|
||||
}
|
||||
108
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOIbm/Driver.php
vendored
Normal file
108
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOIbm/Driver.php
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\PDOIbm;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
|
||||
/**
|
||||
* Driver for the PDO IBM extension.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 1.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class Driver implements \Doctrine\DBAL\Driver
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
|
||||
{
|
||||
$conn = new \Doctrine\DBAL\Driver\PDOConnection(
|
||||
$this->_constructPdoDsn($params),
|
||||
$username,
|
||||
$password,
|
||||
$driverOptions
|
||||
);
|
||||
|
||||
return $conn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the IBM PDO DSN.
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return string The DSN.
|
||||
*/
|
||||
private function _constructPdoDsn(array $params)
|
||||
{
|
||||
$dsn = 'ibm:';
|
||||
if (isset($params['host'])) {
|
||||
$dsn .= 'HOSTNAME=' . $params['host'] . ';';
|
||||
}
|
||||
if (isset($params['port'])) {
|
||||
$dsn .= 'PORT=' . $params['port'] . ';';
|
||||
}
|
||||
$dsn .= 'PROTOCOL=TCPIP;';
|
||||
if (isset($params['dbname'])) {
|
||||
$dsn .= 'DATABASE=' . $params['dbname'] . ';';
|
||||
}
|
||||
|
||||
return $dsn;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabasePlatform()
|
||||
{
|
||||
return new \Doctrine\DBAL\Platforms\DB2Platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSchemaManager(Connection $conn)
|
||||
{
|
||||
return new \Doctrine\DBAL\Schema\DB2SchemaManager($conn);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'pdo_ibm';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabase(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
$params = $conn->getParams();
|
||||
|
||||
return $params['dbname'];
|
||||
}
|
||||
}
|
||||
111
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php
vendored
Normal file
111
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\PDOMySql;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
|
||||
/**
|
||||
* PDO MySql driver.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
class Driver implements \Doctrine\DBAL\Driver
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
|
||||
{
|
||||
$conn = new \Doctrine\DBAL\Driver\PDOConnection(
|
||||
$this->_constructPdoDsn($params),
|
||||
$username,
|
||||
$password,
|
||||
$driverOptions
|
||||
);
|
||||
|
||||
return $conn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the MySql PDO DSN.
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return string The DSN.
|
||||
*/
|
||||
private function _constructPdoDsn(array $params)
|
||||
{
|
||||
$dsn = 'mysql:';
|
||||
if (isset($params['host']) && $params['host'] != '') {
|
||||
$dsn .= 'host=' . $params['host'] . ';';
|
||||
}
|
||||
if (isset($params['port'])) {
|
||||
$dsn .= 'port=' . $params['port'] . ';';
|
||||
}
|
||||
if (isset($params['dbname'])) {
|
||||
$dsn .= 'dbname=' . $params['dbname'] . ';';
|
||||
}
|
||||
if (isset($params['unix_socket'])) {
|
||||
$dsn .= 'unix_socket=' . $params['unix_socket'] . ';';
|
||||
}
|
||||
if (isset($params['charset'])) {
|
||||
$dsn .= 'charset=' . $params['charset'] . ';';
|
||||
}
|
||||
|
||||
return $dsn;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabasePlatform()
|
||||
{
|
||||
return new \Doctrine\DBAL\Platforms\MySqlPlatform();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
return new \Doctrine\DBAL\Schema\MySqlSchemaManager($conn);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'pdo_mysql';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabase(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
$params = $conn->getParams();
|
||||
|
||||
if (isset($params['dbname'])) {
|
||||
return $params['dbname'];
|
||||
}
|
||||
return $conn->query('SELECT DATABASE()')->fetchColumn();
|
||||
}
|
||||
}
|
||||
116
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOOracle/Driver.php
vendored
Normal file
116
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOOracle/Driver.php
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\PDOOracle;
|
||||
|
||||
use Doctrine\DBAL\Platforms;
|
||||
|
||||
/**
|
||||
* PDO Oracle driver.
|
||||
*
|
||||
* WARNING: This driver gives us segfaults in our testsuites on CLOB and other
|
||||
* stuff. PDO Oracle is not maintained by Oracle or anyone in the PHP community,
|
||||
* which leads us to the recommendation to use the "oci8" driver to connect
|
||||
* to Oracle instead.
|
||||
*/
|
||||
class Driver implements \Doctrine\DBAL\Driver
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
|
||||
{
|
||||
return new \Doctrine\DBAL\Driver\PDOConnection(
|
||||
$this->_constructPdoDsn($params),
|
||||
$username,
|
||||
$password,
|
||||
$driverOptions
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the Oracle PDO DSN.
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return string The DSN.
|
||||
*/
|
||||
private function _constructPdoDsn(array $params)
|
||||
{
|
||||
$dsn = 'oci:';
|
||||
if (isset($params['host']) && $params['host'] != '') {
|
||||
$dsn .= 'dbname=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)' .
|
||||
'(HOST=' . $params['host'] . ')';
|
||||
|
||||
if (isset($params['port'])) {
|
||||
$dsn .= '(PORT=' . $params['port'] . ')';
|
||||
} else {
|
||||
$dsn .= '(PORT=1521)';
|
||||
}
|
||||
|
||||
if (isset($params['service']) && $params['service'] == true) {
|
||||
$dsn .= '))(CONNECT_DATA=(SERVICE_NAME=' . $params['dbname'] . ')))';
|
||||
} else {
|
||||
$dsn .= '))(CONNECT_DATA=(SID=' . $params['dbname'] . ')))';
|
||||
}
|
||||
} else {
|
||||
$dsn .= 'dbname=' . $params['dbname'];
|
||||
}
|
||||
|
||||
if (isset($params['charset'])) {
|
||||
$dsn .= ';charset=' . $params['charset'];
|
||||
}
|
||||
|
||||
return $dsn;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabasePlatform()
|
||||
{
|
||||
return new \Doctrine\DBAL\Platforms\OraclePlatform();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
return new \Doctrine\DBAL\Schema\OracleSchemaManager($conn);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'pdo_oracle';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabase(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
$params = $conn->getParams();
|
||||
|
||||
return $params['user'];
|
||||
}
|
||||
}
|
||||
103
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php
vendored
Normal file
103
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\PDOPgSql;
|
||||
|
||||
use Doctrine\DBAL\Platforms;
|
||||
|
||||
/**
|
||||
* Driver that connects through pdo_pgsql.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
class Driver implements \Doctrine\DBAL\Driver
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
|
||||
{
|
||||
return new \Doctrine\DBAL\Driver\PDOConnection(
|
||||
$this->_constructPdoDsn($params),
|
||||
$username,
|
||||
$password,
|
||||
$driverOptions
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the Postgres PDO DSN.
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return string The DSN.
|
||||
*/
|
||||
private function _constructPdoDsn(array $params)
|
||||
{
|
||||
$dsn = 'pgsql:';
|
||||
if (isset($params['host']) && $params['host'] != '') {
|
||||
$dsn .= 'host=' . $params['host'] . ' ';
|
||||
}
|
||||
if (isset($params['port']) && $params['port'] != '') {
|
||||
$dsn .= 'port=' . $params['port'] . ' ';
|
||||
}
|
||||
if (isset($params['dbname'])) {
|
||||
$dsn .= 'dbname=' . $params['dbname'] . ' ';
|
||||
}
|
||||
|
||||
return $dsn;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabasePlatform()
|
||||
{
|
||||
return new \Doctrine\DBAL\Platforms\PostgreSqlPlatform();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
return new \Doctrine\DBAL\Schema\PostgreSqlSchemaManager($conn);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'pdo_pgsql';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabase(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
$params = $conn->getParams();
|
||||
|
||||
return (isset($params['dbname']))
|
||||
? $params['dbname']
|
||||
: $conn->query('SELECT CURRENT_DATABASE()')->fetchColumn();
|
||||
}
|
||||
}
|
||||
|
||||
115
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php
vendored
Normal file
115
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\PDOSqlite;
|
||||
|
||||
/**
|
||||
* The PDO Sqlite driver.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
class Driver implements \Doctrine\DBAL\Driver
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_userDefinedFunctions = array(
|
||||
'sqrt' => array('callback' => array('Doctrine\DBAL\Platforms\SqlitePlatform', 'udfSqrt'), 'numArgs' => 1),
|
||||
'mod' => array('callback' => array('Doctrine\DBAL\Platforms\SqlitePlatform', 'udfMod'), 'numArgs' => 2),
|
||||
'locate' => array('callback' => array('Doctrine\DBAL\Platforms\SqlitePlatform', 'udfLocate'), 'numArgs' => -1),
|
||||
);
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
|
||||
{
|
||||
if (isset($driverOptions['userDefinedFunctions'])) {
|
||||
$this->_userDefinedFunctions = array_merge(
|
||||
$this->_userDefinedFunctions, $driverOptions['userDefinedFunctions']);
|
||||
unset($driverOptions['userDefinedFunctions']);
|
||||
}
|
||||
|
||||
$pdo = new \Doctrine\DBAL\Driver\PDOConnection(
|
||||
$this->_constructPdoDsn($params),
|
||||
$username,
|
||||
$password,
|
||||
$driverOptions
|
||||
);
|
||||
|
||||
foreach ($this->_userDefinedFunctions as $fn => $data) {
|
||||
$pdo->sqliteCreateFunction($fn, $data['callback'], $data['numArgs']);
|
||||
}
|
||||
|
||||
return $pdo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the Sqlite PDO DSN.
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return string The DSN.
|
||||
*/
|
||||
protected function _constructPdoDsn(array $params)
|
||||
{
|
||||
$dsn = 'sqlite:';
|
||||
if (isset($params['path'])) {
|
||||
$dsn .= $params['path'];
|
||||
} else if (isset($params['memory'])) {
|
||||
$dsn .= ':memory:';
|
||||
}
|
||||
|
||||
return $dsn;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabasePlatform()
|
||||
{
|
||||
return new \Doctrine\DBAL\Platforms\SqlitePlatform();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
return new \Doctrine\DBAL\Schema\SqliteSchemaManager($conn);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'pdo_sqlite';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabase(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
$params = $conn->getParams();
|
||||
|
||||
return isset($params['path']) ? $params['path'] : null;
|
||||
}
|
||||
}
|
||||
43
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Connection.php
vendored
Normal file
43
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Connection.php
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\PDOSqlsrv;
|
||||
|
||||
/**
|
||||
* Sqlsrv Connection implementation.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
class Connection extends \Doctrine\DBAL\Driver\PDOConnection implements \Doctrine\DBAL\Driver\Connection
|
||||
{
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function quote($value, $type=\PDO::PARAM_STR)
|
||||
{
|
||||
$val = parent::quote($value, $type);
|
||||
|
||||
// Fix for a driver version terminating all values with null byte
|
||||
if (strpos($val, "\0") !== false) {
|
||||
$val = substr($val, 0, -1);
|
||||
}
|
||||
|
||||
return $val;
|
||||
}
|
||||
}
|
||||
105
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Driver.php
vendored
Normal file
105
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Driver.php
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\PDOSqlsrv;
|
||||
|
||||
/**
|
||||
* The PDO-based Sqlsrv driver.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
class Driver implements \Doctrine\DBAL\Driver
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
|
||||
{
|
||||
return new Connection(
|
||||
$this->_constructPdoDsn($params),
|
||||
$username,
|
||||
$password,
|
||||
$driverOptions
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the Sqlsrv PDO DSN.
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return string The DSN.
|
||||
*/
|
||||
private function _constructPdoDsn(array $params)
|
||||
{
|
||||
$dsn = 'sqlsrv:server=';
|
||||
|
||||
if (isset($params['host'])) {
|
||||
$dsn .= $params['host'];
|
||||
}
|
||||
|
||||
if (isset($params['port']) && !empty($params['port'])) {
|
||||
$dsn .= ',' . $params['port'];
|
||||
}
|
||||
|
||||
if (isset($params['dbname'])) {;
|
||||
$dsn .= ';Database=' . $params['dbname'];
|
||||
}
|
||||
|
||||
if (isset($params['MultipleActiveResultSets'])) {
|
||||
$dsn .= '; MultipleActiveResultSets=' . ($params['MultipleActiveResultSets'] ? 'true' : 'false');
|
||||
}
|
||||
|
||||
return $dsn;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabasePlatform()
|
||||
{
|
||||
return new \Doctrine\DBAL\Platforms\SQLServer2008Platform();
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
||||
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
return new \Doctrine\DBAL\Schema\SQLServerSchemaManager($conn);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'pdo_sqlsrv';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabase(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
$params = $conn->getParams();
|
||||
|
||||
return $params['dbname'];
|
||||
}
|
||||
}
|
||||
56
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php
vendored
Normal file
56
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver;
|
||||
|
||||
/**
|
||||
* The PDO implementation of the Statement interface.
|
||||
* Used by all PDO-based drivers.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
class PDOStatement extends \PDOStatement implements Statement
|
||||
{
|
||||
/**
|
||||
* Private constructor.
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null)
|
||||
{
|
||||
// This thin wrapper is necessary to shield against the weird signature
|
||||
// of PDOStatement::setFetchMode(): even if the second and third
|
||||
// parameters are optional, PHP will not let us remove it from this
|
||||
// declaration.
|
||||
if ($arg2 === null && $arg3 === null) {
|
||||
return parent::setFetchMode($fetchMode);
|
||||
}
|
||||
|
||||
if ($arg3 === null) {
|
||||
return parent::setFetchMode($fetchMode, $arg2);
|
||||
}
|
||||
|
||||
return parent::setFetchMode($fetchMode, $arg2, $arg3);
|
||||
}
|
||||
}
|
||||
88
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/ResultStatement.php
vendored
Normal file
88
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/ResultStatement.php
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver;
|
||||
|
||||
/**
|
||||
* Interface for the reading part of a prepare statement only.
|
||||
*
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
interface ResultStatement extends \Traversable
|
||||
{
|
||||
/**
|
||||
* Closes the cursor, enabling the statement to be executed again.
|
||||
*
|
||||
* @return boolean TRUE on success or FALSE on failure.
|
||||
*/
|
||||
public function closeCursor();
|
||||
|
||||
/**
|
||||
* Returns the number of columns in the result set
|
||||
*
|
||||
* @return integer The number of columns in the result set represented
|
||||
* by the PDOStatement object. If there is no result set,
|
||||
* this method should return 0.
|
||||
*/
|
||||
public function columnCount();
|
||||
|
||||
/**
|
||||
* Sets the fetch mode to use while iterating this statement.
|
||||
*
|
||||
* @param integer $fetchMode
|
||||
* @param mixed $arg2
|
||||
* @param mixed $arg3
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null);
|
||||
|
||||
/**
|
||||
* @see Query::HYDRATE_* constants
|
||||
*
|
||||
* @param integer|null $fetchMode Controls how the next row will be returned to the caller.
|
||||
* This value must be one of the Query::HYDRATE_* constants,
|
||||
* defaulting to Query::HYDRATE_BOTH
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function fetch($fetchMode = null);
|
||||
|
||||
/**
|
||||
* Returns an array containing all of the result set rows.
|
||||
*
|
||||
* @param integer|null $fetchMode Controls how the next row will be returned to the caller.
|
||||
* This value must be one of the Query::HYDRATE_* constants,
|
||||
* defaulting to Query::HYDRATE_BOTH
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function fetchAll($fetchMode = null);
|
||||
|
||||
/**
|
||||
* Returns a single column from the next row of a result set or FALSE if there are no more rows.
|
||||
*
|
||||
* @param integer $columnIndex 0-indexed number of the column you wish to retrieve from the row.
|
||||
* If no value is supplied, PDOStatement->fetchColumn()
|
||||
* fetches the first column.
|
||||
*
|
||||
* @return string|boolean A single column in the next row of a result set, or FALSE if there are no more rows.
|
||||
*/
|
||||
public function fetchColumn($columnIndex = 0);
|
||||
}
|
||||
86
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/Driver.php
vendored
Normal file
86
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/Driver.php
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\SQLSrv;
|
||||
|
||||
/**
|
||||
* Driver for ext/sqlsrv.
|
||||
*/
|
||||
class Driver implements \Doctrine\DBAL\Driver
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
|
||||
{
|
||||
if (!isset($params['host'])) {
|
||||
throw new SQLSrvException("Missing 'host' in configuration for sqlsrv driver.");
|
||||
}
|
||||
if (!isset($params['dbname'])) {
|
||||
throw new SQLSrvException("Missing 'dbname' in configuration for sqlsrv driver.");
|
||||
}
|
||||
|
||||
$serverName = $params['host'];
|
||||
if (isset($params['port'])) {
|
||||
$serverName .= ', ' . $params['port'];
|
||||
}
|
||||
$driverOptions['Database'] = $params['dbname'];
|
||||
$driverOptions['UID'] = $username;
|
||||
$driverOptions['PWD'] = $password;
|
||||
|
||||
if (!isset($driverOptions['ReturnDatesAsStrings'])) {
|
||||
$driverOptions['ReturnDatesAsStrings'] = 1;
|
||||
}
|
||||
|
||||
return new SQLSrvConnection($serverName, $driverOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabasePlatform()
|
||||
{
|
||||
return new \Doctrine\DBAL\Platforms\SQLServer2008Platform();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
return new \Doctrine\DBAL\Schema\SQLServerSchemaManager($conn);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'sqlsrv';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabase(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
$params = $conn->getParams();
|
||||
return $params['dbname'];
|
||||
}
|
||||
}
|
||||
50
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/LastInsertId.php
vendored
Normal file
50
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/LastInsertId.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\SQLSrv;
|
||||
|
||||
/**
|
||||
* Last Id Data Container.
|
||||
*
|
||||
* @since 2.3
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class LastInsertId
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @param integer $id
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
168
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvConnection.php
vendored
Normal file
168
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvConnection.php
vendored
Normal file
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\SQLSrv;
|
||||
|
||||
/**
|
||||
* SQL Server implementation for the Connection interface.
|
||||
*
|
||||
* @since 2.3
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class SQLSrvConnection implements \Doctrine\DBAL\Driver\Connection
|
||||
{
|
||||
/**
|
||||
* @var resource
|
||||
*/
|
||||
protected $conn;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Driver\SQLSrv\LastInsertId
|
||||
*/
|
||||
protected $lastInsertId;
|
||||
|
||||
/**
|
||||
* @param string $serverName
|
||||
* @param array $connectionOptions
|
||||
*
|
||||
* @throws \Doctrine\DBAL\Driver\SQLSrv\SQLSrvException
|
||||
*/
|
||||
public function __construct($serverName, $connectionOptions)
|
||||
{
|
||||
$this->conn = sqlsrv_connect($serverName, $connectionOptions);
|
||||
if ( ! $this->conn) {
|
||||
throw SQLSrvException::fromSqlSrvErrors();
|
||||
}
|
||||
$this->lastInsertId = new LastInsertId();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function prepare($sql)
|
||||
{
|
||||
return new SQLSrvStatement($this->conn, $sql, $this->lastInsertId);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function query()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$sql = $args[0];
|
||||
$stmt = $this->prepare($sql);
|
||||
$stmt->execute();
|
||||
|
||||
return $stmt;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @license New BSD, code from Zend Framework
|
||||
*/
|
||||
public function quote($value, $type=\PDO::PARAM_STR)
|
||||
{
|
||||
if (is_int($value)) {
|
||||
return $value;
|
||||
} else if (is_float($value)) {
|
||||
return sprintf('%F', $value);
|
||||
}
|
||||
|
||||
return "'" . str_replace("'", "''", $value) . "'";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function exec($statement)
|
||||
{
|
||||
$stmt = $this->prepare($statement);
|
||||
$stmt->execute();
|
||||
|
||||
return $stmt->rowCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function lastInsertId($name = null)
|
||||
{
|
||||
if ($name !== null) {
|
||||
$sql = "SELECT IDENT_CURRENT(".$this->quote($name).") AS LastInsertId";
|
||||
$stmt = $this->prepare($sql);
|
||||
$stmt->execute();
|
||||
|
||||
return $stmt->fetchColumn();
|
||||
}
|
||||
|
||||
return $this->lastInsertId->getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function beginTransaction()
|
||||
{
|
||||
if ( ! sqlsrv_begin_transaction($this->conn)) {
|
||||
throw SQLSrvException::fromSqlSrvErrors();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function commit()
|
||||
{
|
||||
if ( ! sqlsrv_commit($this->conn)) {
|
||||
throw SQLSrvException::fromSqlSrvErrors();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function rollBack()
|
||||
{
|
||||
if ( ! sqlsrv_rollback($this->conn)) {
|
||||
throw SQLSrvException::fromSqlSrvErrors();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function errorCode()
|
||||
{
|
||||
$errors = sqlsrv_errors(SQLSRV_ERR_ERRORS);
|
||||
if ($errors) {
|
||||
return $errors[0]['code'];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function errorInfo()
|
||||
{
|
||||
return sqlsrv_errors(SQLSRV_ERR_ERRORS);
|
||||
}
|
||||
}
|
||||
42
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvException.php
vendored
Normal file
42
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvException.php
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\SQLSrv;
|
||||
|
||||
class SQLSrvException extends \Doctrine\DBAL\DBALException
|
||||
{
|
||||
/**
|
||||
* Helper method to turn sql server errors into exception.
|
||||
*
|
||||
* @return \Doctrine\DBAL\Driver\SQLSrv\SQLSrvException
|
||||
*/
|
||||
static public function fromSqlSrvErrors()
|
||||
{
|
||||
$errors = sqlsrv_errors(SQLSRV_ERR_ERRORS);
|
||||
$message = "";
|
||||
foreach ($errors as $error) {
|
||||
$message .= "SQLSTATE [".$error['SQLSTATE'].", ".$error['code']."]: ". $error['message']."\n";
|
||||
}
|
||||
if ( ! $message) {
|
||||
$message = "SQL Server error occurred but no error message was retrieved from driver.";
|
||||
}
|
||||
|
||||
return new self(rtrim($message));
|
||||
}
|
||||
}
|
||||
278
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php
vendored
Normal file
278
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php
vendored
Normal file
@@ -0,0 +1,278 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver\SQLSrv;
|
||||
|
||||
use PDO;
|
||||
use IteratorAggregate;
|
||||
use Doctrine\DBAL\Driver\Statement;
|
||||
|
||||
/**
|
||||
* SQL Server Statement.
|
||||
*
|
||||
* @since 2.3
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class SQLSrvStatement implements IteratorAggregate, Statement
|
||||
{
|
||||
/**
|
||||
* The SQLSRV Resource.
|
||||
*
|
||||
* @var resource
|
||||
*/
|
||||
private $conn;
|
||||
|
||||
/**
|
||||
* The SQL statement to execute.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $sql;
|
||||
|
||||
/**
|
||||
* The SQLSRV statement resource.
|
||||
*
|
||||
* @var resource
|
||||
*/
|
||||
private $stmt;
|
||||
|
||||
/**
|
||||
* Parameters to bind.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $params = array();
|
||||
|
||||
/**
|
||||
* Translations.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $fetchMap = array(
|
||||
PDO::FETCH_BOTH => SQLSRV_FETCH_BOTH,
|
||||
PDO::FETCH_ASSOC => SQLSRV_FETCH_ASSOC,
|
||||
PDO::FETCH_NUM => SQLSRV_FETCH_NUMERIC,
|
||||
);
|
||||
|
||||
/**
|
||||
* The fetch style.
|
||||
*
|
||||
* @param integer
|
||||
*/
|
||||
private $defaultFetchMode = PDO::FETCH_BOTH;
|
||||
|
||||
/**
|
||||
* The last insert ID.
|
||||
*
|
||||
* @var \Doctrine\DBAL\Driver\SQLSrv\LastInsertId|null
|
||||
*/
|
||||
private $lastInsertId;
|
||||
|
||||
/**
|
||||
* Append to any INSERT query to retrieve the last insert id.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const LAST_INSERT_ID_SQL = ';SELECT SCOPE_IDENTITY() AS LastInsertId;';
|
||||
|
||||
/**
|
||||
* @param resource $conn
|
||||
* @param string $sql
|
||||
* @param integer|null $lastInsertId
|
||||
*/
|
||||
public function __construct($conn, $sql, $lastInsertId = null)
|
||||
{
|
||||
$this->conn = $conn;
|
||||
$this->sql = $sql;
|
||||
|
||||
if (stripos($sql, 'INSERT INTO ') === 0) {
|
||||
$this->sql .= self::LAST_INSERT_ID_SQL;
|
||||
$this->lastInsertId = $lastInsertId;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function bindValue($param, $value, $type = null)
|
||||
{
|
||||
return $this->bindParam($param, $value, $type,null);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function bindParam($column, &$variable, $type = null, $length = null)
|
||||
{
|
||||
if (!is_numeric($column)) {
|
||||
throw new SQLSrvException("sqlsrv does not support named parameters to queries, use question mark (?) placeholders instead.");
|
||||
}
|
||||
|
||||
if ($type === \PDO::PARAM_LOB) {
|
||||
$this->params[$column-1] = array($variable, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY), SQLSRV_SQLTYPE_VARBINARY('max'));
|
||||
} else {
|
||||
$this->params[$column-1] = $variable;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function closeCursor()
|
||||
{
|
||||
if ($this->stmt) {
|
||||
sqlsrv_free_stmt($this->stmt);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function columnCount()
|
||||
{
|
||||
return sqlsrv_num_fields($this->stmt);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function errorCode()
|
||||
{
|
||||
$errors = sqlsrv_errors(SQLSRV_ERR_ERRORS);
|
||||
if ($errors) {
|
||||
return $errors[0]['code'];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function errorInfo()
|
||||
{
|
||||
return sqlsrv_errors(SQLSRV_ERR_ERRORS);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function execute($params = null)
|
||||
{
|
||||
if ($params) {
|
||||
$hasZeroIndex = array_key_exists(0, $params);
|
||||
foreach ($params as $key => $val) {
|
||||
$key = ($hasZeroIndex && is_numeric($key)) ? $key + 1 : $key;
|
||||
$this->bindValue($key, $val);
|
||||
}
|
||||
}
|
||||
|
||||
$this->stmt = sqlsrv_query($this->conn, $this->sql, $this->params);
|
||||
if ( ! $this->stmt) {
|
||||
throw SQLSrvException::fromSqlSrvErrors();
|
||||
}
|
||||
|
||||
if ($this->lastInsertId) {
|
||||
sqlsrv_next_result($this->stmt);
|
||||
sqlsrv_fetch($this->stmt);
|
||||
$this->lastInsertId->setId( sqlsrv_get_field($this->stmt, 0) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null)
|
||||
{
|
||||
$this->defaultFetchMode = $fetchMode;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
$data = $this->fetchAll();
|
||||
|
||||
return new \ArrayIterator($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetch($fetchMode = null)
|
||||
{
|
||||
$fetchMode = $fetchMode ?: $this->defaultFetchMode;
|
||||
if (isset(self::$fetchMap[$fetchMode])) {
|
||||
return sqlsrv_fetch_array($this->stmt, self::$fetchMap[$fetchMode]);
|
||||
} else if ($fetchMode == PDO::FETCH_OBJ || $fetchMode == PDO::FETCH_CLASS) {
|
||||
$className = null;
|
||||
$ctorArgs = null;
|
||||
if (func_num_args() >= 2) {
|
||||
$args = func_get_args();
|
||||
$className = $args[1];
|
||||
$ctorArgs = (isset($args[2])) ? $args[2] : array();
|
||||
}
|
||||
return sqlsrv_fetch_object($this->stmt, $className, $ctorArgs);
|
||||
}
|
||||
|
||||
throw new SQLSrvException("Fetch mode is not supported!");
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchAll($fetchMode = null)
|
||||
{
|
||||
$className = null;
|
||||
$ctorArgs = null;
|
||||
if (func_num_args() >= 2) {
|
||||
$args = func_get_args();
|
||||
$className = $args[1];
|
||||
$ctorArgs = (isset($args[2])) ? $args[2] : array();
|
||||
}
|
||||
|
||||
$rows = array();
|
||||
while ($row = $this->fetch($fetchMode, $className, $ctorArgs)) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchColumn($columnIndex = 0)
|
||||
{
|
||||
$row = $this->fetch(PDO::FETCH_NUM);
|
||||
|
||||
return $row[$columnIndex];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rowCount()
|
||||
{
|
||||
return sqlsrv_rows_affected($this->stmt);
|
||||
}
|
||||
}
|
||||
121
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Statement.php
vendored
Normal file
121
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Statement.php
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Driver;
|
||||
|
||||
/**
|
||||
* Statement interface.
|
||||
* Drivers must implement this interface.
|
||||
*
|
||||
* This resembles (a subset of) the PDOStatement interface.
|
||||
*
|
||||
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
*/
|
||||
interface Statement extends ResultStatement
|
||||
{
|
||||
/**
|
||||
* Binds a value to a corresponding named or positional
|
||||
* placeholder in the SQL statement that was used to prepare the statement.
|
||||
*
|
||||
* @param mixed $param Parameter identifier. For a prepared statement using named placeholders,
|
||||
* this will be a parameter name of the form :name. For a prepared statement
|
||||
* using question mark placeholders, this will be the 1-indexed position of the parameter.
|
||||
* @param mixed $value The value to bind to the parameter.
|
||||
* @param integer $type Explicit data type for the parameter using the PDO::PARAM_* constants.
|
||||
*
|
||||
* @return boolean TRUE on success or FALSE on failure.
|
||||
*/
|
||||
function bindValue($param, $value, $type = null);
|
||||
|
||||
/**
|
||||
* Binds a PHP variable to a corresponding named or question mark placeholder in the
|
||||
* SQL statement that was use to prepare the statement. Unlike PDOStatement->bindValue(),
|
||||
* the variable is bound as a reference and will only be evaluated at the time
|
||||
* that PDOStatement->execute() is called.
|
||||
*
|
||||
* Most parameters are input parameters, that is, parameters that are
|
||||
* used in a read-only fashion to build up the query. Some drivers support the invocation
|
||||
* of stored procedures that return data as output parameters, and some also as input/output
|
||||
* parameters that both send in data and are updated to receive it.
|
||||
*
|
||||
* @param mixed $column Parameter identifier. For a prepared statement using named placeholders,
|
||||
* this will be a parameter name of the form :name. For a prepared statement using
|
||||
* question mark placeholders, this will be the 1-indexed position of the parameter.
|
||||
* @param mixed $variable Name of the PHP variable to bind to the SQL statement parameter.
|
||||
* @param integer|null $type Explicit data type for the parameter using the PDO::PARAM_* constants. To return
|
||||
* an INOUT parameter from a stored procedure, use the bitwise OR operator to set the
|
||||
* PDO::PARAM_INPUT_OUTPUT bits for the data_type parameter.
|
||||
* @param integer|null $length You must specify maxlength when using an OUT bind
|
||||
* so that PHP allocates enough memory to hold the returned value.
|
||||
*
|
||||
* @return boolean TRUE on success or FALSE on failure.
|
||||
*/
|
||||
function bindParam($column, &$variable, $type = null, $length = null);
|
||||
|
||||
/**
|
||||
* Fetches the SQLSTATE associated with the last operation on the statement handle.
|
||||
*
|
||||
* @see Doctrine_Adapter_Interface::errorCode()
|
||||
*
|
||||
* @return string The error code string.
|
||||
*/
|
||||
function errorCode();
|
||||
|
||||
/**
|
||||
* Fetches extended error information associated with the last operation on the statement handle.
|
||||
*
|
||||
* @see Doctrine_Adapter_Interface::errorInfo()
|
||||
*
|
||||
* @return array The error info array.
|
||||
*/
|
||||
function errorInfo();
|
||||
|
||||
/**
|
||||
* Executes a prepared statement
|
||||
*
|
||||
* If the prepared statement included parameter markers, you must either:
|
||||
* call PDOStatement->bindParam() to bind PHP variables to the parameter markers:
|
||||
* bound variables pass their value as input and receive the output value,
|
||||
* if any, of their associated parameter markers or pass an array of input-only
|
||||
* parameter values.
|
||||
*
|
||||
*
|
||||
* @param array|null $params An array of values with as many elements as there are
|
||||
* bound parameters in the SQL statement being executed.
|
||||
*
|
||||
* @return boolean TRUE on success or FALSE on failure.
|
||||
*/
|
||||
function execute($params = null);
|
||||
|
||||
/**
|
||||
* Returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement
|
||||
* executed by the corresponding object.
|
||||
*
|
||||
* If the last SQL statement executed by the associated Statement object was a SELECT statement,
|
||||
* some databases may return the number of rows returned by that statement. However,
|
||||
* this behaviour is not guaranteed for all databases and should not be
|
||||
* relied on for portable applications.
|
||||
*
|
||||
* @return integer The number of rows.
|
||||
*/
|
||||
function rowCount();
|
||||
}
|
||||
197
vendor/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php
vendored
Normal file
197
vendor/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php
vendored
Normal file
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL;
|
||||
|
||||
use Doctrine\Common\EventManager;
|
||||
|
||||
/**
|
||||
* Factory for creating Doctrine\DBAL\Connection instances.
|
||||
*
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @since 2.0
|
||||
*/
|
||||
final class DriverManager
|
||||
{
|
||||
/**
|
||||
* List of supported drivers and their mappings to the driver classes.
|
||||
*
|
||||
* To add your own driver use the 'driverClass' parameter to
|
||||
* {@link DriverManager::getConnection()}.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $_driverMap = array(
|
||||
'pdo_mysql' => 'Doctrine\DBAL\Driver\PDOMySql\Driver',
|
||||
'pdo_sqlite' => 'Doctrine\DBAL\Driver\PDOSqlite\Driver',
|
||||
'pdo_pgsql' => 'Doctrine\DBAL\Driver\PDOPgSql\Driver',
|
||||
'pdo_oci' => 'Doctrine\DBAL\Driver\PDOOracle\Driver',
|
||||
'oci8' => 'Doctrine\DBAL\Driver\OCI8\Driver',
|
||||
'ibm_db2' => 'Doctrine\DBAL\Driver\IBMDB2\DB2Driver',
|
||||
'pdo_ibm' => 'Doctrine\DBAL\Driver\PDOIbm\Driver',
|
||||
'pdo_sqlsrv' => 'Doctrine\DBAL\Driver\PDOSqlsrv\Driver',
|
||||
'mysqli' => 'Doctrine\DBAL\Driver\Mysqli\Driver',
|
||||
'drizzle_pdo_mysql' => 'Doctrine\DBAL\Driver\DrizzlePDOMySql\Driver',
|
||||
'sqlsrv' => 'Doctrine\DBAL\Driver\SQLSrv\Driver',
|
||||
);
|
||||
|
||||
/**
|
||||
* Private constructor. This class cannot be instantiated.
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a connection object based on the specified parameters.
|
||||
* This method returns a Doctrine\DBAL\Connection which wraps the underlying
|
||||
* driver connection.
|
||||
*
|
||||
* $params must contain at least one of the following.
|
||||
*
|
||||
* Either 'driver' with one of the following values:
|
||||
*
|
||||
* pdo_mysql
|
||||
* pdo_sqlite
|
||||
* pdo_pgsql
|
||||
* pdo_oci (unstable)
|
||||
* pdo_sqlsrv
|
||||
* pdo_ibm (unstable)
|
||||
* pdo_sqlsrv
|
||||
* mysqli
|
||||
* sqlsrv
|
||||
* ibm_db2 (unstable)
|
||||
* drizzle_pdo_mysql
|
||||
*
|
||||
* OR 'driverClass' that contains the full class name (with namespace) of the
|
||||
* driver class to instantiate.
|
||||
*
|
||||
* Other (optional) parameters:
|
||||
*
|
||||
* <b>user (string)</b>:
|
||||
* The username to use when connecting.
|
||||
*
|
||||
* <b>password (string)</b>:
|
||||
* The password to use when connecting.
|
||||
*
|
||||
* <b>driverOptions (array)</b>:
|
||||
* Any additional driver-specific options for the driver. These are just passed
|
||||
* through to the driver.
|
||||
*
|
||||
* <b>pdo</b>:
|
||||
* You can pass an existing PDO instance through this parameter. The PDO
|
||||
* instance will be wrapped in a Doctrine\DBAL\Connection.
|
||||
*
|
||||
* <b>wrapperClass</b>:
|
||||
* You may specify a custom wrapper class through the 'wrapperClass'
|
||||
* parameter but this class MUST inherit from Doctrine\DBAL\Connection.
|
||||
*
|
||||
* <b>driverClass</b>:
|
||||
* The driver class to use.
|
||||
*
|
||||
* @param array $params The parameters.
|
||||
* @param \Doctrine\DBAL\Configuration|null $config The configuration to use.
|
||||
* @param \Doctrine\Common\EventManager|null $eventManager The event manager to use.
|
||||
*
|
||||
* @return \Doctrine\DBAL\Connection
|
||||
*
|
||||
* @throws \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
public static function getConnection(
|
||||
array $params,
|
||||
Configuration $config = null,
|
||||
EventManager $eventManager = null)
|
||||
{
|
||||
// create default config and event manager, if not set
|
||||
if ( ! $config) {
|
||||
$config = new Configuration();
|
||||
}
|
||||
if ( ! $eventManager) {
|
||||
$eventManager = new EventManager();
|
||||
}
|
||||
|
||||
// check for existing pdo object
|
||||
if (isset($params['pdo']) && ! $params['pdo'] instanceof \PDO) {
|
||||
throw DBALException::invalidPdoInstance();
|
||||
} else if (isset($params['pdo'])) {
|
||||
$params['pdo']->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
|
||||
$params['driver'] = 'pdo_' . $params['pdo']->getAttribute(\PDO::ATTR_DRIVER_NAME);
|
||||
} else {
|
||||
self::_checkParams($params);
|
||||
}
|
||||
if (isset($params['driverClass'])) {
|
||||
$className = $params['driverClass'];
|
||||
} else {
|
||||
$className = self::$_driverMap[$params['driver']];
|
||||
}
|
||||
|
||||
$driver = new $className();
|
||||
|
||||
$wrapperClass = 'Doctrine\DBAL\Connection';
|
||||
if (isset($params['wrapperClass'])) {
|
||||
if (is_subclass_of($params['wrapperClass'], $wrapperClass)) {
|
||||
$wrapperClass = $params['wrapperClass'];
|
||||
} else {
|
||||
throw DBALException::invalidWrapperClass($params['wrapperClass']);
|
||||
}
|
||||
}
|
||||
|
||||
return new $wrapperClass($params, $driver, $config, $eventManager);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of supported drivers.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getAvailableDrivers()
|
||||
{
|
||||
return array_keys(self::$_driverMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the list of parameters.
|
||||
*
|
||||
* @param array $params The list of parameters.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
private static function _checkParams(array $params)
|
||||
{
|
||||
// check existence of mandatory parameters
|
||||
|
||||
// driver
|
||||
if ( ! isset($params['driver']) && ! isset($params['driverClass'])) {
|
||||
throw DBALException::driverRequired();
|
||||
}
|
||||
|
||||
// check validity of parameters
|
||||
|
||||
// driver
|
||||
if ( isset($params['driver']) && ! isset(self::$_driverMap[$params['driver']])) {
|
||||
throw DBALException::unknownDriver($params['driver'], array_keys(self::$_driverMap));
|
||||
}
|
||||
|
||||
if (isset($params['driverClass']) && ! in_array('Doctrine\DBAL\Driver', class_implements($params['driverClass'], true))) {
|
||||
throw DBALException::invalidDriverClass($params['driverClass']);
|
||||
}
|
||||
}
|
||||
}
|
||||
78
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/ConnectionEventArgs.php
vendored
Normal file
78
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/ConnectionEventArgs.php
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Event;
|
||||
|
||||
use Doctrine\Common\EventArgs;
|
||||
use Doctrine\DBAL\Connection;
|
||||
|
||||
/**
|
||||
* Event Arguments used when a Driver connection is established inside Doctrine\DBAL\Connection.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 1.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class ConnectionEventArgs extends EventArgs
|
||||
{
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Connection
|
||||
*/
|
||||
private $_connection;
|
||||
|
||||
/**
|
||||
* @param \Doctrine\DBAL\Connection $connection
|
||||
*/
|
||||
public function __construct(Connection $connection)
|
||||
{
|
||||
$this->_connection = $connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Connection
|
||||
*/
|
||||
public function getConnection()
|
||||
{
|
||||
return $this->_connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Driver
|
||||
*/
|
||||
public function getDriver()
|
||||
{
|
||||
return $this->_connection->getDriver();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Platforms\AbstractPlatform
|
||||
*/
|
||||
public function getDatabasePlatform()
|
||||
{
|
||||
return $this->_connection->getDatabasePlatform();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Schema\AbstractSchemaManager
|
||||
*/
|
||||
public function getSchemaManager()
|
||||
{
|
||||
return $this->_connection->getSchemaManager();
|
||||
}
|
||||
}
|
||||
80
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/Listeners/MysqlSessionInit.php
vendored
Normal file
80
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/Listeners/MysqlSessionInit.php
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Event\Listeners;
|
||||
|
||||
use Doctrine\DBAL\Event\ConnectionEventArgs;
|
||||
use Doctrine\DBAL\Events;
|
||||
use Doctrine\Common\EventSubscriber;
|
||||
|
||||
/**
|
||||
* MySQL Session Init Event Subscriber which allows to set the Client Encoding of the Connection.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 1.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @deprecated Use "charset" option to PDO MySQL Connection instead.
|
||||
*/
|
||||
class MysqlSessionInit implements EventSubscriber
|
||||
{
|
||||
/**
|
||||
* The charset.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_charset;
|
||||
|
||||
/**
|
||||
* The collation, or FALSE if no collation.
|
||||
*
|
||||
* @var string|boolean
|
||||
*/
|
||||
private $_collation;
|
||||
|
||||
/**
|
||||
* Configure Charset and Collation options of MySQL Client for each Connection.
|
||||
*
|
||||
* @param string $charset The charset.
|
||||
* @param string|boolean $collation The collation, or FALSE if no collation.
|
||||
*/
|
||||
public function __construct($charset = 'utf8', $collation = false)
|
||||
{
|
||||
$this->_charset = $charset;
|
||||
$this->_collation = $collation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Doctrine\DBAL\Event\ConnectionEventArgs $args
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function postConnect(ConnectionEventArgs $args)
|
||||
{
|
||||
$collation = ($this->_collation) ? " COLLATE ".$this->_collation : "";
|
||||
$args->getConnection()->executeUpdate("SET NAMES ".$this->_charset . $collation);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSubscribedEvents()
|
||||
{
|
||||
return array(Events::postConnect);
|
||||
}
|
||||
}
|
||||
86
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php
vendored
Normal file
86
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Event\Listeners;
|
||||
|
||||
use Doctrine\DBAL\Event\ConnectionEventArgs;
|
||||
use Doctrine\DBAL\Events;
|
||||
use Doctrine\Common\EventSubscriber;
|
||||
|
||||
/**
|
||||
* Should be used when Oracle Server default environment does not match the Doctrine requirements.
|
||||
*
|
||||
* The following environment variables are required for the Doctrine default date format:
|
||||
*
|
||||
* NLS_TIME_FORMAT="HH24:MI:SS"
|
||||
* NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
|
||||
* NLS_TIMESTAMP_FORMAT="YYYY-MM-DD HH24:MI:SS"
|
||||
* NLS_TIMESTAMP_TZ_FORMAT="YYYY-MM-DD HH24:MI:SS TZH:TZM"
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class OracleSessionInit implements EventSubscriber
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_defaultSessionVars = array(
|
||||
'NLS_TIME_FORMAT' => "HH24:MI:SS",
|
||||
'NLS_DATE_FORMAT' => "YYYY-MM-DD HH24:MI:SS",
|
||||
'NLS_TIMESTAMP_FORMAT' => "YYYY-MM-DD HH24:MI:SS",
|
||||
'NLS_TIMESTAMP_TZ_FORMAT' => "YYYY-MM-DD HH24:MI:SS TZH:TZM",
|
||||
'NLS_NUMERIC_CHARACTERS' => ".,",
|
||||
);
|
||||
|
||||
/**
|
||||
* @param array $oracleSessionVars
|
||||
*/
|
||||
public function __construct(array $oracleSessionVars = array())
|
||||
{
|
||||
$this->_defaultSessionVars = array_merge($this->_defaultSessionVars, $oracleSessionVars);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Doctrine\DBAL\Event\ConnectionEventArgs $args
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function postConnect(ConnectionEventArgs $args)
|
||||
{
|
||||
if (count($this->_defaultSessionVars)) {
|
||||
array_change_key_case($this->_defaultSessionVars, \CASE_UPPER);
|
||||
$vars = array();
|
||||
foreach ($this->_defaultSessionVars as $option => $value) {
|
||||
$vars[] = $option." = '".$value."'";
|
||||
}
|
||||
$sql = "ALTER SESSION SET ".implode(" ", $vars);
|
||||
$args->getConnection()->executeUpdate($sql);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSubscribedEvents()
|
||||
{
|
||||
return array(Events::postConnect);
|
||||
}
|
||||
}
|
||||
66
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/Listeners/SQLSessionInit.php
vendored
Normal file
66
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/Listeners/SQLSessionInit.php
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Event\Listeners;
|
||||
|
||||
use Doctrine\DBAL\Event\ConnectionEventArgs;
|
||||
use Doctrine\DBAL\Events;
|
||||
use Doctrine\Common\EventSubscriber;
|
||||
|
||||
/**
|
||||
* Session init listener for executing a single SQL statement right after a connection is opened.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.2
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class SQLSessionInit implements EventSubscriber
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $sql;
|
||||
|
||||
/**
|
||||
* @param string $sql
|
||||
*/
|
||||
public function __construct($sql)
|
||||
{
|
||||
$this->sql = $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Doctrine\DBAL\Event\ConnectionEventArgs $args
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function postConnect(ConnectionEventArgs $args)
|
||||
{
|
||||
$conn = $args->getConnection();
|
||||
$conn->exec($this->sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSubscribedEvents()
|
||||
{
|
||||
return array(Events::postConnect);
|
||||
}
|
||||
}
|
||||
114
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableAddColumnEventArgs.php
vendored
Normal file
114
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableAddColumnEventArgs.php
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Event;
|
||||
|
||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
use Doctrine\DBAL\Schema\Column;
|
||||
use Doctrine\DBAL\Schema\TableDiff;
|
||||
|
||||
/**
|
||||
* Event Arguments used when SQL queries for adding table columns are generated inside Doctrine\DBAL\Platform\*Platform.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.2
|
||||
* @author Jan Sorgalla <jsorgalla@googlemail.com>
|
||||
*/
|
||||
class SchemaAlterTableAddColumnEventArgs extends SchemaEventArgs
|
||||
{
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Schema\Column
|
||||
*/
|
||||
private $_column;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Schema\TableDiff
|
||||
*/
|
||||
private $_tableDiff;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Platforms\AbstractPlatform
|
||||
*/
|
||||
private $_platform;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $_sql = array();
|
||||
|
||||
/**
|
||||
* @param \Doctrine\DBAL\Schema\Column $column
|
||||
* @param \Doctrine\DBAL\Schema\TableDiff $tableDiff
|
||||
* @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
|
||||
*/
|
||||
public function __construct(Column $column, TableDiff $tableDiff, AbstractPlatform $platform)
|
||||
{
|
||||
$this->_column = $column;
|
||||
$this->_tableDiff = $tableDiff;
|
||||
$this->_platform = $platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Schema\Column
|
||||
*/
|
||||
public function getColumn()
|
||||
{
|
||||
return $this->_column;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Schema\TableDiff
|
||||
*/
|
||||
public function getTableDiff()
|
||||
{
|
||||
return $this->_tableDiff;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Platforms\AbstractPlatform
|
||||
*/
|
||||
public function getPlatform()
|
||||
{
|
||||
return $this->_platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|array $sql
|
||||
*
|
||||
* @return \Doctrine\DBAL\Event\SchemaAlterTableAddColumnEventArgs
|
||||
*/
|
||||
public function addSql($sql)
|
||||
{
|
||||
if (is_array($sql)) {
|
||||
$this->_sql = array_merge($this->_sql, $sql);
|
||||
} else {
|
||||
$this->_sql[] = $sql;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getSql()
|
||||
{
|
||||
return $this->_sql;
|
||||
}
|
||||
}
|
||||
114
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableChangeColumnEventArgs.php
vendored
Normal file
114
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableChangeColumnEventArgs.php
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Event;
|
||||
|
||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
use Doctrine\DBAL\Schema\ColumnDiff;
|
||||
use Doctrine\DBAL\Schema\TableDiff;
|
||||
|
||||
/**
|
||||
* Event Arguments used when SQL queries for changing table columns are generated inside Doctrine\DBAL\Platform\*Platform.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.2
|
||||
* @author Jan Sorgalla <jsorgalla@googlemail.com>
|
||||
*/
|
||||
class SchemaAlterTableChangeColumnEventArgs extends SchemaEventArgs
|
||||
{
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Schema\ColumnDiff
|
||||
*/
|
||||
private $_columnDiff;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Schema\TableDiff
|
||||
*/
|
||||
private $_tableDiff;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Platforms\AbstractPlatform
|
||||
*/
|
||||
private $_platform;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $_sql = array();
|
||||
|
||||
/**
|
||||
* @param \Doctrine\DBAL\Schema\ColumnDiff $columnDiff
|
||||
* @param \Doctrine\DBAL\Schema\TableDiff $tableDiff
|
||||
* @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
|
||||
*/
|
||||
public function __construct(ColumnDiff $columnDiff, TableDiff $tableDiff, AbstractPlatform $platform)
|
||||
{
|
||||
$this->_columnDiff = $columnDiff;
|
||||
$this->_tableDiff = $tableDiff;
|
||||
$this->_platform = $platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Schema\ColumnDiff
|
||||
*/
|
||||
public function getColumnDiff()
|
||||
{
|
||||
return $this->_columnDiff;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Schema\TableDiff
|
||||
*/
|
||||
public function getTableDiff()
|
||||
{
|
||||
return $this->_tableDiff;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Platforms\AbstractPlatform
|
||||
*/
|
||||
public function getPlatform()
|
||||
{
|
||||
return $this->_platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|array $sql
|
||||
*
|
||||
* @return \Doctrine\DBAL\Event\SchemaAlterTableChangeColumnEventArgs
|
||||
*/
|
||||
public function addSql($sql)
|
||||
{
|
||||
if (is_array($sql)) {
|
||||
$this->_sql = array_merge($this->_sql, $sql);
|
||||
} else {
|
||||
$this->_sql[] = $sql;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getSql()
|
||||
{
|
||||
return $this->_sql;
|
||||
}
|
||||
}
|
||||
98
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableEventArgs.php
vendored
Normal file
98
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableEventArgs.php
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Event;
|
||||
|
||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
use Doctrine\DBAL\Schema\TableDiff;
|
||||
|
||||
/**
|
||||
* Event Arguments used when SQL queries for creating tables are generated inside Doctrine\DBAL\Platform\*Platform.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.2
|
||||
* @author Jan Sorgalla <jsorgalla@googlemail.com>
|
||||
*/
|
||||
class SchemaAlterTableEventArgs extends SchemaEventArgs
|
||||
{
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Schema\TableDiff
|
||||
*/
|
||||
private $_tableDiff;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Platforms\AbstractPlatform
|
||||
*/
|
||||
private $_platform;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $_sql = array();
|
||||
|
||||
/**
|
||||
* @param \Doctrine\DBAL\Schema\TableDiff $tableDiff
|
||||
* @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
|
||||
*/
|
||||
public function __construct(TableDiff $tableDiff, AbstractPlatform $platform)
|
||||
{
|
||||
$this->_tableDiff = $tableDiff;
|
||||
$this->_platform = $platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Schema\TableDiff
|
||||
*/
|
||||
public function getTableDiff()
|
||||
{
|
||||
return $this->_tableDiff;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Platforms\AbstractPlatform
|
||||
*/
|
||||
public function getPlatform()
|
||||
{
|
||||
return $this->_platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|array $sql
|
||||
*
|
||||
* @return \Doctrine\DBAL\Event\SchemaAlterTableEventArgs
|
||||
*/
|
||||
public function addSql($sql)
|
||||
{
|
||||
if (is_array($sql)) {
|
||||
$this->_sql = array_merge($this->_sql, $sql);
|
||||
} else {
|
||||
$this->_sql[] = $sql;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getSql()
|
||||
{
|
||||
return $this->_sql;
|
||||
}
|
||||
}
|
||||
114
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableRemoveColumnEventArgs.php
vendored
Normal file
114
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableRemoveColumnEventArgs.php
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Event;
|
||||
|
||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
use Doctrine\DBAL\Schema\Column;
|
||||
use Doctrine\DBAL\Schema\TableDiff;
|
||||
|
||||
/**
|
||||
* Event Arguments used when SQL queries for removing table columns are generated inside Doctrine\DBAL\Platform\*Platform.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.2
|
||||
* @author Jan Sorgalla <jsorgalla@googlemail.com>
|
||||
*/
|
||||
class SchemaAlterTableRemoveColumnEventArgs extends SchemaEventArgs
|
||||
{
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Schema\Column
|
||||
*/
|
||||
private $_column;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Schema\TableDiff
|
||||
*/
|
||||
private $_tableDiff;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Platforms\AbstractPlatform
|
||||
*/
|
||||
private $_platform;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $_sql = array();
|
||||
|
||||
/**
|
||||
* @param \Doctrine\DBAL\Schema\Column $column
|
||||
* @param \Doctrine\DBAL\Schema\TableDiff $tableDiff
|
||||
* @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
|
||||
*/
|
||||
public function __construct(Column $column, TableDiff $tableDiff, AbstractPlatform $platform)
|
||||
{
|
||||
$this->_column = $column;
|
||||
$this->_tableDiff = $tableDiff;
|
||||
$this->_platform = $platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Schema\Column
|
||||
*/
|
||||
public function getColumn()
|
||||
{
|
||||
return $this->_column;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Schema\TableDiff
|
||||
*/
|
||||
public function getTableDiff()
|
||||
{
|
||||
return $this->_tableDiff;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Platforms\AbstractPlatform
|
||||
*/
|
||||
public function getPlatform()
|
||||
{
|
||||
return $this->_platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|array $sql
|
||||
*
|
||||
* @return \Doctrine\DBAL\Event\SchemaAlterTableRemoveColumnEventArgs
|
||||
*/
|
||||
public function addSql($sql)
|
||||
{
|
||||
if (is_array($sql)) {
|
||||
$this->_sql = array_merge($this->_sql, $sql);
|
||||
} else {
|
||||
$this->_sql[] = $sql;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getSql()
|
||||
{
|
||||
return $this->_sql;
|
||||
}
|
||||
}
|
||||
129
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableRenameColumnEventArgs.php
vendored
Normal file
129
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaAlterTableRenameColumnEventArgs.php
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Event;
|
||||
|
||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
use Doctrine\DBAL\Schema\Column;
|
||||
use Doctrine\DBAL\Schema\TableDiff;
|
||||
|
||||
/**
|
||||
* Event Arguments used when SQL queries for renaming table columns are generated inside Doctrine\DBAL\Platform\*Platform.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.2
|
||||
* @author Jan Sorgalla <jsorgalla@googlemail.com>
|
||||
*/
|
||||
class SchemaAlterTableRenameColumnEventArgs extends SchemaEventArgs
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $_oldColumnName;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Schema\Column
|
||||
*/
|
||||
private $_column;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Schema\TableDiff
|
||||
*/
|
||||
private $_tableDiff;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Platforms\AbstractPlatform
|
||||
*/
|
||||
private $_platform;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $_sql = array();
|
||||
|
||||
/**
|
||||
* @param string $oldColumnName
|
||||
* @param \Doctrine\DBAL\Schema\Column $column
|
||||
* @param \Doctrine\DBAL\Schema\TableDiff $tableDiff
|
||||
* @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
|
||||
*/
|
||||
public function __construct($oldColumnName, Column $column, TableDiff $tableDiff, AbstractPlatform $platform)
|
||||
{
|
||||
$this->_oldColumnName = $oldColumnName;
|
||||
$this->_column = $column;
|
||||
$this->_tableDiff = $tableDiff;
|
||||
$this->_platform = $platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getOldColumnName()
|
||||
{
|
||||
return $this->_oldColumnName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Schema\Column
|
||||
*/
|
||||
public function getColumn()
|
||||
{
|
||||
return $this->_column;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Schema\TableDiff
|
||||
*/
|
||||
public function getTableDiff()
|
||||
{
|
||||
return $this->_tableDiff;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Platforms\AbstractPlatform
|
||||
*/
|
||||
public function getPlatform()
|
||||
{
|
||||
return $this->_platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|array $sql
|
||||
*
|
||||
* @return \Doctrine\DBAL\Event\SchemaAlterTableRenameColumnEventArgs
|
||||
*/
|
||||
public function addSql($sql)
|
||||
{
|
||||
if (is_array($sql)) {
|
||||
$this->_sql = array_merge($this->_sql, $sql);
|
||||
} else {
|
||||
$this->_sql[] = $sql;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getSql()
|
||||
{
|
||||
return $this->_sql;
|
||||
}
|
||||
}
|
||||
137
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaColumnDefinitionEventArgs.php
vendored
Normal file
137
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaColumnDefinitionEventArgs.php
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Event;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Doctrine\DBAL\Schema\Column;
|
||||
|
||||
/**
|
||||
* Event Arguments used when the portable column definition is generated inside Doctrine\DBAL\Schema\AbstractSchemaManager.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.2
|
||||
* @author Jan Sorgalla <jsorgalla@googlemail.com>
|
||||
*/
|
||||
class SchemaColumnDefinitionEventArgs extends SchemaEventArgs
|
||||
{
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Schema\Column|null
|
||||
*/
|
||||
private $_column = null;
|
||||
|
||||
/**
|
||||
* Raw column data as fetched from the database.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_tableColumn;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $_table;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $_database;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Connection
|
||||
*/
|
||||
private $_connection;
|
||||
|
||||
/**
|
||||
* @param array $tableColumn
|
||||
* @param string $table
|
||||
* @param string $database
|
||||
* @param \Doctrine\DBAL\Connection $connection
|
||||
*/
|
||||
public function __construct(array $tableColumn, $table, $database, Connection $connection)
|
||||
{
|
||||
$this->_tableColumn = $tableColumn;
|
||||
$this->_table = $table;
|
||||
$this->_database = $database;
|
||||
$this->_connection = $connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows to clear the column which means the column will be excluded from
|
||||
* tables column list.
|
||||
*
|
||||
* @param null|\Doctrine\DBAL\Schema\Column $column
|
||||
*
|
||||
* @return \Doctrine\DBAL\Event\SchemaColumnDefinitionEventArgs
|
||||
*/
|
||||
public function setColumn(Column $column = null)
|
||||
{
|
||||
$this->_column = $column;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Schema\Column|null
|
||||
*/
|
||||
public function getColumn()
|
||||
{
|
||||
return $this->_column;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTableColumn()
|
||||
{
|
||||
return $this->_tableColumn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTable()
|
||||
{
|
||||
return $this->_table;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDatabase()
|
||||
{
|
||||
return $this->_database;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Connection
|
||||
*/
|
||||
public function getConnection()
|
||||
{
|
||||
return $this->_connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Platforms\AbstractPlatform
|
||||
*/
|
||||
public function getDatabasePlatform()
|
||||
{
|
||||
return $this->_connection->getDatabasePlatform();
|
||||
}
|
||||
}
|
||||
114
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaCreateTableColumnEventArgs.php
vendored
Normal file
114
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaCreateTableColumnEventArgs.php
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Event;
|
||||
|
||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
use Doctrine\DBAL\Schema\Column;
|
||||
use Doctrine\DBAL\Schema\Table;
|
||||
|
||||
/**
|
||||
* Event Arguments used when SQL queries for creating table columns are generated inside Doctrine\DBAL\Platform\AbstractPlatform.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.2
|
||||
* @author Jan Sorgalla <jsorgalla@googlemail.com>
|
||||
*/
|
||||
class SchemaCreateTableColumnEventArgs extends SchemaEventArgs
|
||||
{
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Schema\Column
|
||||
*/
|
||||
private $_column;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Schema\Table
|
||||
*/
|
||||
private $_table;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Platforms\AbstractPlatform
|
||||
*/
|
||||
private $_platform;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $_sql = array();
|
||||
|
||||
/**
|
||||
* @param \Doctrine\DBAL\Schema\Column $column
|
||||
* @param \Doctrine\DBAL\Schema\Table $table
|
||||
* @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
|
||||
*/
|
||||
public function __construct(Column $column, Table $table, AbstractPlatform $platform)
|
||||
{
|
||||
$this->_column = $column;
|
||||
$this->_table = $table;
|
||||
$this->_platform = $platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Schema\Column
|
||||
*/
|
||||
public function getColumn()
|
||||
{
|
||||
return $this->_column;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Schema\Table
|
||||
*/
|
||||
public function getTable()
|
||||
{
|
||||
return $this->_table;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Platforms\AbstractPlatform
|
||||
*/
|
||||
public function getPlatform()
|
||||
{
|
||||
return $this->_platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|array $sql
|
||||
*
|
||||
* @return \Doctrine\DBAL\Event\SchemaCreateTableColumnEventArgs
|
||||
*/
|
||||
public function addSql($sql)
|
||||
{
|
||||
if (is_array($sql)) {
|
||||
$this->_sql = array_merge($this->_sql, $sql);
|
||||
} else {
|
||||
$this->_sql[] = $sql;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getSql()
|
||||
{
|
||||
return $this->_sql;
|
||||
}
|
||||
}
|
||||
128
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaCreateTableEventArgs.php
vendored
Normal file
128
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaCreateTableEventArgs.php
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Event;
|
||||
|
||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
use Doctrine\DBAL\Schema\Table;
|
||||
|
||||
/**
|
||||
* Event Arguments used when SQL queries for creating tables are generated inside Doctrine\DBAL\Platform\AbstractPlatform.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.2
|
||||
* @author Jan Sorgalla <jsorgalla@googlemail.com>
|
||||
*/
|
||||
class SchemaCreateTableEventArgs extends SchemaEventArgs
|
||||
{
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Schema\Table
|
||||
*/
|
||||
private $_table;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $_columns;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $_options;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Platforms\AbstractPlatform
|
||||
*/
|
||||
private $_platform;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $_sql = array();
|
||||
|
||||
/**
|
||||
* @param \Doctrine\DBAL\Schema\Table $table
|
||||
* @param array $columns
|
||||
* @param array $options
|
||||
* @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
|
||||
*/
|
||||
public function __construct(Table $table, array $columns, array $options, AbstractPlatform $platform)
|
||||
{
|
||||
$this->_table = $table;
|
||||
$this->_columns = $columns;
|
||||
$this->_options = $options;
|
||||
$this->_platform = $platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Schema\Table
|
||||
*/
|
||||
public function getTable()
|
||||
{
|
||||
return $this->_table;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getColumns()
|
||||
{
|
||||
return $this->_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
return $this->_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Platforms\AbstractPlatform
|
||||
*/
|
||||
public function getPlatform()
|
||||
{
|
||||
return $this->_platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|array $sql
|
||||
*
|
||||
* @return \Doctrine\DBAL\Event\SchemaCreateTableEventArgs
|
||||
*/
|
||||
public function addSql($sql)
|
||||
{
|
||||
if (is_array($sql)) {
|
||||
$this->_sql = array_merge($this->_sql, $sql);
|
||||
} else {
|
||||
$this->_sql[] = $sql;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getSql()
|
||||
{
|
||||
return $this->_sql;
|
||||
}
|
||||
}
|
||||
100
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaDropTableEventArgs.php
vendored
Normal file
100
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaDropTableEventArgs.php
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Event;
|
||||
|
||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
use Doctrine\DBAL\Schema\Table;
|
||||
|
||||
/**
|
||||
* Event Arguments used when the SQL query for dropping tables are generated inside Doctrine\DBAL\Platform\AbstractPlatform.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.2
|
||||
* @author Jan Sorgalla <jsorgalla@googlemail.com>
|
||||
*/
|
||||
class SchemaDropTableEventArgs extends SchemaEventArgs
|
||||
{
|
||||
/**
|
||||
* @var string|\Doctrine\DBAL\Schema\Table
|
||||
*/
|
||||
private $_table;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Platforms\AbstractPlatform
|
||||
*/
|
||||
private $_platform;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
private $_sql = null;
|
||||
|
||||
/**
|
||||
* @param string|\Doctrine\DBAL\Schema\Table $table
|
||||
* @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function __construct($table, AbstractPlatform $platform)
|
||||
{
|
||||
if ( ! $table instanceof Table && !is_string($table)) {
|
||||
throw new \InvalidArgumentException('SchemaCreateTableEventArgs expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.');
|
||||
}
|
||||
|
||||
$this->_table = $table;
|
||||
$this->_platform = $platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|\Doctrine\DBAL\Schema\Table
|
||||
*/
|
||||
public function getTable()
|
||||
{
|
||||
return $this->_table;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Platforms\AbstractPlatform
|
||||
*/
|
||||
public function getPlatform()
|
||||
{
|
||||
return $this->_platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sql
|
||||
*
|
||||
* @return \Doctrine\DBAL\Event\SchemaDropTableEventArgs
|
||||
*/
|
||||
public function setSql($sql)
|
||||
{
|
||||
$this->_sql = $sql;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getSql()
|
||||
{
|
||||
return $this->_sql;
|
||||
}
|
||||
}
|
||||
55
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaEventArgs.php
vendored
Normal file
55
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaEventArgs.php
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Event;
|
||||
|
||||
use Doctrine\Common\EventArgs;
|
||||
|
||||
/**
|
||||
* Base class for schema related events.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.2
|
||||
* @author Jan Sorgalla <jsorgalla@googlemail.com>
|
||||
*/
|
||||
class SchemaEventArgs extends EventArgs
|
||||
{
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
private $_preventDefault = false;
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Event\SchemaEventArgs
|
||||
*/
|
||||
public function preventDefault()
|
||||
{
|
||||
$this->_preventDefault = true;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public function isDefaultPrevented()
|
||||
{
|
||||
return $this->_preventDefault;
|
||||
}
|
||||
}
|
||||
121
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaIndexDefinitionEventArgs.php
vendored
Normal file
121
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/SchemaIndexDefinitionEventArgs.php
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Event;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Doctrine\DBAL\Schema\Index;
|
||||
|
||||
/**
|
||||
* Event Arguments used when the portable index definition is generated inside Doctrine\DBAL\Schema\AbstractSchemaManager.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.2
|
||||
* @author Jan Sorgalla <jsorgalla@googlemail.com>
|
||||
*/
|
||||
class SchemaIndexDefinitionEventArgs extends SchemaEventArgs
|
||||
{
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Schema\Index|null
|
||||
*/
|
||||
private $_index = null;
|
||||
|
||||
/**
|
||||
* Raw index data as fetched from the database.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_tableIndex;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $_table;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Connection
|
||||
*/
|
||||
private $_connection;
|
||||
|
||||
/**
|
||||
* @param array $tableIndex
|
||||
* @param string $table
|
||||
* @param \Doctrine\DBAL\Connection $connection
|
||||
*/
|
||||
public function __construct(array $tableIndex, $table, Connection $connection)
|
||||
{
|
||||
$this->_tableIndex = $tableIndex;
|
||||
$this->_table = $table;
|
||||
$this->_connection = $connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows to clear the index which means the index will be excluded from tables index list.
|
||||
*
|
||||
* @param null|\Doctrine\DBAL\Schema\Index $index
|
||||
*
|
||||
* @return SchemaIndexDefinitionEventArgs
|
||||
*/
|
||||
public function setIndex(Index $index = null)
|
||||
{
|
||||
$this->_index = $index;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Schema\Index|null
|
||||
*/
|
||||
public function getIndex()
|
||||
{
|
||||
return $this->_index;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTableIndex()
|
||||
{
|
||||
return $this->_tableIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTable()
|
||||
{
|
||||
return $this->_table;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Connection
|
||||
*/
|
||||
public function getConnection()
|
||||
{
|
||||
return $this->_connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Doctrine\DBAL\Platforms\AbstractPlatform
|
||||
*/
|
||||
public function getDatabasePlatform()
|
||||
{
|
||||
return $this->_connection->getDatabasePlatform();
|
||||
}
|
||||
}
|
||||
51
vendor/doctrine/dbal/lib/Doctrine/DBAL/Events.php
vendored
Normal file
51
vendor/doctrine/dbal/lib/Doctrine/DBAL/Events.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL;
|
||||
|
||||
/**
|
||||
* Container for all DBAL events.
|
||||
*
|
||||
* This class cannot be instantiated.
|
||||
*
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @since 2.0
|
||||
*/
|
||||
final class Events
|
||||
{
|
||||
/**
|
||||
* Private constructor. This class cannot be instantiated.
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
const postConnect = 'postConnect';
|
||||
|
||||
const onSchemaCreateTable = 'onSchemaCreateTable';
|
||||
const onSchemaCreateTableColumn = 'onSchemaCreateTableColumn';
|
||||
const onSchemaDropTable = 'onSchemaDropTable';
|
||||
const onSchemaAlterTable = 'onSchemaAlterTable';
|
||||
const onSchemaAlterTableAddColumn = 'onSchemaAlterTableAddColumn';
|
||||
const onSchemaAlterTableRemoveColumn = 'onSchemaAlterTableRemoveColumn';
|
||||
const onSchemaAlterTableChangeColumn = 'onSchemaAlterTableChangeColumn';
|
||||
const onSchemaAlterTableRenameColumn = 'onSchemaAlterTableRenameColumn';
|
||||
const onSchemaColumnDefinition = 'onSchemaColumnDefinition';
|
||||
const onSchemaIndexDefinition = 'onSchemaIndexDefinition';
|
||||
}
|
||||
165
vendor/doctrine/dbal/lib/Doctrine/DBAL/Id/TableGenerator.php
vendored
Normal file
165
vendor/doctrine/dbal/lib/Doctrine/DBAL/Id/TableGenerator.php
vendored
Normal file
@@ -0,0 +1,165 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Id;
|
||||
|
||||
use Doctrine\DBAL\DriverManager;
|
||||
use Doctrine\DBAL\Connection;
|
||||
|
||||
/**
|
||||
* Table ID Generator for those poor languages that are missing sequences.
|
||||
*
|
||||
* WARNING: The Table Id Generator clones a second independent database
|
||||
* connection to work correctly. This means using the generator requests that
|
||||
* generate IDs will have two open database connections. This is necessary to
|
||||
* be safe from transaction failures in the main connection. Make sure to only
|
||||
* ever use one TableGenerator otherwise you end up with many connections.
|
||||
*
|
||||
* TableID Generator does not work with SQLite.
|
||||
*
|
||||
* The TableGenerator does not take care of creating the SQL Table itself. You
|
||||
* should look at the `TableGeneratorSchemaVisitor` to do this for you.
|
||||
* Otherwise the schema for a table looks like:
|
||||
*
|
||||
* CREATE sequences (
|
||||
* sequence_name VARCHAR(255) NOT NULL,
|
||||
* sequence_value INT NOT NULL DEFAULT '1',
|
||||
* sequence_increment_by INT NOT NULL DEFAULT '1',
|
||||
* PRIMARY KEY (table_name)
|
||||
* );
|
||||
*
|
||||
* Technically this generator works as follows:
|
||||
*
|
||||
* 1. Use a robust transaction serialization level.
|
||||
* 2. Open transaction
|
||||
* 3. Acquire a read lock on the table row (SELECT .. FOR UPDATE)
|
||||
* 4. Increment current value by one and write back to database
|
||||
* 5. Commit transaction
|
||||
*
|
||||
* If you are using a sequence_increment_by value that is larger than one the
|
||||
* ID Generator will keep incrementing values until it hits the incrementation
|
||||
* gap before issuing another query.
|
||||
*
|
||||
* If no row is present for a given sequence a new one will be created with the
|
||||
* default values 'value' = 1 and 'increment_by' = 1
|
||||
*
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class TableGenerator
|
||||
{
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Connection
|
||||
*/
|
||||
private $conn;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $generatorTableName;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $sequences = array();
|
||||
|
||||
/**
|
||||
* @param \Doctrine\DBAL\Connection $conn
|
||||
* @param string $generatorTableName
|
||||
*
|
||||
* @throws \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
public function __construct(Connection $conn, $generatorTableName = 'sequences')
|
||||
{
|
||||
$params = $conn->getParams();
|
||||
if ($params['driver'] == 'pdo_sqlite') {
|
||||
throw new \Doctrine\DBAL\DBALException("Cannot use TableGenerator with SQLite.");
|
||||
}
|
||||
$this->conn = DriverManager::getConnection($params, $conn->getConfiguration(), $conn->getEventManager());
|
||||
$this->generatorTableName = $generatorTableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the next unused value for the given sequence name.
|
||||
*
|
||||
* @param string $sequenceName
|
||||
*
|
||||
* @return integer
|
||||
*
|
||||
* @throws \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
public function nextValue($sequenceName)
|
||||
{
|
||||
if (isset($this->sequences[$sequenceName])) {
|
||||
$value = $this->sequences[$sequenceName]['value'];
|
||||
$this->sequences[$sequenceName]['value']++;
|
||||
if ($this->sequences[$sequenceName]['value'] >= $this->sequences[$sequenceName]['max']) {
|
||||
unset ($this->sequences[$sequenceName]);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
$this->conn->beginTransaction();
|
||||
|
||||
try {
|
||||
$platform = $this->conn->getDatabasePlatform();
|
||||
$sql = "SELECT sequence_value, sequence_increment_by " .
|
||||
"FROM " . $platform->appendLockHint($this->generatorTableName, \Doctrine\DBAL\LockMode::PESSIMISTIC_WRITE) . " " .
|
||||
"WHERE sequence_name = ? " . $platform->getWriteLockSQL();
|
||||
$stmt = $this->conn->executeQuery($sql, array($sequenceName));
|
||||
|
||||
if ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$row = array_change_key_case($row, CASE_LOWER);
|
||||
|
||||
$value = $row['sequence_value'];
|
||||
$value++;
|
||||
|
||||
if ($row['sequence_increment_by'] > 1) {
|
||||
$this->sequences[$sequenceName] = array(
|
||||
'value' => $value,
|
||||
'max' => $row['sequence_value'] + $row['sequence_increment_by']
|
||||
);
|
||||
}
|
||||
|
||||
$sql = "UPDATE " . $this->generatorTableName . " ".
|
||||
"SET sequence_value = sequence_value + sequence_increment_by " .
|
||||
"WHERE sequence_name = ? AND sequence_value = ?";
|
||||
$rows = $this->conn->executeUpdate($sql, array($sequenceName, $row['sequence_value']));
|
||||
|
||||
if ($rows != 1) {
|
||||
throw new \Doctrine\DBAL\DBALException("Race-condition detected while updating sequence. Aborting generation");
|
||||
}
|
||||
} else {
|
||||
$this->conn->insert(
|
||||
$this->generatorTableName,
|
||||
array('sequence_name' => $sequenceName, 'sequence_value' => 1, 'sequence_increment_by' => 1)
|
||||
);
|
||||
$value = 1;
|
||||
}
|
||||
|
||||
$this->conn->commit();
|
||||
|
||||
} catch(\Exception $e) {
|
||||
$this->conn->rollback();
|
||||
throw new \Doctrine\DBAL\DBALException("Error occurred while generating ID with TableGenerator, aborted generation: " . $e->getMessage(), 0, $e);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
89
vendor/doctrine/dbal/lib/Doctrine/DBAL/Id/TableGeneratorSchemaVisitor.php
vendored
Normal file
89
vendor/doctrine/dbal/lib/Doctrine/DBAL/Id/TableGeneratorSchemaVisitor.php
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Id;
|
||||
|
||||
use Doctrine\DBAL\Schema\Table;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\DBAL\Schema\Column;
|
||||
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
|
||||
use Doctrine\DBAL\Schema\Sequence;
|
||||
use Doctrine\DBAL\Schema\Index;
|
||||
|
||||
class TableGeneratorSchemaVisitor implements \Doctrine\DBAL\Schema\Visitor\Visitor
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $generatorTableName;
|
||||
|
||||
/**
|
||||
* @param string $generatorTableName
|
||||
*/
|
||||
public function __construct($generatorTableName = 'sequences')
|
||||
{
|
||||
$this->generatorTableName = $generatorTableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function acceptSchema(Schema $schema)
|
||||
{
|
||||
$table = $schema->createTable($this->generatorTableName);
|
||||
$table->addColumn('sequence_name', 'string');
|
||||
$table->addColumn('sequence_value', 'integer', array('default' => 1));
|
||||
$table->addColumn('sequence_increment_by', 'integer', array('default' => 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function acceptTable(Table $table)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function acceptColumn(Table $table, Column $column)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function acceptIndex(Table $table, Index $index)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function acceptSequence(Sequence $sequence)
|
||||
{
|
||||
}
|
||||
}
|
||||
43
vendor/doctrine/dbal/lib/Doctrine/DBAL/LockMode.php
vendored
Normal file
43
vendor/doctrine/dbal/lib/Doctrine/DBAL/LockMode.php
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL;
|
||||
|
||||
/**
|
||||
* Contains all DBAL LockModes.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 1.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class LockMode
|
||||
{
|
||||
const NONE = 0;
|
||||
const OPTIMISTIC = 1;
|
||||
const PESSIMISTIC_READ = 2;
|
||||
const PESSIMISTIC_WRITE = 4;
|
||||
|
||||
/**
|
||||
* Private constructor. This class cannot be instantiated.
|
||||
*/
|
||||
final private function __construct()
|
||||
{
|
||||
}
|
||||
}
|
||||
78
vendor/doctrine/dbal/lib/Doctrine/DBAL/Logging/DebugStack.php
vendored
Normal file
78
vendor/doctrine/dbal/lib/Doctrine/DBAL/Logging/DebugStack.php
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Logging;
|
||||
|
||||
/**
|
||||
* Includes executed SQLs in a Debug Stack.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class DebugStack implements SQLLogger
|
||||
{
|
||||
/**
|
||||
* Executed SQL queries.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $queries = array();
|
||||
|
||||
/**
|
||||
* If Debug Stack is enabled (log queries) or not.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
public $enabled = true;
|
||||
|
||||
/**
|
||||
* @var float|null
|
||||
*/
|
||||
public $start = null;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
public $currentQuery = 0;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function startQuery($sql, array $params = null, array $types = null)
|
||||
{
|
||||
if ($this->enabled) {
|
||||
$this->start = microtime(true);
|
||||
$this->queries[++$this->currentQuery] = array('sql' => $sql, 'params' => $params, 'types' => $types, 'executionMS' => 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function stopQuery()
|
||||
{
|
||||
if ($this->enabled) {
|
||||
$this->queries[$this->currentQuery]['executionMS'] = microtime(true) - $this->start;
|
||||
}
|
||||
}
|
||||
}
|
||||
56
vendor/doctrine/dbal/lib/Doctrine/DBAL/Logging/EchoSQLLogger.php
vendored
Normal file
56
vendor/doctrine/dbal/lib/Doctrine/DBAL/Logging/EchoSQLLogger.php
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Logging;
|
||||
|
||||
/**
|
||||
* A SQL logger that logs to the standard output using echo/var_dump.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
class EchoSQLLogger implements SQLLogger
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function startQuery($sql, array $params = null, array $types = null)
|
||||
{
|
||||
echo $sql . PHP_EOL;
|
||||
|
||||
if ($params) {
|
||||
var_dump($params);
|
||||
}
|
||||
|
||||
if ($types) {
|
||||
var_dump($types);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function stopQuery()
|
||||
{
|
||||
}
|
||||
}
|
||||
67
vendor/doctrine/dbal/lib/Doctrine/DBAL/Logging/LoggerChain.php
vendored
Normal file
67
vendor/doctrine/dbal/lib/Doctrine/DBAL/Logging/LoggerChain.php
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Logging;
|
||||
|
||||
/**
|
||||
* Chains multiple SQLLogger.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.2
|
||||
* @author Christophe Coevoet <stof@notk.org>
|
||||
*/
|
||||
class LoggerChain implements SQLLogger
|
||||
{
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Logging\SQLLogger[]
|
||||
*/
|
||||
private $loggers = array();
|
||||
|
||||
/**
|
||||
* Adds a logger in the chain.
|
||||
*
|
||||
* @param \Doctrine\DBAL\Logging\SQLLogger $logger
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addLogger(SQLLogger $logger)
|
||||
{
|
||||
$this->loggers[] = $logger;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function startQuery($sql, array $params = null, array $types = null)
|
||||
{
|
||||
foreach ($this->loggers as $logger) {
|
||||
$logger->startQuery($sql, $params, $types);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function stopQuery()
|
||||
{
|
||||
foreach ($this->loggers as $logger) {
|
||||
$logger->stopQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
51
vendor/doctrine/dbal/lib/Doctrine/DBAL/Logging/SQLLogger.php
vendored
Normal file
51
vendor/doctrine/dbal/lib/Doctrine/DBAL/Logging/SQLLogger.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Logging;
|
||||
|
||||
/**
|
||||
* Interface for SQL loggers.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Jonathan Wage <jonwage@gmail.com>
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
*/
|
||||
interface SQLLogger
|
||||
{
|
||||
/**
|
||||
* Logs a SQL statement somewhere.
|
||||
*
|
||||
* @param string $sql The SQL to be executed.
|
||||
* @param array|null $params The SQL parameters.
|
||||
* @param array|null $types The SQL parameter types.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function startQuery($sql, array $params = null, array $types = null);
|
||||
|
||||
/**
|
||||
* Marks the last started query as stopped. This can be used for timing of queries.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function stopQuery();
|
||||
}
|
||||
3079
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
vendored
Normal file
3079
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
580
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/DB2Platform.php
vendored
Normal file
580
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/DB2Platform.php
vendored
Normal file
@@ -0,0 +1,580 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Platforms;
|
||||
|
||||
use Doctrine\DBAL\DBALException;
|
||||
use Doctrine\DBAL\Schema\Index;
|
||||
use Doctrine\DBAL\Schema\TableDiff;
|
||||
|
||||
class DB2Platform extends AbstractPlatform
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getBlobTypeDeclarationSQL(array $field)
|
||||
{
|
||||
throw DBALException::notSupported(__METHOD__);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function initializeDoctrineTypeMappings()
|
||||
{
|
||||
$this->doctrineTypeMapping = array(
|
||||
'smallint' => 'smallint',
|
||||
'bigint' => 'bigint',
|
||||
'integer' => 'integer',
|
||||
'time' => 'time',
|
||||
'date' => 'date',
|
||||
'varchar' => 'string',
|
||||
'character' => 'string',
|
||||
'clob' => 'text',
|
||||
'decimal' => 'decimal',
|
||||
'double' => 'float',
|
||||
'real' => 'float',
|
||||
'timestamp' => 'datetime',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed)
|
||||
{
|
||||
return $fixed ? ($length ? 'CHAR(' . $length . ')' : 'CHAR(255)')
|
||||
: ($length ? 'VARCHAR(' . $length . ')' : 'VARCHAR(255)');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getClobTypeDeclarationSQL(array $field)
|
||||
{
|
||||
// todo clob(n) with $field['length'];
|
||||
return 'CLOB(1M)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'db2';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getBooleanTypeDeclarationSQL(array $columnDef)
|
||||
{
|
||||
return 'SMALLINT';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getIntegerTypeDeclarationSQL(array $columnDef)
|
||||
{
|
||||
return 'INTEGER' . $this->_getCommonIntegerTypeDeclarationSQL($columnDef);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getBigIntTypeDeclarationSQL(array $columnDef)
|
||||
{
|
||||
return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($columnDef);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSmallIntTypeDeclarationSQL(array $columnDef)
|
||||
{
|
||||
return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($columnDef);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef)
|
||||
{
|
||||
$autoinc = '';
|
||||
if ( ! empty($columnDef['autoincrement'])) {
|
||||
$autoinc = ' GENERATED BY DEFAULT AS IDENTITY';
|
||||
}
|
||||
|
||||
return $autoinc;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
|
||||
{
|
||||
if (isset($fieldDeclaration['version']) && $fieldDeclaration['version'] == true) {
|
||||
return "TIMESTAMP(0) WITH DEFAULT";
|
||||
}
|
||||
|
||||
return 'TIMESTAMP(0)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateTypeDeclarationSQL(array $fieldDeclaration)
|
||||
{
|
||||
return 'DATE';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
|
||||
{
|
||||
return 'TIME';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListDatabasesSQL()
|
||||
{
|
||||
throw DBALException::notSupported(__METHOD__);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListSequencesSQL($database)
|
||||
{
|
||||
throw DBALException::notSupported(__METHOD__);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListTableConstraintsSQL($table)
|
||||
{
|
||||
throw DBALException::notSupported(__METHOD__);
|
||||
}
|
||||
|
||||
/**
|
||||
* This code fragment is originally from the Zend_Db_Adapter_Db2 class.
|
||||
*
|
||||
* @license New BSD License
|
||||
*
|
||||
* @param string $table
|
||||
* @param string $database
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getListTableColumnsSQL($table, $database = null)
|
||||
{
|
||||
return "SELECT DISTINCT c.tabschema, c.tabname, c.colname, c.colno,
|
||||
c.typename, c.default, c.nulls, c.length, c.scale,
|
||||
c.identity, tc.type AS tabconsttype, k.colseq
|
||||
FROM syscat.columns c
|
||||
LEFT JOIN (syscat.keycoluse k JOIN syscat.tabconst tc
|
||||
ON (k.tabschema = tc.tabschema
|
||||
AND k.tabname = tc.tabname
|
||||
AND tc.type = 'P'))
|
||||
ON (c.tabschema = k.tabschema
|
||||
AND c.tabname = k.tabname
|
||||
AND c.colname = k.colname)
|
||||
WHERE UPPER(c.tabname) = UPPER('" . $table . "') ORDER BY c.colno";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListTablesSQL()
|
||||
{
|
||||
return "SELECT NAME FROM SYSIBM.SYSTABLES WHERE TYPE = 'T'";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListUsersSQL()
|
||||
{
|
||||
throw DBALException::notSupported(__METHOD__);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListViewsSQL($database)
|
||||
{
|
||||
return "SELECT NAME, TEXT FROM SYSIBM.SYSVIEWS";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListTableIndexesSQL($table, $currentDatabase = null)
|
||||
{
|
||||
return "SELECT NAME, COLNAMES, UNIQUERULE FROM SYSIBM.SYSINDEXES WHERE TBNAME = UPPER('" . $table . "')";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListTableForeignKeysSQL($table)
|
||||
{
|
||||
return "SELECT TBNAME, RELNAME, REFTBNAME, DELETERULE, UPDATERULE, FKCOLNAMES, PKCOLNAMES ".
|
||||
"FROM SYSIBM.SYSRELS WHERE TBNAME = UPPER('".$table."')";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getCreateViewSQL($name, $sql)
|
||||
{
|
||||
return "CREATE VIEW ".$name." AS ".$sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDropViewSQL($name)
|
||||
{
|
||||
return "DROP VIEW ".$name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDropSequenceSQL($sequence)
|
||||
{
|
||||
throw DBALException::notSupported(__METHOD__);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSequenceNextValSQL($sequenceName)
|
||||
{
|
||||
throw DBALException::notSupported(__METHOD__);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getCreateDatabaseSQL($database)
|
||||
{
|
||||
return "CREATE DATABASE ".$database;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDropDatabaseSQL($database)
|
||||
{
|
||||
return "DROP DATABASE ".$database.";";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function supportsCreateDropDatabase()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function supportsReleaseSavepoints()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getCurrentDateSQL()
|
||||
{
|
||||
return 'VALUES CURRENT DATE';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getCurrentTimeSQL()
|
||||
{
|
||||
return 'VALUES CURRENT TIME';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getCurrentTimestampSQL()
|
||||
{
|
||||
return "VALUES CURRENT TIMESTAMP";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getIndexDeclarationSQL($name, Index $index)
|
||||
{
|
||||
return $this->getUniqueConstraintDeclarationSQL($name, $index);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function _getCreateTableSQL($tableName, array $columns, array $options = array())
|
||||
{
|
||||
$indexes = array();
|
||||
if (isset($options['indexes'])) {
|
||||
$indexes = $options['indexes'];
|
||||
}
|
||||
$options['indexes'] = array();
|
||||
|
||||
$sqls = parent::_getCreateTableSQL($tableName, $columns, $options);
|
||||
|
||||
foreach ($indexes as $definition) {
|
||||
$sqls[] = $this->getCreateIndexSQL($definition, $tableName);
|
||||
}
|
||||
return $sqls;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getAlterTableSQL(TableDiff $diff)
|
||||
{
|
||||
$sql = array();
|
||||
$columnSql = array();
|
||||
|
||||
$queryParts = array();
|
||||
foreach ($diff->addedColumns as $column) {
|
||||
if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$queryParts[] = 'ADD COLUMN ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
|
||||
}
|
||||
|
||||
foreach ($diff->removedColumns as $column) {
|
||||
if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$queryParts[] = 'DROP COLUMN ' . $column->getQuotedName($this);
|
||||
}
|
||||
|
||||
foreach ($diff->changedColumns as $columnDiff) {
|
||||
if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* @var $columnDiff \Doctrine\DBAL\Schema\ColumnDiff */
|
||||
$column = $columnDiff->column;
|
||||
$queryParts[] = 'ALTER ' . ($columnDiff->oldColumnName) . ' '
|
||||
. $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
|
||||
}
|
||||
|
||||
foreach ($diff->renamedColumns as $oldColumnName => $column) {
|
||||
if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$queryParts[] = 'RENAME ' . $oldColumnName . ' TO ' . $column->getQuotedName($this);
|
||||
}
|
||||
|
||||
$tableSql = array();
|
||||
|
||||
if ( ! $this->onSchemaAlterTable($diff, $tableSql)) {
|
||||
if (count($queryParts) > 0) {
|
||||
$sql[] = 'ALTER TABLE ' . $diff->name . ' ' . implode(" ", $queryParts);
|
||||
}
|
||||
|
||||
$sql = array_merge($sql, $this->_getAlterTableIndexForeignKeySQL($diff));
|
||||
|
||||
if ($diff->newName !== false) {
|
||||
$sql[] = 'RENAME TABLE TO ' . $diff->newName;
|
||||
}
|
||||
}
|
||||
|
||||
return array_merge($sql, $tableSql, $columnSql);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDefaultValueDeclarationSQL($field)
|
||||
{
|
||||
if (isset($field['notnull']) && $field['notnull'] && !isset($field['default'])) {
|
||||
if (in_array((string)$field['type'], array("Integer", "BigInteger", "SmallInteger"))) {
|
||||
$field['default'] = 0;
|
||||
} else if((string)$field['type'] == "DateTime") {
|
||||
$field['default'] = "00-00-00 00:00:00";
|
||||
} else if ((string)$field['type'] == "Date") {
|
||||
$field['default'] = "00-00-00";
|
||||
} else if((string)$field['type'] == "Time") {
|
||||
$field['default'] = "00:00:00";
|
||||
} else {
|
||||
$field['default'] = '';
|
||||
}
|
||||
}
|
||||
|
||||
unset($field['default']); // @todo this needs fixing
|
||||
if (isset($field['version']) && $field['version']) {
|
||||
if ((string)$field['type'] != "DateTime") {
|
||||
$field['default'] = "1";
|
||||
}
|
||||
}
|
||||
|
||||
return parent::getDefaultValueDeclarationSQL($field);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getEmptyIdentityInsertSQL($tableName, $identifierColumnName)
|
||||
{
|
||||
return 'INSERT INTO ' . $tableName . ' (' . $identifierColumnName . ') VALUES (DEFAULT)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getCreateTemporaryTableSnippetSQL()
|
||||
{
|
||||
return "DECLARE GLOBAL TEMPORARY TABLE";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getTemporaryTableName($tableName)
|
||||
{
|
||||
return "SESSION." . $tableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function doModifyLimitQuery($query, $limit, $offset = null)
|
||||
{
|
||||
if ($limit === null && $offset === null) {
|
||||
return $query;
|
||||
}
|
||||
|
||||
$limit = (int)$limit;
|
||||
$offset = (int)(($offset)?:0);
|
||||
|
||||
// Todo OVER() needs ORDER BY data!
|
||||
$sql = 'SELECT db22.* FROM (SELECT ROW_NUMBER() OVER() AS DC_ROWNUM, db21.* '.
|
||||
'FROM (' . $query . ') db21) db22 WHERE db22.DC_ROWNUM BETWEEN ' . ($offset+1) .' AND ' . ($offset+$limit);
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getLocateExpression($str, $substr, $startPos = false)
|
||||
{
|
||||
if ($startPos == false) {
|
||||
return 'LOCATE(' . $substr . ', ' . $str . ')';
|
||||
}
|
||||
|
||||
return 'LOCATE(' . $substr . ', ' . $str . ', '.$startPos.')';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSubstringExpression($value, $from, $length = null)
|
||||
{
|
||||
if ($length === null) {
|
||||
return 'SUBSTR(' . $value . ', ' . $from . ')';
|
||||
}
|
||||
|
||||
return 'SUBSTR(' . $value . ', ' . $from . ', ' . $length . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function supportsIdentityColumns()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function prefersIdentityColumns()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* DB2 returns all column names in SQL result sets in uppercase.
|
||||
*/
|
||||
public function getSQLResultCasing($column)
|
||||
{
|
||||
return strtoupper($column);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getForUpdateSQL()
|
||||
{
|
||||
return ' WITH RR USE AND KEEP UPDATE LOCKS';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDummySelectSQL()
|
||||
{
|
||||
return 'SELECT 1 FROM sysibm.sysdummy1';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* DB2 supports savepoints, but they work semantically different than on other vendor platforms.
|
||||
*
|
||||
* TODO: We have to investigate how to get DB2 up and running with savepoints.
|
||||
*/
|
||||
public function supportsSavepoints()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getReservedKeywordsClass()
|
||||
{
|
||||
return 'Doctrine\DBAL\Platforms\Keywords\DB2Keywords';
|
||||
}
|
||||
}
|
||||
520
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php
vendored
Normal file
520
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php
vendored
Normal file
@@ -0,0 +1,520 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Platforms;
|
||||
|
||||
use Doctrine\DBAL\DBALException;
|
||||
use Doctrine\DBAL\Schema\TableDiff;
|
||||
use Doctrine\DBAL\Schema\Index;
|
||||
use Doctrine\DBAL\Schema\Table;
|
||||
|
||||
/**
|
||||
* Drizzle platform
|
||||
*
|
||||
* @author Kim Hemsø Rasmussen <kimhemsoe@gmail.com>
|
||||
*/
|
||||
class DrizzlePlatform extends AbstractPlatform
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'drizzle';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getIdentifierQuoteCharacter()
|
||||
{
|
||||
return '`';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getConcatExpression()
|
||||
{
|
||||
$args = func_get_args();
|
||||
|
||||
return 'CONCAT(' . join(', ', (array) $args) . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateDiffExpression($date1, $date2)
|
||||
{
|
||||
return 'DATEDIFF(' . $date1 . ', ' . $date2 . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateAddHourExpression($date, $hours)
|
||||
{
|
||||
return 'DATE_ADD(' . $date . ', INTERVAL ' . $hours . ' HOUR)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateSubHourExpression($date, $hours)
|
||||
{
|
||||
return 'DATE_SUB(' . $date . ', INTERVAL ' . $hours . ' HOUR)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateAddDaysExpression($date, $days)
|
||||
{
|
||||
return 'DATE_ADD(' . $date . ', INTERVAL ' . $days . ' DAY)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateSubDaysExpression($date, $days)
|
||||
{
|
||||
return 'DATE_SUB(' . $date . ', INTERVAL ' . $days . ' DAY)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateAddMonthExpression($date, $months)
|
||||
{
|
||||
return 'DATE_ADD(' . $date . ', INTERVAL ' . $months . ' MONTH)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateSubMonthExpression($date, $months)
|
||||
{
|
||||
return 'DATE_SUB(' . $date . ', INTERVAL ' . $months . ' MONTH)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getBooleanTypeDeclarationSQL(array $field)
|
||||
{
|
||||
return 'BOOLEAN';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getIntegerTypeDeclarationSQL(array $field)
|
||||
{
|
||||
return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($field);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef)
|
||||
{
|
||||
$autoinc = '';
|
||||
if ( ! empty($columnDef['autoincrement'])) {
|
||||
$autoinc = ' AUTO_INCREMENT';
|
||||
}
|
||||
return $autoinc;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getBigIntTypeDeclarationSQL(array $field)
|
||||
{
|
||||
return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($field);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSmallIntTypeDeclarationSQL(array $field)
|
||||
{
|
||||
return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($field);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed)
|
||||
{
|
||||
return $length ? 'VARCHAR(' . $length . ')' : 'VARCHAR(255)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function initializeDoctrineTypeMappings()
|
||||
{
|
||||
$this->doctrineTypeMapping = array(
|
||||
'boolean' => 'boolean',
|
||||
'varchar' => 'string',
|
||||
'integer' => 'integer',
|
||||
'blob' => 'text',
|
||||
'decimal' => 'decimal',
|
||||
'datetime' => 'datetime',
|
||||
'date' => 'date',
|
||||
'time' => 'time',
|
||||
'text' => 'text',
|
||||
'timestamp' => 'datetime',
|
||||
'double' => 'float',
|
||||
'bigint' => 'bigint',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getClobTypeDeclarationSQL(array $field)
|
||||
{
|
||||
return 'TEXT';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getBlobTypeDeclarationSQL(array $field)
|
||||
{
|
||||
return 'BLOB';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getCreateDatabaseSQL($name)
|
||||
{
|
||||
return 'CREATE DATABASE ' . $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDropDatabaseSQL($name)
|
||||
{
|
||||
return 'DROP DATABASE ' . $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListDatabasesSQL()
|
||||
{
|
||||
return "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE CATALOG_NAME='LOCAL'";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getReservedKeywordsClass()
|
||||
{
|
||||
return 'Doctrine\DBAL\Platforms\Keywords\DrizzleKeywords';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListTablesSQL()
|
||||
{
|
||||
return "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE' AND TABLE_SCHEMA=DATABASE()";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListTableColumnsSQL($table, $database = null)
|
||||
{
|
||||
if ($database) {
|
||||
$database = "'" . $database . "'";
|
||||
} else {
|
||||
$database = 'DATABASE()';
|
||||
}
|
||||
|
||||
return "SELECT COLUMN_NAME, DATA_TYPE, COLUMN_COMMENT, IS_NULLABLE, IS_AUTO_INCREMENT, CHARACTER_MAXIMUM_LENGTH, COLUMN_DEFAULT," .
|
||||
" NUMERIC_PRECISION, NUMERIC_SCALE" .
|
||||
" FROM DATA_DICTIONARY.COLUMNS" .
|
||||
" WHERE TABLE_SCHEMA=" . $database . " AND TABLE_NAME = '" . $table . "'";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListTableForeignKeysSQL($table, $database = null)
|
||||
{
|
||||
if ($database) {
|
||||
$database = "'" . $database . "'";
|
||||
} else {
|
||||
$database = 'DATABASE()';
|
||||
}
|
||||
|
||||
return "SELECT CONSTRAINT_NAME, CONSTRAINT_COLUMNS, REFERENCED_TABLE_NAME, REFERENCED_TABLE_COLUMNS, UPDATE_RULE, DELETE_RULE" .
|
||||
" FROM DATA_DICTIONARY.FOREIGN_KEYS" .
|
||||
" WHERE CONSTRAINT_SCHEMA=" . $database . " AND CONSTRAINT_TABLE='" . $table . "'";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListTableIndexesSQL($table, $database = null)
|
||||
{
|
||||
if ($database) {
|
||||
$database = "'" . $database . "'";
|
||||
} else {
|
||||
$database = 'DATABASE()';
|
||||
}
|
||||
|
||||
return "SELECT INDEX_NAME AS 'key_name', COLUMN_NAME AS 'column_name', IS_USED_IN_PRIMARY AS 'primary', IS_UNIQUE=0 AS 'non_unique'" .
|
||||
" FROM DATA_DICTIONARY.INDEX_PARTS" .
|
||||
" WHERE TABLE_SCHEMA=" . $database . " AND TABLE_NAME='" . $table . "'";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function prefersIdentityColumns()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function supportsIdentityColumns()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function supportsInlineColumnComments()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function supportsViews()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDropIndexSQL($index, $table=null)
|
||||
{
|
||||
if ($index instanceof Index) {
|
||||
$indexName = $index->getQuotedName($this);
|
||||
} else if (is_string($index)) {
|
||||
$indexName = $index;
|
||||
} else {
|
||||
throw new \InvalidArgumentException('DrizzlePlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.');
|
||||
}
|
||||
|
||||
if ($table instanceof Table) {
|
||||
$table = $table->getQuotedName($this);
|
||||
} else if(!is_string($table)) {
|
||||
throw new \InvalidArgumentException('DrizzlePlatform::getDropIndexSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.');
|
||||
}
|
||||
|
||||
if ($index instanceof Index && $index->isPrimary()) {
|
||||
// drizzle primary keys are always named "PRIMARY",
|
||||
// so we cannot use them in statements because of them being keyword.
|
||||
return $this->getDropPrimaryKeySQL($table);
|
||||
}
|
||||
|
||||
return 'DROP INDEX ' . $indexName . ' ON ' . $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getDropPrimaryKeySQL($table)
|
||||
{
|
||||
return 'ALTER TABLE ' . $table . ' DROP PRIMARY KEY';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
|
||||
{
|
||||
if (isset($fieldDeclaration['version']) && $fieldDeclaration['version'] == true) {
|
||||
return 'TIMESTAMP';
|
||||
}
|
||||
|
||||
return 'DATETIME';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
|
||||
{
|
||||
return 'TIME';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateTypeDeclarationSQL(array $fieldDeclaration)
|
||||
{
|
||||
return 'DATE';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getAlterTableSQL(TableDiff $diff)
|
||||
{
|
||||
$columnSql = array();
|
||||
$queryParts = array();
|
||||
|
||||
if ($diff->newName !== false) {
|
||||
$queryParts[] = 'RENAME TO ' . $diff->newName;
|
||||
}
|
||||
|
||||
foreach ($diff->addedColumns as $column) {
|
||||
if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$columnArray = $column->toArray();
|
||||
$columnArray['comment'] = $this->getColumnComment($column);
|
||||
$queryParts[] = 'ADD ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray);
|
||||
}
|
||||
|
||||
foreach ($diff->removedColumns as $column) {
|
||||
if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$queryParts[] = 'DROP ' . $column->getQuotedName($this);
|
||||
}
|
||||
|
||||
foreach ($diff->changedColumns as $columnDiff) {
|
||||
if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* @var $columnDiff \Doctrine\DBAL\Schema\ColumnDiff */
|
||||
$column = $columnDiff->column;
|
||||
$columnArray = $column->toArray();
|
||||
$columnArray['comment'] = $this->getColumnComment($column);
|
||||
$queryParts[] = 'CHANGE ' . ($columnDiff->oldColumnName) . ' '
|
||||
. $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray);
|
||||
}
|
||||
|
||||
foreach ($diff->renamedColumns as $oldColumnName => $column) {
|
||||
if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$columnArray = $column->toArray();
|
||||
$columnArray['comment'] = $this->getColumnComment($column);
|
||||
$queryParts[] = 'CHANGE ' . $oldColumnName . ' '
|
||||
. $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray);
|
||||
}
|
||||
|
||||
$sql = array();
|
||||
$tableSql = array();
|
||||
|
||||
if ( ! $this->onSchemaAlterTable($diff, $tableSql)) {
|
||||
if (count($queryParts) > 0) {
|
||||
$sql[] = 'ALTER TABLE ' . $diff->name . ' ' . implode(", ", $queryParts);
|
||||
}
|
||||
$sql = array_merge(
|
||||
$this->getPreAlterTableIndexForeignKeySQL($diff),
|
||||
$sql,
|
||||
$this->getPostAlterTableIndexForeignKeySQL($diff)
|
||||
);
|
||||
}
|
||||
|
||||
return array_merge($sql, $tableSql, $columnSql);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDropTemporaryTableSQL($table)
|
||||
{
|
||||
if ($table instanceof Table) {
|
||||
$table = $table->getQuotedName($this);
|
||||
} else if(!is_string($table)) {
|
||||
throw new \InvalidArgumentException('getDropTableSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.');
|
||||
}
|
||||
|
||||
return 'DROP TEMPORARY TABLE ' . $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function convertBooleans($item)
|
||||
{
|
||||
if (is_array($item)) {
|
||||
foreach ($item as $key => $value) {
|
||||
if (is_bool($value) || is_numeric($item)) {
|
||||
$item[$key] = ($value) ? 'true' : 'false';
|
||||
}
|
||||
}
|
||||
} else if (is_bool($item) || is_numeric($item)) {
|
||||
$item = ($item) ? 'true' : 'false';
|
||||
}
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getLocateExpression($str, $substr, $startPos = false)
|
||||
{
|
||||
if ($startPos == false) {
|
||||
return 'LOCATE(' . $substr . ', ' . $str . ')';
|
||||
}
|
||||
|
||||
return 'LOCATE(' . $substr . ', ' . $str . ', '.$startPos.')';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getGuidExpression()
|
||||
{
|
||||
return 'UUID()';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getRegexpExpression()
|
||||
{
|
||||
return 'RLIKE';
|
||||
}
|
||||
}
|
||||
441
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/DB2Keywords.php
vendored
Normal file
441
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/DB2Keywords.php
vendored
Normal file
@@ -0,0 +1,441 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Platforms\Keywords;
|
||||
|
||||
/**
|
||||
* DB2 Keywords.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class DB2Keywords extends KeywordList
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'DB2';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getKeywords()
|
||||
{
|
||||
return array(
|
||||
'ACTIVATE',
|
||||
'ADD',
|
||||
'AFTER',
|
||||
'ALIAS',
|
||||
'ALL',
|
||||
'ALLOCATE',
|
||||
'DOCUMENT',
|
||||
'DOUBLE',
|
||||
'DROP',
|
||||
'DSSIZE',
|
||||
'DYNAMIC',
|
||||
'EACH',
|
||||
'LOCK',
|
||||
'LOCKMAX',
|
||||
'LOCKSIZE',
|
||||
'LONG',
|
||||
'LOOP',
|
||||
'MAINTAINED',
|
||||
'ROUND_CEILING',
|
||||
'ROUND_DOWN',
|
||||
'ROUND_FLOOR',
|
||||
'ROUND_HALF_DOWN',
|
||||
'ROUND_HALF_EVEN',
|
||||
'ROUND_HALF_UP',
|
||||
'ALLOW',
|
||||
'ALTER',
|
||||
'AND',
|
||||
'ANY',
|
||||
'AS',
|
||||
'ASENSITIVE',
|
||||
'ASSOCIATE',
|
||||
'ASUTIME',
|
||||
'AT',
|
||||
'ATTRIBUTES',
|
||||
'AUDIT',
|
||||
'AUTHORIZATION',
|
||||
'AUX',
|
||||
'AUXILIARY',
|
||||
'BEFORE',
|
||||
'BEGIN',
|
||||
'BETWEEN',
|
||||
'BINARY',
|
||||
'BUFFERPOOL',
|
||||
'BY',
|
||||
'CACHE',
|
||||
'CALL',
|
||||
'CALLED',
|
||||
'CAPTURE',
|
||||
'CARDINALITY',
|
||||
'CASCADED',
|
||||
'CASE',
|
||||
'CAST',
|
||||
'CCSID',
|
||||
'CHAR',
|
||||
'CHARACTER',
|
||||
'CHECK',
|
||||
'CLONE',
|
||||
'CLOSE',
|
||||
'CLUSTER',
|
||||
'COLLECTION',
|
||||
'COLLID',
|
||||
'COLUMN',
|
||||
'COMMENT',
|
||||
'COMMIT',
|
||||
'CONCAT',
|
||||
'CONDITION',
|
||||
'CONNECT',
|
||||
'CONNECTION',
|
||||
'CONSTRAINT',
|
||||
'CONTAINS',
|
||||
'CONTINUE',
|
||||
'COUNT',
|
||||
'COUNT_BIG',
|
||||
'CREATE',
|
||||
'CROSS',
|
||||
'CURRENT',
|
||||
'CURRENT_DATE',
|
||||
'CURRENT_LC_CTYPE',
|
||||
'CURRENT_PATH',
|
||||
'CURRENT_SCHEMA',
|
||||
'CURRENT_SERVER',
|
||||
'CURRENT_TIME',
|
||||
'CURRENT_TIMESTAMP',
|
||||
'CURRENT_TIMEZONE',
|
||||
'CURRENT_USER',
|
||||
'CURSOR',
|
||||
'CYCLE',
|
||||
'DATA',
|
||||
'DATABASE',
|
||||
'DATAPARTITIONNAME',
|
||||
'DATAPARTITIONNUM',
|
||||
'EDITPROC',
|
||||
'ELSE',
|
||||
'ELSEIF',
|
||||
'ENABLE',
|
||||
'ENCODING',
|
||||
'ENCRYPTION',
|
||||
'END',
|
||||
'END-EXEC',
|
||||
'ENDING',
|
||||
'ERASE',
|
||||
'ESCAPE',
|
||||
'EVERY',
|
||||
'EXCEPT',
|
||||
'EXCEPTION',
|
||||
'EXCLUDING',
|
||||
'EXCLUSIVE',
|
||||
'EXECUTE',
|
||||
'EXISTS',
|
||||
'EXIT',
|
||||
'EXPLAIN',
|
||||
'EXTERNAL',
|
||||
'EXTRACT',
|
||||
'FENCED',
|
||||
'FETCH',
|
||||
'FIELDPROC',
|
||||
'FILE',
|
||||
'FINAL',
|
||||
'FOR',
|
||||
'FOREIGN',
|
||||
'FREE',
|
||||
'FROM',
|
||||
'FULL',
|
||||
'FUNCTION',
|
||||
'GENERAL',
|
||||
'GENERATED',
|
||||
'GET',
|
||||
'GLOBAL',
|
||||
'GO',
|
||||
'GOTO',
|
||||
'GRANT',
|
||||
'GRAPHIC',
|
||||
'GROUP',
|
||||
'HANDLER',
|
||||
'HASH',
|
||||
'HASHED_VALUE',
|
||||
'HAVING',
|
||||
'HINT',
|
||||
'HOLD',
|
||||
'HOUR',
|
||||
'HOURS',
|
||||
'IDENTITY',
|
||||
'IF',
|
||||
'IMMEDIATE',
|
||||
'IN',
|
||||
'INCLUDING',
|
||||
'INCLUSIVE',
|
||||
'INCREMENT',
|
||||
'INDEX',
|
||||
'INDICATOR',
|
||||
'INF',
|
||||
'INFINITY',
|
||||
'INHERIT',
|
||||
'INNER',
|
||||
'INOUT',
|
||||
'INSENSITIVE',
|
||||
'INSERT',
|
||||
'INTEGRITY',
|
||||
'MATERIALIZED',
|
||||
'MAXVALUE',
|
||||
'MICROSECOND',
|
||||
'MICROSECONDS',
|
||||
'MINUTE',
|
||||
'MINUTES',
|
||||
'MINVALUE',
|
||||
'MODE',
|
||||
'MODIFIES',
|
||||
'MONTH',
|
||||
'MONTHS',
|
||||
'NAN',
|
||||
'NEW',
|
||||
'NEW_TABLE',
|
||||
'NEXTVAL',
|
||||
'NO',
|
||||
'NOCACHE',
|
||||
'NOCYCLE',
|
||||
'NODENAME',
|
||||
'NODENUMBER',
|
||||
'NOMAXVALUE',
|
||||
'NOMINVALUE',
|
||||
'NONE',
|
||||
'NOORDER',
|
||||
'NORMALIZED',
|
||||
'NOT',
|
||||
'NULL',
|
||||
'NULLS',
|
||||
'NUMPARTS',
|
||||
'OBID',
|
||||
'OF',
|
||||
'OLD',
|
||||
'OLD_TABLE',
|
||||
'ON',
|
||||
'OPEN',
|
||||
'OPTIMIZATION',
|
||||
'OPTIMIZE',
|
||||
'OPTION',
|
||||
'OR',
|
||||
'ORDER',
|
||||
'OUT',
|
||||
'OUTER',
|
||||
'OVER',
|
||||
'OVERRIDING',
|
||||
'PACKAGE',
|
||||
'PADDED',
|
||||
'PAGESIZE',
|
||||
'PARAMETER',
|
||||
'PART',
|
||||
'PARTITION',
|
||||
'PARTITIONED',
|
||||
'PARTITIONING',
|
||||
'PARTITIONS',
|
||||
'PASSWORD',
|
||||
'PATH',
|
||||
'PIECESIZE',
|
||||
'PLAN',
|
||||
'POSITION',
|
||||
'PRECISION',
|
||||
'PREPARE',
|
||||
'PREVVAL',
|
||||
'PRIMARY',
|
||||
'PRIQTY',
|
||||
'PRIVILEGES',
|
||||
'PROCEDURE',
|
||||
'PROGRAM',
|
||||
'PSID',
|
||||
'ROUND_UP',
|
||||
'ROUTINE',
|
||||
'ROW',
|
||||
'ROW_NUMBER',
|
||||
'ROWNUMBER',
|
||||
'ROWS',
|
||||
'ROWSET',
|
||||
'RRN',
|
||||
'RUN',
|
||||
'SAVEPOINT',
|
||||
'SCHEMA',
|
||||
'SCRATCHPAD',
|
||||
'SCROLL',
|
||||
'SEARCH',
|
||||
'SECOND',
|
||||
'SECONDS',
|
||||
'SECQTY',
|
||||
'SECURITY',
|
||||
'SELECT',
|
||||
'SENSITIVE',
|
||||
'SEQUENCE',
|
||||
'SESSION',
|
||||
'SESSION_USER',
|
||||
'SET',
|
||||
'SIGNAL',
|
||||
'SIMPLE',
|
||||
'SNAN',
|
||||
'SOME',
|
||||
'SOURCE',
|
||||
'SPECIFIC',
|
||||
'SQL',
|
||||
'SQLID',
|
||||
'STACKED',
|
||||
'STANDARD',
|
||||
'START',
|
||||
'STARTING',
|
||||
'STATEMENT',
|
||||
'STATIC',
|
||||
'STATMENT',
|
||||
'STAY',
|
||||
'STOGROUP',
|
||||
'STORES',
|
||||
'STYLE',
|
||||
'SUBSTRING',
|
||||
'SUMMARY',
|
||||
'SYNONYM',
|
||||
'SYSFUN',
|
||||
'SYSIBM',
|
||||
'SYSPROC',
|
||||
'SYSTEM',
|
||||
'SYSTEM_USER',
|
||||
'TABLE',
|
||||
'TABLESPACE',
|
||||
'THEN',
|
||||
'TIME',
|
||||
'TIMESTAMP',
|
||||
'TO',
|
||||
'TRANSACTION',
|
||||
'TRIGGER',
|
||||
'TRIM',
|
||||
'TRUNCATE',
|
||||
'TYPE',
|
||||
'UNDO',
|
||||
'UNION',
|
||||
'UNIQUE',
|
||||
'UNTIL',
|
||||
'UPDATE',
|
||||
'DATE',
|
||||
'DAY',
|
||||
'DAYS',
|
||||
'DB2GENERAL',
|
||||
'DB2GENRL',
|
||||
'DB2SQL',
|
||||
'DBINFO',
|
||||
'DBPARTITIONNAME',
|
||||
'DBPARTITIONNUM',
|
||||
'DEALLOCATE',
|
||||
'DECLARE',
|
||||
'DEFAULT',
|
||||
'DEFAULTS',
|
||||
'DEFINITION',
|
||||
'DELETE',
|
||||
'DENSE_RANK',
|
||||
'DENSERANK',
|
||||
'DESCRIBE',
|
||||
'DESCRIPTOR',
|
||||
'DETERMINISTIC',
|
||||
'DIAGNOSTICS',
|
||||
'DISABLE',
|
||||
'DISALLOW',
|
||||
'DISCONNECT',
|
||||
'DISTINCT',
|
||||
'DO',
|
||||
'INTERSECT',
|
||||
'PUBLIC',
|
||||
'USAGE',
|
||||
'INTO',
|
||||
'QUERY',
|
||||
'USER',
|
||||
'IS',
|
||||
'QUERYNO',
|
||||
'USING',
|
||||
'ISOBID',
|
||||
'RANGE',
|
||||
'VALIDPROC',
|
||||
'ISOLATION',
|
||||
'RANK',
|
||||
'VALUE',
|
||||
'ITERATE',
|
||||
'READ',
|
||||
'VALUES',
|
||||
'JAR',
|
||||
'READS',
|
||||
'VARIABLE',
|
||||
'JAVA',
|
||||
'RECOVERY',
|
||||
'VARIANT',
|
||||
'JOIN',
|
||||
'REFERENCES',
|
||||
'VCAT',
|
||||
'KEEP',
|
||||
'REFERENCING',
|
||||
'VERSION',
|
||||
'KEY',
|
||||
'REFRESH',
|
||||
'VIEW',
|
||||
'LABEL',
|
||||
'RELEASE',
|
||||
'VOLATILE',
|
||||
'LANGUAGE',
|
||||
'RENAME',
|
||||
'VOLUMES',
|
||||
'LATERAL',
|
||||
'REPEAT',
|
||||
'WHEN',
|
||||
'LC_CTYPE',
|
||||
'RESET',
|
||||
'WHENEVER',
|
||||
'LEAVE',
|
||||
'RESIGNAL',
|
||||
'WHERE',
|
||||
'LEFT',
|
||||
'RESTART',
|
||||
'WHILE',
|
||||
'LIKE',
|
||||
'RESTRICT',
|
||||
'WITH',
|
||||
'LINKTYPE',
|
||||
'RESULT',
|
||||
'WITHOUT',
|
||||
'LOCAL',
|
||||
'RESULT_SET_LOCATOR WLM',
|
||||
'LOCALDATE',
|
||||
'RETURN',
|
||||
'WRITE',
|
||||
'LOCALE',
|
||||
'RETURNS',
|
||||
'XMLELEMENT',
|
||||
'LOCALTIME',
|
||||
'REVOKE',
|
||||
'XMLEXISTS',
|
||||
'LOCALTIMESTAMP RIGHT',
|
||||
'XMLNAMESPACES',
|
||||
'LOCATOR',
|
||||
'ROLE',
|
||||
'YEAR',
|
||||
'LOCATORS',
|
||||
'ROLLBACK',
|
||||
'YEARS',
|
||||
);
|
||||
}
|
||||
}
|
||||
345
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/DrizzleKeywords.php
vendored
Normal file
345
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/DrizzleKeywords.php
vendored
Normal file
@@ -0,0 +1,345 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Platforms\Keywords;
|
||||
|
||||
/**
|
||||
* Drizzle Keywordlist.
|
||||
*
|
||||
* @author Kim Hemsø Rasmussen <kimhemsoe@gmail.com>
|
||||
*/
|
||||
class DrizzleKeywords extends KeywordList
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'drizzle';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getKeywords()
|
||||
{
|
||||
return array(
|
||||
'ABS',
|
||||
'ALL',
|
||||
'ALLOCATE',
|
||||
'ALTER',
|
||||
'AND',
|
||||
'ANY',
|
||||
'ARE',
|
||||
'ARRAY',
|
||||
'AS',
|
||||
'ASENSITIVE',
|
||||
'ASYMMETRIC',
|
||||
'AT',
|
||||
'ATOMIC',
|
||||
'AUTHORIZATION',
|
||||
'AVG',
|
||||
'BEGIN',
|
||||
'BETWEEN',
|
||||
'BIGINT',
|
||||
'BINARY',
|
||||
'BLOB',
|
||||
'BOOLEAN',
|
||||
'BOTH',
|
||||
'BY',
|
||||
'CALL',
|
||||
'CALLED',
|
||||
'CARDINALITY',
|
||||
'CASCADED',
|
||||
'CASE',
|
||||
'CAST',
|
||||
'CEIL',
|
||||
'CEILING',
|
||||
'CHAR',
|
||||
'CHARACTER',
|
||||
'CHARACTER_LENGTH',
|
||||
'CHAR_LENGTH',
|
||||
'CHECK',
|
||||
'CLOB',
|
||||
'CLOSE',
|
||||
'COALESCE',
|
||||
'COLLATE',
|
||||
'COLLECT',
|
||||
'COLUMN',
|
||||
'COMMIT',
|
||||
'CONDITION',
|
||||
'CONNECT',
|
||||
'CONSTRAINT',
|
||||
'CONVERT',
|
||||
'CORR',
|
||||
'CORRESPONDING',
|
||||
'COUNT',
|
||||
'COVAR_POP',
|
||||
'COVAR_SAMP',
|
||||
'CREATE',
|
||||
'CROSS',
|
||||
'CUBE',
|
||||
'CUME_DIST',
|
||||
'CURRENT',
|
||||
'CURRENT_DATE',
|
||||
'CURRENT_DEFAULT_TRANSFORM_GROUP',
|
||||
'CURRENT_PATH',
|
||||
'CURRENT_ROLE',
|
||||
'CURRENT_TIME',
|
||||
'CURRENT_TIMESTAMP',
|
||||
'CURRENT_TRANSFORM_GROUP_FOR_TYPE',
|
||||
'CURRENT_USER',
|
||||
'CURSOR',
|
||||
'CYCLE',
|
||||
'DATE',
|
||||
'DAY',
|
||||
'DEALLOCATE',
|
||||
'DEC',
|
||||
'DECIMAL',
|
||||
'DECLARE',
|
||||
'DEFAULT',
|
||||
'DELETE',
|
||||
'DENSE_RANK',
|
||||
'DEREF',
|
||||
'DESCRIBE',
|
||||
'DETERMINISTIC',
|
||||
'DISCONNECT',
|
||||
'DISTINCT',
|
||||
'DOUBLE',
|
||||
'DROP',
|
||||
'DYNAMIC',
|
||||
'EACH',
|
||||
'ELEMENT',
|
||||
'ELSE',
|
||||
'END',
|
||||
'ESCAPE',
|
||||
'EVERY',
|
||||
'EXCEPT',
|
||||
'EXEC',
|
||||
'EXECUTE',
|
||||
'EXISTS',
|
||||
'EXP',
|
||||
'EXTERNAL',
|
||||
'EXTRACT',
|
||||
'FALSE',
|
||||
'FETCH',
|
||||
'FILTER',
|
||||
'FLOAT',
|
||||
'FLOOR',
|
||||
'FOR',
|
||||
'FOREIGN',
|
||||
'FREE',
|
||||
'FROM',
|
||||
'FULL',
|
||||
'FUNCTION',
|
||||
'FUSION',
|
||||
'GET',
|
||||
'GLOBAL',
|
||||
'GRANT',
|
||||
'GROUP',
|
||||
'GROUPING',
|
||||
'HAVING',
|
||||
'HOLD',
|
||||
'HOUR',
|
||||
'IDENTITY',
|
||||
'IN',
|
||||
'INDICATOR',
|
||||
'INNER',
|
||||
'INOUT',
|
||||
'INSENSITIVE',
|
||||
'INSERT',
|
||||
'INT',
|
||||
'INTEGER',
|
||||
'INTERSECT',
|
||||
'INTERSECTION',
|
||||
'INTERVAL',
|
||||
'INTO',
|
||||
'IS',
|
||||
'JOIN',
|
||||
'LANGUAGE',
|
||||
'LARGE',
|
||||
'LATERAL',
|
||||
'LEADING',
|
||||
'LEFT',
|
||||
'LIKE',
|
||||
'LN',
|
||||
'LOCAL',
|
||||
'LOCALTIME',
|
||||
'LOCALTIMESTAMP',
|
||||
'LOWER',
|
||||
'MATCH',
|
||||
'MAX',
|
||||
'MEMBER',
|
||||
'MERGE',
|
||||
'METHOD',
|
||||
'MIN',
|
||||
'MINUTE',
|
||||
'MOD',
|
||||
'MODIFIES',
|
||||
'MODULE',
|
||||
'MONTH',
|
||||
'MULTISET',
|
||||
'NATIONAL',
|
||||
'NATURAL',
|
||||
'NCHAR',
|
||||
'NCLOB',
|
||||
'NEW',
|
||||
'NO',
|
||||
'NONE',
|
||||
'NORMALIZE',
|
||||
'NOT',
|
||||
'NULL_SYM',
|
||||
'NULLIF',
|
||||
'NUMERIC',
|
||||
'OCTET_LENGTH',
|
||||
'OF',
|
||||
'OLD',
|
||||
'ON',
|
||||
'ONLY',
|
||||
'OPEN',
|
||||
'OR',
|
||||
'ORDER',
|
||||
'OUT',
|
||||
'OUTER',
|
||||
'OVER',
|
||||
'OVERLAPS',
|
||||
'OVERLAY',
|
||||
'PARAMETER',
|
||||
'PARTITION',
|
||||
'PERCENTILE_CONT',
|
||||
'PERCENTILE_DISC',
|
||||
'PERCENT_RANK',
|
||||
'POSITION',
|
||||
'POWER',
|
||||
'PRECISION',
|
||||
'PREPARE',
|
||||
'PRIMARY',
|
||||
'PROCEDURE',
|
||||
'RANGE',
|
||||
'RANK',
|
||||
'READS',
|
||||
'REAL',
|
||||
'RECURSIVE',
|
||||
'REF',
|
||||
'REFERENCES',
|
||||
'REFERENCING',
|
||||
'REGR_AVGX',
|
||||
'REGR_AVGY',
|
||||
'REGR_COUNT',
|
||||
'REGR_INTERCEPT',
|
||||
'REGR_R2',
|
||||
'REGR_SLOPE',
|
||||
'REGR_SXX',
|
||||
'REGR_SXY',
|
||||
'REGR_SYY',
|
||||
'RELEASE',
|
||||
'RESULT',
|
||||
'RETURN',
|
||||
'RETURNS',
|
||||
'REVOKE',
|
||||
'RIGHT',
|
||||
'ROLLBACK',
|
||||
'ROLLUP',
|
||||
'ROW',
|
||||
'ROWS',
|
||||
'ROW_NUMBER',
|
||||
'SAVEPOINT',
|
||||
'SCOPE',
|
||||
'SCROLL',
|
||||
'SEARCH',
|
||||
'SECOND',
|
||||
'SELECT',
|
||||
'SENSITIVE',
|
||||
'SESSION_USER',
|
||||
'SET',
|
||||
'SIMILAR',
|
||||
'SMALLINT',
|
||||
'SOME',
|
||||
'SPECIFIC',
|
||||
'SPECIFICTYPE',
|
||||
'SQL',
|
||||
'SQLEXCEPTION',
|
||||
'SQLSTATE',
|
||||
'SQLWARNING',
|
||||
'SQRT',
|
||||
'START',
|
||||
'STATIC',
|
||||
'STDDEV_POP',
|
||||
'STDDEV_SAMP',
|
||||
'SUBMULTISET',
|
||||
'SUBSTRING',
|
||||
'SUM',
|
||||
'SYMMETRIC',
|
||||
'SYSTEM',
|
||||
'SYSTEM_USER',
|
||||
'TABLE',
|
||||
'TABLESAMPLE',
|
||||
'THEN',
|
||||
'TIME',
|
||||
'TIMESTAMP',
|
||||
'TIMEZONE_HOUR',
|
||||
'TIMEZONE_MINUTE',
|
||||
'TO',
|
||||
'TRAILING',
|
||||
'TRANSLATE',
|
||||
'TRANSLATION',
|
||||
'TREAT',
|
||||
'TRIGGER',
|
||||
'TRIM',
|
||||
'TRUE',
|
||||
'UESCAPE',
|
||||
'UNION',
|
||||
'UNIQUE',
|
||||
'UNKNOWN',
|
||||
'UNNEST',
|
||||
'UPDATE',
|
||||
'UPPER',
|
||||
'USER',
|
||||
'USING',
|
||||
'VALUE',
|
||||
'VALUES',
|
||||
'VARCHAR',
|
||||
'VARYING',
|
||||
'VAR_POP',
|
||||
'VAR_SAMP',
|
||||
'WHEN',
|
||||
'WHENEVER',
|
||||
'WHERE',
|
||||
'WIDTH_BUCKET',
|
||||
'WINDOW',
|
||||
'WITH',
|
||||
'WITHIN',
|
||||
'WITHOUT',
|
||||
'XML',
|
||||
'XMLAGG',
|
||||
'XMLATTRIBUTES',
|
||||
'XMLBINARY',
|
||||
'XMLCOMMENT',
|
||||
'XMLCONCAT',
|
||||
'XMLELEMENT',
|
||||
'XMLFOREST',
|
||||
'XMLNAMESPACES',
|
||||
'XMLPARSE',
|
||||
'XMLPI',
|
||||
'XMLROOT',
|
||||
'XMLSERIALIZE',
|
||||
'YEAR',
|
||||
);
|
||||
}
|
||||
}
|
||||
73
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/KeywordList.php
vendored
Normal file
73
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/KeywordList.php
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Platforms\Keywords;
|
||||
|
||||
/**
|
||||
* Abstract interface for a SQL reserved keyword dictionary.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
abstract class KeywordList
|
||||
{
|
||||
/**
|
||||
* @var array|null
|
||||
*/
|
||||
private $keywords = null;
|
||||
|
||||
/**
|
||||
* Checks if the given word is a keyword of this dialect/vendor platform.
|
||||
*
|
||||
* @param string $word
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isKeyword($word)
|
||||
{
|
||||
if ($this->keywords === null) {
|
||||
$this->initializeKeywords();
|
||||
}
|
||||
|
||||
return isset($this->keywords[strtoupper($word)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function initializeKeywords()
|
||||
{
|
||||
$this->keywords = array_flip(array_map('strtoupper', $this->getKeywords()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of keywords.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
abstract protected function getKeywords();
|
||||
|
||||
/**
|
||||
* Returns the name of this keyword list.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public function getName();
|
||||
}
|
||||
43
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/MsSQLKeywords.php
vendored
Normal file
43
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/MsSQLKeywords.php
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
|
||||
namespace Doctrine\DBAL\Platforms\Keywords;
|
||||
|
||||
/**
|
||||
* MsSQL Keywordlist
|
||||
*
|
||||
* @license BSD http://www.opensource.org/licenses/bsd-license.php
|
||||
* @link www.doctrine-project.com
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author David Coallier <davidc@php.net>
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @deprecated Use SQLServerKeywords class instead.
|
||||
*/
|
||||
class MsSQLKeywords extends SQLServerKeywords
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'MsSQL';
|
||||
}
|
||||
}
|
||||
273
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/MySQLKeywords.php
vendored
Normal file
273
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/MySQLKeywords.php
vendored
Normal file
@@ -0,0 +1,273 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Platforms\Keywords;
|
||||
|
||||
/**
|
||||
* MySQL Keywordlist.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author David Coallier <davidc@php.net>
|
||||
*/
|
||||
class MySQLKeywords extends KeywordList
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'MySQL';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getKeywords()
|
||||
{
|
||||
return array(
|
||||
'ADD',
|
||||
'ALL',
|
||||
'ALTER',
|
||||
'ANALYZE',
|
||||
'AND',
|
||||
'AS',
|
||||
'ASC',
|
||||
'ASENSITIVE',
|
||||
'BEFORE',
|
||||
'BETWEEN',
|
||||
'BIGINT',
|
||||
'BINARY',
|
||||
'BLOB',
|
||||
'BOTH',
|
||||
'BY',
|
||||
'CALL',
|
||||
'CASCADE',
|
||||
'CASE',
|
||||
'CHANGE',
|
||||
'CHAR',
|
||||
'CHARACTER',
|
||||
'CHECK',
|
||||
'COLLATE',
|
||||
'COLUMN',
|
||||
'CONDITION',
|
||||
'CONNECTION',
|
||||
'CONSTRAINT',
|
||||
'CONTINUE',
|
||||
'CONVERT',
|
||||
'CREATE',
|
||||
'CROSS',
|
||||
'CURRENT_DATE',
|
||||
'CURRENT_TIME',
|
||||
'CURRENT_TIMESTAMP',
|
||||
'CURRENT_USER',
|
||||
'CURSOR',
|
||||
'DATABASE',
|
||||
'DATABASES',
|
||||
'DAY_HOUR',
|
||||
'DAY_MICROSECOND',
|
||||
'DAY_MINUTE',
|
||||
'DAY_SECOND',
|
||||
'DEC',
|
||||
'DECIMAL',
|
||||
'DECLARE',
|
||||
'DEFAULT',
|
||||
'DELAYED',
|
||||
'DELETE',
|
||||
'DESC',
|
||||
'DESCRIBE',
|
||||
'DETERMINISTIC',
|
||||
'DISTINCT',
|
||||
'DISTINCTROW',
|
||||
'DIV',
|
||||
'DOUBLE',
|
||||
'DROP',
|
||||
'DUAL',
|
||||
'EACH',
|
||||
'ELSE',
|
||||
'ELSEIF',
|
||||
'ENCLOSED',
|
||||
'ESCAPED',
|
||||
'EXISTS',
|
||||
'EXIT',
|
||||
'EXPLAIN',
|
||||
'FALSE',
|
||||
'FETCH',
|
||||
'FLOAT',
|
||||
'FLOAT4',
|
||||
'FLOAT8',
|
||||
'FOR',
|
||||
'FORCE',
|
||||
'FOREIGN',
|
||||
'FROM',
|
||||
'FULLTEXT',
|
||||
'GOTO',
|
||||
'GRANT',
|
||||
'GROUP',
|
||||
'HAVING',
|
||||
'HIGH_PRIORITY',
|
||||
'HOUR_MICROSECOND',
|
||||
'HOUR_MINUTE',
|
||||
'HOUR_SECOND',
|
||||
'IF',
|
||||
'IGNORE',
|
||||
'IN',
|
||||
'INDEX',
|
||||
'INFILE',
|
||||
'INNER',
|
||||
'INOUT',
|
||||
'INSENSITIVE',
|
||||
'INSERT',
|
||||
'INT',
|
||||
'INT1',
|
||||
'INT2',
|
||||
'INT3',
|
||||
'INT4',
|
||||
'INT8',
|
||||
'INTEGER',
|
||||
'INTERVAL',
|
||||
'INTO',
|
||||
'IS',
|
||||
'ITERATE',
|
||||
'JOIN',
|
||||
'KEY',
|
||||
'KEYS',
|
||||
'KILL',
|
||||
'LABEL',
|
||||
'LEADING',
|
||||
'LEAVE',
|
||||
'LEFT',
|
||||
'LIKE',
|
||||
'LIMIT',
|
||||
'LINES',
|
||||
'LOAD',
|
||||
'LOCALTIME',
|
||||
'LOCALTIMESTAMP',
|
||||
'LOCK',
|
||||
'LONG',
|
||||
'LONGBLOB',
|
||||
'LONGTEXT',
|
||||
'LOOP',
|
||||
'LOW_PRIORITY',
|
||||
'MATCH',
|
||||
'MEDIUMBLOB',
|
||||
'MEDIUMINT',
|
||||
'MEDIUMTEXT',
|
||||
'MIDDLEINT',
|
||||
'MINUTE_MICROSECOND',
|
||||
'MINUTE_SECOND',
|
||||
'MOD',
|
||||
'MODIFIES',
|
||||
'NATURAL',
|
||||
'NOT',
|
||||
'NO_WRITE_TO_BINLOG',
|
||||
'NULL',
|
||||
'NUMERIC',
|
||||
'ON',
|
||||
'OPTIMIZE',
|
||||
'OPTION',
|
||||
'OPTIONALLY',
|
||||
'OR',
|
||||
'ORDER',
|
||||
'OUT',
|
||||
'OUTER',
|
||||
'OUTFILE',
|
||||
'PRECISION',
|
||||
'PRIMARY',
|
||||
'PROCEDURE',
|
||||
'PURGE',
|
||||
'RAID0',
|
||||
'RANGE',
|
||||
'READ',
|
||||
'READS',
|
||||
'REAL',
|
||||
'REFERENCES',
|
||||
'REGEXP',
|
||||
'RELEASE',
|
||||
'RENAME',
|
||||
'REPEAT',
|
||||
'REPLACE',
|
||||
'REQUIRE',
|
||||
'RESTRICT',
|
||||
'RETURN',
|
||||
'REVOKE',
|
||||
'RIGHT',
|
||||
'RLIKE',
|
||||
'SCHEMA',
|
||||
'SCHEMAS',
|
||||
'SECOND_MICROSECOND',
|
||||
'SELECT',
|
||||
'SENSITIVE',
|
||||
'SEPARATOR',
|
||||
'SET',
|
||||
'SHOW',
|
||||
'SMALLINT',
|
||||
'SONAME',
|
||||
'SPATIAL',
|
||||
'SPECIFIC',
|
||||
'SQL',
|
||||
'SQLEXCEPTION',
|
||||
'SQLSTATE',
|
||||
'SQLWARNING',
|
||||
'SQL_BIG_RESULT',
|
||||
'SQL_CALC_FOUND_ROWS',
|
||||
'SQL_SMALL_RESULT',
|
||||
'SSL',
|
||||
'STARTING',
|
||||
'STRAIGHT_JOIN',
|
||||
'TABLE',
|
||||
'TERMINATED',
|
||||
'THEN',
|
||||
'TINYBLOB',
|
||||
'TINYINT',
|
||||
'TINYTEXT',
|
||||
'TO',
|
||||
'TRAILING',
|
||||
'TRIGGER',
|
||||
'TRUE',
|
||||
'UNDO',
|
||||
'UNION',
|
||||
'UNIQUE',
|
||||
'UNLOCK',
|
||||
'UNSIGNED',
|
||||
'UPDATE',
|
||||
'USAGE',
|
||||
'USE',
|
||||
'USING',
|
||||
'UTC_DATE',
|
||||
'UTC_TIME',
|
||||
'UTC_TIMESTAMP',
|
||||
'VALUES',
|
||||
'VARBINARY',
|
||||
'VARCHAR',
|
||||
'VARCHARACTER',
|
||||
'VARYING',
|
||||
'WHEN',
|
||||
'WHERE',
|
||||
'WHILE',
|
||||
'WITH',
|
||||
'WRITE',
|
||||
'X509',
|
||||
'XOR',
|
||||
'YEAR_MONTH',
|
||||
'ZEROFILL',
|
||||
);
|
||||
}
|
||||
}
|
||||
161
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/OracleKeywords.php
vendored
Normal file
161
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/OracleKeywords.php
vendored
Normal file
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Platforms\Keywords;
|
||||
|
||||
/**
|
||||
* Oracle Keywordlist.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author David Coallier <davidc@php.net>
|
||||
*/
|
||||
class OracleKeywords extends KeywordList
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'Oracle';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getKeywords()
|
||||
{
|
||||
return array(
|
||||
'ACCESS',
|
||||
'ELSE',
|
||||
'MODIFY',
|
||||
'START',
|
||||
'ADD',
|
||||
'EXCLUSIVE',
|
||||
'NOAUDIT',
|
||||
'SELECT',
|
||||
'ALL',
|
||||
'EXISTS',
|
||||
'NOCOMPRESS',
|
||||
'SESSION',
|
||||
'ALTER',
|
||||
'FILE',
|
||||
'NOT',
|
||||
'SET',
|
||||
'AND',
|
||||
'FLOAT',
|
||||
'NOTFOUND ',
|
||||
'SHARE',
|
||||
'ANY',
|
||||
'FOR',
|
||||
'NOWAIT',
|
||||
'SIZE',
|
||||
'ARRAYLEN',
|
||||
'FROM',
|
||||
'NULL',
|
||||
'SMALLINT',
|
||||
'AS',
|
||||
'GRANT',
|
||||
'NUMBER',
|
||||
'SQLBUF',
|
||||
'ASC',
|
||||
'GROUP',
|
||||
'OF',
|
||||
'SUCCESSFUL',
|
||||
'AUDIT',
|
||||
'HAVING',
|
||||
'OFFLINE ',
|
||||
'SYNONYM',
|
||||
'BETWEEN',
|
||||
'IDENTIFIED',
|
||||
'ON',
|
||||
'SYSDATE',
|
||||
'BY',
|
||||
'IMMEDIATE',
|
||||
'ONLINE',
|
||||
'TABLE',
|
||||
'CHAR',
|
||||
'IN',
|
||||
'OPTION',
|
||||
'THEN',
|
||||
'CHECK',
|
||||
'INCREMENT',
|
||||
'OR',
|
||||
'TO',
|
||||
'CLUSTER',
|
||||
'INDEX',
|
||||
'ORDER',
|
||||
'TRIGGER',
|
||||
'COLUMN',
|
||||
'INITIAL',
|
||||
'PCTFREE',
|
||||
'UID',
|
||||
'COMMENT',
|
||||
'INSERT',
|
||||
'PRIOR',
|
||||
'UNION',
|
||||
'COMPRESS',
|
||||
'INTEGER',
|
||||
'PRIVILEGES',
|
||||
'UNIQUE',
|
||||
'CONNECT',
|
||||
'INTERSECT',
|
||||
'PUBLIC',
|
||||
'UPDATE',
|
||||
'CREATE',
|
||||
'INTO',
|
||||
'RAW',
|
||||
'USER',
|
||||
'CURRENT',
|
||||
'IS',
|
||||
'RENAME',
|
||||
'VALIDATE',
|
||||
'DATE',
|
||||
'LEVEL',
|
||||
'RESOURCE',
|
||||
'VALUES',
|
||||
'DECIMAL',
|
||||
'LIKE',
|
||||
'REVOKE',
|
||||
'VARCHAR',
|
||||
'DEFAULT',
|
||||
'LOCK',
|
||||
'ROW',
|
||||
'VARCHAR2',
|
||||
'DELETE',
|
||||
'LONG',
|
||||
'ROWID',
|
||||
'VIEW',
|
||||
'DESC',
|
||||
'MAXEXTENTS',
|
||||
'ROWLABEL',
|
||||
'WHENEVER',
|
||||
'DISTINCT',
|
||||
'MINUS',
|
||||
'ROWNUM',
|
||||
'WHERE',
|
||||
'DROP',
|
||||
'MODE',
|
||||
'ROWS',
|
||||
'WITH',
|
||||
'RANGE',
|
||||
);
|
||||
}
|
||||
}
|
||||
135
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQLKeywords.php
vendored
Normal file
135
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/PostgreSQLKeywords.php
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Platforms\Keywords;
|
||||
|
||||
/**
|
||||
* PostgreSQL Keywordlist.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Marcelo Santos Araujo <msaraujo@php.net>
|
||||
*/
|
||||
class PostgreSQLKeywords extends KeywordList
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'PostgreSQL';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getKeywords()
|
||||
{
|
||||
return array(
|
||||
'ALL',
|
||||
'ANALYSE',
|
||||
'ANALYZE',
|
||||
'AND',
|
||||
'ANY',
|
||||
'AS',
|
||||
'ASC',
|
||||
'AUTHORIZATION',
|
||||
'BETWEEN',
|
||||
'BINARY',
|
||||
'BOTH',
|
||||
'CASE',
|
||||
'CAST',
|
||||
'CHECK',
|
||||
'COLLATE',
|
||||
'COLUMN',
|
||||
'CONSTRAINT',
|
||||
'CREATE',
|
||||
'CURRENT_DATE',
|
||||
'CURRENT_TIME',
|
||||
'CURRENT_TIMESTAMP',
|
||||
'CURRENT_USER',
|
||||
'DEFAULT',
|
||||
'DEFERRABLE',
|
||||
'DESC',
|
||||
'DISTINCT',
|
||||
'DO',
|
||||
'ELSE',
|
||||
'END',
|
||||
'EXCEPT',
|
||||
'FALSE',
|
||||
'FOR',
|
||||
'FOREIGN',
|
||||
'FREEZE',
|
||||
'FROM',
|
||||
'FULL',
|
||||
'GRANT',
|
||||
'GROUP',
|
||||
'HAVING',
|
||||
'ILIKE',
|
||||
'IN',
|
||||
'INITIALLY',
|
||||
'INNER',
|
||||
'INTERSECT',
|
||||
'INTO',
|
||||
'IS',
|
||||
'ISNULL',
|
||||
'JOIN',
|
||||
'LEADING',
|
||||
'LEFT',
|
||||
'LIKE',
|
||||
'LIMIT',
|
||||
'LOCALTIME',
|
||||
'LOCALTIMESTAMP',
|
||||
'NATURAL',
|
||||
'NEW',
|
||||
'NOT',
|
||||
'NOTNULL',
|
||||
'NULL',
|
||||
'OFF',
|
||||
'OFFSET',
|
||||
'OLD',
|
||||
'ON',
|
||||
'ONLY',
|
||||
'OR',
|
||||
'ORDER',
|
||||
'OUTER',
|
||||
'OVERLAPS',
|
||||
'PLACING',
|
||||
'PRIMARY',
|
||||
'REFERENCES',
|
||||
'SELECT',
|
||||
'SESSION_USER',
|
||||
'SIMILAR',
|
||||
'SOME',
|
||||
'TABLE',
|
||||
'THEN',
|
||||
'TO',
|
||||
'TRAILING',
|
||||
'TRUE',
|
||||
'UNION',
|
||||
'UNIQUE',
|
||||
'USER',
|
||||
'USING',
|
||||
'VERBOSE',
|
||||
'WHEN',
|
||||
'WHERE'
|
||||
);
|
||||
}
|
||||
}
|
||||
142
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/ReservedKeywordsValidator.php
vendored
Normal file
142
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/ReservedKeywordsValidator.php
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Platforms\Keywords;
|
||||
|
||||
use Doctrine\DBAL\Schema\Visitor\Visitor;
|
||||
use Doctrine\DBAL\Schema\Table;
|
||||
use Doctrine\DBAL\Schema\Column;
|
||||
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\DBAL\Schema\Sequence;
|
||||
use Doctrine\DBAL\Schema\Index;
|
||||
|
||||
class ReservedKeywordsValidator implements Visitor
|
||||
{
|
||||
/**
|
||||
* @var KeywordList[]
|
||||
*/
|
||||
private $keywordLists = array();
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $violations = array();
|
||||
|
||||
/**
|
||||
* @param \Doctrine\DBAL\Platforms\Keywords\KeywordList[] $keywordLists
|
||||
*/
|
||||
public function __construct(array $keywordLists)
|
||||
{
|
||||
$this->keywordLists = $keywordLists;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getViolations()
|
||||
{
|
||||
return $this->violations;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $word
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function isReservedWord($word)
|
||||
{
|
||||
if ($word[0] == "`") {
|
||||
$word = str_replace('`', '', $word);
|
||||
}
|
||||
|
||||
$keywordLists = array();
|
||||
foreach ($this->keywordLists as $keywordList) {
|
||||
if ($keywordList->isKeyword($word)) {
|
||||
$keywordLists[] = $keywordList->getName();
|
||||
}
|
||||
}
|
||||
return $keywordLists;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $asset
|
||||
* @param array $violatedPlatforms
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function addViolation($asset, $violatedPlatforms)
|
||||
{
|
||||
if ( ! $violatedPlatforms) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->violations[] = $asset . ' keyword violations: ' . implode(', ', $violatedPlatforms);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function acceptColumn(Table $table, Column $column)
|
||||
{
|
||||
$this->addViolation(
|
||||
'Table ' . $table->getName() . ' column ' . $column->getName(),
|
||||
$this->isReservedWord($column->getName())
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function acceptIndex(Table $table, Index $index)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function acceptSchema(Schema $schema)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function acceptSequence(Sequence $sequence)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function acceptTable(Table $table)
|
||||
{
|
||||
$this->addViolation(
|
||||
'Table ' . $table->getName(),
|
||||
$this->isReservedWord($table->getName())
|
||||
);
|
||||
}
|
||||
}
|
||||
56
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2005Keywords.php
vendored
Normal file
56
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2005Keywords.php
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Platforms\Keywords;
|
||||
|
||||
/**
|
||||
* Microsoft SQL Server 2005 reserved keyword dictionary.
|
||||
*
|
||||
* @license BSD http://www.opensource.org/licenses/bsd-license.php
|
||||
* @link www.doctrine-project.com
|
||||
* @since 2.3
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
*/
|
||||
class SQLServer2005Keywords extends SQLServerKeywords
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'SQLServer2005';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @link http://msdn.microsoft.com/en-US/library/ms189822%28v=sql.90%29.aspx
|
||||
*/
|
||||
protected function getKeywords()
|
||||
{
|
||||
return array_merge(array_diff(parent::getKeywords(), array('DUMMY')), array(
|
||||
'EXTERNAL',
|
||||
'PIVOT',
|
||||
'REVERT',
|
||||
'SECURITYAUDIT',
|
||||
'TABLESAMPLE',
|
||||
'UNPIVOT'
|
||||
));
|
||||
}
|
||||
}
|
||||
51
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2008Keywords.php
vendored
Normal file
51
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2008Keywords.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Platforms\Keywords;
|
||||
|
||||
/**
|
||||
* Microsoft SQL Server 2008 reserved keyword dictionary.
|
||||
*
|
||||
* @license BSD http://www.opensource.org/licenses/bsd-license.php
|
||||
* @link www.doctrine-project.com
|
||||
* @since 2.3
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
*/
|
||||
class SQLServer2008Keywords extends SQLServer2005Keywords
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'SQLServer2008';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @link http://msdn.microsoft.com/en-us/library/ms189822%28v=sql.100%29.aspx
|
||||
*/
|
||||
protected function getKeywords()
|
||||
{
|
||||
return array_merge(parent::getKeywords(), array(
|
||||
'MERGE'
|
||||
));
|
||||
}
|
||||
}
|
||||
55
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2012Keywords.php
vendored
Normal file
55
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2012Keywords.php
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Platforms\Keywords;
|
||||
|
||||
/**
|
||||
* Microsoft SQL Server 2012 reserved keyword dictionary.
|
||||
*
|
||||
* @license BSD http://www.opensource.org/licenses/bsd-license.php
|
||||
* @link www.doctrine-project.com
|
||||
* @since 2.3
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
*/
|
||||
class SQLServer2012Keywords extends SQLServer2008Keywords
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'SQLServer2012';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @link http://msdn.microsoft.com/en-us/library/ms189822.aspx
|
||||
*/
|
||||
protected function getKeywords()
|
||||
{
|
||||
return array_merge(parent::getKeywords(), array(
|
||||
'SEMANTICKEYPHRASETABLE',
|
||||
'SEMANTICSIMILARITYDETAILSTABLE',
|
||||
'SEMANTICSIMILARITYTABLE',
|
||||
'TRY_CONVERT',
|
||||
'WITHIN GROUP'
|
||||
));
|
||||
}
|
||||
}
|
||||
231
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLServerKeywords.php
vendored
Normal file
231
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLServerKeywords.php
vendored
Normal file
@@ -0,0 +1,231 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Platforms\Keywords;
|
||||
|
||||
/**
|
||||
* Microsoft SQL Server 2000 reserved keyword dictionary.
|
||||
*
|
||||
* @license BSD http://www.opensource.org/licenses/bsd-license.php
|
||||
* @link www.doctrine-project.com
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author David Coallier <davidc@php.net>
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
*/
|
||||
class SQLServerKeywords extends KeywordList
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'SQLServer';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @link http://msdn.microsoft.com/en-us/library/aa238507%28v=sql.80%29.aspx
|
||||
*/
|
||||
protected function getKeywords()
|
||||
{
|
||||
return array(
|
||||
'ADD',
|
||||
'ALL',
|
||||
'ALTER',
|
||||
'AND',
|
||||
'ANY',
|
||||
'AS',
|
||||
'ASC',
|
||||
'AUTHORIZATION',
|
||||
'BACKUP',
|
||||
'BEGIN',
|
||||
'BETWEEN',
|
||||
'BREAK',
|
||||
'BROWSE',
|
||||
'BULK',
|
||||
'BY',
|
||||
'CASCADE',
|
||||
'CASE',
|
||||
'CHECK',
|
||||
'CHECKPOINT',
|
||||
'CLOSE',
|
||||
'CLUSTERED',
|
||||
'COALESCE',
|
||||
'COLLATE',
|
||||
'COLUMN',
|
||||
'COMMIT',
|
||||
'COMPUTE',
|
||||
'CONSTRAINT',
|
||||
'CONTAINS',
|
||||
'CONTAINSTABLE',
|
||||
'CONTINUE',
|
||||
'CONVERT',
|
||||
'CREATE',
|
||||
'CROSS',
|
||||
'CURRENT',
|
||||
'CURRENT_DATE',
|
||||
'CURRENT_TIME',
|
||||
'CURRENT_TIMESTAMP',
|
||||
'CURRENT_USER',
|
||||
'CURSOR',
|
||||
'DATABASE',
|
||||
'DBCC',
|
||||
'DEALLOCATE',
|
||||
'DECLARE',
|
||||
'DEFAULT',
|
||||
'DELETE',
|
||||
'DENY',
|
||||
'DESC',
|
||||
'DISK',
|
||||
'DISTINCT',
|
||||
'DISTRIBUTED',
|
||||
'DOUBLE',
|
||||
'DROP',
|
||||
'DUMP',
|
||||
'ELSE',
|
||||
'END',
|
||||
'ERRLVL',
|
||||
'ESCAPE',
|
||||
'EXCEPT',
|
||||
'EXEC',
|
||||
'EXECUTE',
|
||||
'EXISTS',
|
||||
'EXIT',
|
||||
'EXTERNAL',
|
||||
'FETCH',
|
||||
'FILE',
|
||||
'FILLFACTOR',
|
||||
'FOR',
|
||||
'FOREIGN',
|
||||
'FREETEXT',
|
||||
'FREETEXTTABLE',
|
||||
'FROM',
|
||||
'FULL',
|
||||
'FUNCTION',
|
||||
'GOTO',
|
||||
'GRANT',
|
||||
'GROUP',
|
||||
'HAVING',
|
||||
'HOLDLOCK',
|
||||
'IDENTITY',
|
||||
'IDENTITY_INSERT',
|
||||
'IDENTITYCOL',
|
||||
'IF',
|
||||
'IN',
|
||||
'INDEX',
|
||||
'INNER',
|
||||
'INSERT',
|
||||
'INTERSECT',
|
||||
'INTO',
|
||||
'IS',
|
||||
'JOIN',
|
||||
'KEY',
|
||||
'KILL',
|
||||
'LEFT',
|
||||
'LIKE',
|
||||
'LINENO',
|
||||
'LOAD',
|
||||
'NATIONAL',
|
||||
'NOCHECK ',
|
||||
'NONCLUSTERED',
|
||||
'NOT',
|
||||
'NULL',
|
||||
'NULLIF',
|
||||
'OF',
|
||||
'OFF',
|
||||
'OFFSETS',
|
||||
'ON',
|
||||
'OPEN',
|
||||
'OPENDATASOURCE',
|
||||
'OPENQUERY',
|
||||
'OPENROWSET',
|
||||
'OPENXML',
|
||||
'OPTION',
|
||||
'OR',
|
||||
'ORDER',
|
||||
'OUTER',
|
||||
'OVER',
|
||||
'PERCENT',
|
||||
'PIVOT',
|
||||
'PLAN',
|
||||
'PRECISION',
|
||||
'PRIMARY',
|
||||
'PRINT',
|
||||
'PROC',
|
||||
'PROCEDURE',
|
||||
'PUBLIC',
|
||||
'RAISERROR',
|
||||
'READ',
|
||||
'READTEXT',
|
||||
'RECONFIGURE',
|
||||
'REFERENCES',
|
||||
'REPLICATION',
|
||||
'RESTORE',
|
||||
'RESTRICT',
|
||||
'RETURN',
|
||||
'REVERT',
|
||||
'REVOKE',
|
||||
'RIGHT',
|
||||
'ROLLBACK',
|
||||
'ROWCOUNT',
|
||||
'ROWGUIDCOL',
|
||||
'RULE',
|
||||
'SAVE',
|
||||
'SCHEMA',
|
||||
'SECURITYAUDIT',
|
||||
'SELECT',
|
||||
'SESSION_USER',
|
||||
'SET',
|
||||
'SETUSER',
|
||||
'SHUTDOWN',
|
||||
'SOME',
|
||||
'STATISTICS',
|
||||
'SYSTEM_USER',
|
||||
'TABLE',
|
||||
'TABLESAMPLE',
|
||||
'TEXTSIZE',
|
||||
'THEN',
|
||||
'TO',
|
||||
'TOP',
|
||||
'TRAN',
|
||||
'TRANSACTION',
|
||||
'TRIGGER',
|
||||
'TRUNCATE',
|
||||
'TSEQUAL',
|
||||
'UNION',
|
||||
'UNIQUE',
|
||||
'UNPIVOT',
|
||||
'UPDATE',
|
||||
'UPDATETEXT',
|
||||
'USE',
|
||||
'USER',
|
||||
'VALUES',
|
||||
'VARYING',
|
||||
'VIEW',
|
||||
'WAITFOR',
|
||||
'WHEN',
|
||||
'WHERE',
|
||||
'WHILE',
|
||||
'WITH',
|
||||
'WRITETEXT'
|
||||
);
|
||||
}
|
||||
}
|
||||
168
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLiteKeywords.php
vendored
Normal file
168
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLiteKeywords.php
vendored
Normal file
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Platforms\Keywords;
|
||||
|
||||
/**
|
||||
* SQLite Keywordlist.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class SQLiteKeywords extends KeywordList
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'SQLite';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getKeywords()
|
||||
{
|
||||
return array(
|
||||
'ABORT',
|
||||
'ACTION',
|
||||
'ADD',
|
||||
'AFTER',
|
||||
'ALL',
|
||||
'ALTER',
|
||||
'ANALYZE',
|
||||
'AND',
|
||||
'AS',
|
||||
'ASC',
|
||||
'ATTACH',
|
||||
'AUTOINCREMENT',
|
||||
'BEFORE',
|
||||
'BEGIN',
|
||||
'BETWEEN',
|
||||
'BY',
|
||||
'CASCADE',
|
||||
'CASE',
|
||||
'CAST',
|
||||
'CHECK',
|
||||
'COLLATE',
|
||||
'COLUMN',
|
||||
'COMMIT',
|
||||
'CONFLICT',
|
||||
'CONSTRAINT',
|
||||
'CREATE',
|
||||
'CROSS',
|
||||
'CURRENT_DATE',
|
||||
'CURRENT_TIME',
|
||||
'CURRENT_TIMESTAMP',
|
||||
'DATABASE',
|
||||
'DEFAULT',
|
||||
'DEFERRABLE',
|
||||
'DEFERRED',
|
||||
'DELETE',
|
||||
'DESC',
|
||||
'DETACH',
|
||||
'DISTINCT',
|
||||
'DROP',
|
||||
'EACH',
|
||||
'ELSE',
|
||||
'END',
|
||||
'ESCAPE',
|
||||
'EXCEPT',
|
||||
'EXCLUSIVE',
|
||||
'EXISTS',
|
||||
'EXPLAIN',
|
||||
'FAIL',
|
||||
'FOR',
|
||||
'FOREIGN',
|
||||
'FROM',
|
||||
'FULL',
|
||||
'GLOB',
|
||||
'GROUP',
|
||||
'HAVING',
|
||||
'IF',
|
||||
'IGNORE',
|
||||
'IMMEDIATE',
|
||||
'IN',
|
||||
'INDEX',
|
||||
'INDEXED',
|
||||
'INITIALLY',
|
||||
'INNER',
|
||||
'INSERT',
|
||||
'INSTEAD',
|
||||
'INTERSECT',
|
||||
'INTO',
|
||||
'IS',
|
||||
'ISNULL',
|
||||
'JOIN',
|
||||
'KEY',
|
||||
'LEFT',
|
||||
'LIKE',
|
||||
'LIMIT',
|
||||
'MATCH',
|
||||
'NATURAL',
|
||||
'NO',
|
||||
'NOT',
|
||||
'NOTNULL',
|
||||
'NULL',
|
||||
'OF',
|
||||
'OFFSET',
|
||||
'ON',
|
||||
'OR',
|
||||
'ORDER',
|
||||
'OUTER',
|
||||
'PLAN',
|
||||
'PRAGMA',
|
||||
'PRIMARY',
|
||||
'QUERY',
|
||||
'RAISE',
|
||||
'REFERENCES',
|
||||
'REGEXP',
|
||||
'REINDEX',
|
||||
'RELEASE',
|
||||
'RENAME',
|
||||
'REPLACE',
|
||||
'RESTRICT',
|
||||
'RIGHT',
|
||||
'ROLLBACK',
|
||||
'ROW',
|
||||
'SAVEPOINT',
|
||||
'SELECT',
|
||||
'SET',
|
||||
'TABLE',
|
||||
'TEMP',
|
||||
'TEMPORARY',
|
||||
'THEN',
|
||||
'TO',
|
||||
'TRANSACTION',
|
||||
'TRIGGER',
|
||||
'UNION',
|
||||
'UNIQUE',
|
||||
'UPDATE',
|
||||
'USING',
|
||||
'VACUUM',
|
||||
'VALUES',
|
||||
'VIEW',
|
||||
'VIRTUAL',
|
||||
'WHEN',
|
||||
'WHERE'
|
||||
);
|
||||
}
|
||||
}
|
||||
860
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
vendored
Normal file
860
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
vendored
Normal file
@@ -0,0 +1,860 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Platforms;
|
||||
|
||||
use Doctrine\DBAL\DBALException;
|
||||
use Doctrine\DBAL\Schema\TableDiff;
|
||||
use Doctrine\DBAL\Schema\Index;
|
||||
use Doctrine\DBAL\Schema\Table;
|
||||
|
||||
/**
|
||||
* The MySqlPlatform provides the behavior, features and SQL dialect of the
|
||||
* MySQL database platform. This platform represents a MySQL 5.0 or greater platform that
|
||||
* uses the InnoDB storage engine.
|
||||
*
|
||||
* @since 2.0
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @todo Rename: MySQLPlatform
|
||||
*/
|
||||
class MySqlPlatform extends AbstractPlatform
|
||||
{
|
||||
const LENGTH_LIMIT_TINYTEXT = 255;
|
||||
const LENGTH_LIMIT_TEXT = 65535;
|
||||
const LENGTH_LIMIT_MEDIUMTEXT = 16777215;
|
||||
|
||||
const LENGTH_LIMIT_TINYBLOB = 255;
|
||||
const LENGTH_LIMIT_BLOB = 65535;
|
||||
const LENGTH_LIMIT_MEDIUMBLOB = 16777215;
|
||||
|
||||
/**
|
||||
* Adds MySQL-specific LIMIT clause to the query
|
||||
* 18446744073709551615 is 2^64-1 maximum of unsigned BIGINT the biggest limit possible
|
||||
*/
|
||||
protected function doModifyLimitQuery($query, $limit, $offset)
|
||||
{
|
||||
if ($limit !== null) {
|
||||
$query .= ' LIMIT ' . $limit;
|
||||
if ($offset !== null) {
|
||||
$query .= ' OFFSET ' . $offset;
|
||||
}
|
||||
} elseif ($offset !== null) {
|
||||
$query .= ' LIMIT 18446744073709551615 OFFSET ' . $offset;
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getIdentifierQuoteCharacter()
|
||||
{
|
||||
return '`';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getRegexpExpression()
|
||||
{
|
||||
return 'RLIKE';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getGuidExpression()
|
||||
{
|
||||
return 'UUID()';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getLocateExpression($str, $substr, $startPos = false)
|
||||
{
|
||||
if ($startPos == false) {
|
||||
return 'LOCATE(' . $substr . ', ' . $str . ')';
|
||||
}
|
||||
|
||||
return 'LOCATE(' . $substr . ', ' . $str . ', '.$startPos.')';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getConcatExpression()
|
||||
{
|
||||
$args = func_get_args();
|
||||
return 'CONCAT(' . join(', ', (array) $args) . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateDiffExpression($date1, $date2)
|
||||
{
|
||||
return 'DATEDIFF(' . $date1 . ', ' . $date2 . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateAddHourExpression($date, $hours)
|
||||
{
|
||||
return 'DATE_ADD(' . $date . ', INTERVAL ' . $hours . ' HOUR)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateSubHourExpression($date, $hours)
|
||||
{
|
||||
return 'DATE_SUB(' . $date . ', INTERVAL ' . $hours . ' HOUR)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateAddDaysExpression($date, $days)
|
||||
{
|
||||
return 'DATE_ADD(' . $date . ', INTERVAL ' . $days . ' DAY)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateSubDaysExpression($date, $days)
|
||||
{
|
||||
return 'DATE_SUB(' . $date . ', INTERVAL ' . $days . ' DAY)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateAddMonthExpression($date, $months)
|
||||
{
|
||||
return 'DATE_ADD(' . $date . ', INTERVAL ' . $months . ' MONTH)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateSubMonthExpression($date, $months)
|
||||
{
|
||||
return 'DATE_SUB(' . $date . ', INTERVAL ' . $months . ' MONTH)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListDatabasesSQL()
|
||||
{
|
||||
return 'SHOW DATABASES';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListTableConstraintsSQL($table)
|
||||
{
|
||||
return 'SHOW INDEX FROM ' . $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* Two approaches to listing the table indexes. The information_schema is
|
||||
* preferred, because it doesn't cause problems with SQL keywords such as "order" or "table".
|
||||
*/
|
||||
public function getListTableIndexesSQL($table, $currentDatabase = null)
|
||||
{
|
||||
if ($currentDatabase) {
|
||||
return "SELECT TABLE_NAME AS `Table`, NON_UNIQUE AS Non_Unique, INDEX_NAME AS Key_name, ".
|
||||
"SEQ_IN_INDEX AS Seq_in_index, COLUMN_NAME AS Column_Name, COLLATION AS Collation, ".
|
||||
"CARDINALITY AS Cardinality, SUB_PART AS Sub_Part, PACKED AS Packed, " .
|
||||
"NULLABLE AS `Null`, INDEX_TYPE AS Index_Type, COMMENT AS Comment " .
|
||||
"FROM information_schema.STATISTICS WHERE TABLE_NAME = '" . $table . "' AND TABLE_SCHEMA = '" . $currentDatabase . "'";
|
||||
}
|
||||
|
||||
return 'SHOW INDEX FROM ' . $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListViewsSQL($database)
|
||||
{
|
||||
return "SELECT * FROM information_schema.VIEWS WHERE TABLE_SCHEMA = '".$database."'";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListTableForeignKeysSQL($table, $database = null)
|
||||
{
|
||||
$sql = "SELECT DISTINCT k.`CONSTRAINT_NAME`, k.`COLUMN_NAME`, k.`REFERENCED_TABLE_NAME`, ".
|
||||
"k.`REFERENCED_COLUMN_NAME` /*!50116 , c.update_rule, c.delete_rule */ ".
|
||||
"FROM information_schema.key_column_usage k /*!50116 ".
|
||||
"INNER JOIN information_schema.referential_constraints c ON ".
|
||||
" c.constraint_name = k.constraint_name AND ".
|
||||
" c.table_name = '$table' */ WHERE k.table_name = '$table'";
|
||||
|
||||
if ($database) {
|
||||
$sql .= " AND k.table_schema = '$database' /*!50116 AND c.constraint_schema = '$database' */";
|
||||
}
|
||||
|
||||
$sql .= " AND k.`REFERENCED_COLUMN_NAME` is not NULL";
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getCreateViewSQL($name, $sql)
|
||||
{
|
||||
return 'CREATE VIEW ' . $name . ' AS ' . $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDropViewSQL($name)
|
||||
{
|
||||
return 'DROP VIEW '. $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed)
|
||||
{
|
||||
return $fixed ? ($length ? 'CHAR(' . $length . ')' : 'CHAR(255)')
|
||||
: ($length ? 'VARCHAR(' . $length . ')' : 'VARCHAR(255)');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the SQL snippet used to declare a CLOB column type.
|
||||
* TINYTEXT : 2 ^ 8 - 1 = 255
|
||||
* TEXT : 2 ^ 16 - 1 = 65535
|
||||
* MEDIUMTEXT : 2 ^ 24 - 1 = 16777215
|
||||
* LONGTEXT : 2 ^ 32 - 1 = 4294967295
|
||||
*
|
||||
* @param array $field
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getClobTypeDeclarationSQL(array $field)
|
||||
{
|
||||
if ( ! empty($field['length']) && is_numeric($field['length'])) {
|
||||
$length = $field['length'];
|
||||
|
||||
if ($length <= static::LENGTH_LIMIT_TINYTEXT) {
|
||||
return 'TINYTEXT';
|
||||
}
|
||||
|
||||
if ($length <= static::LENGTH_LIMIT_TEXT) {
|
||||
return 'TEXT';
|
||||
}
|
||||
|
||||
if ($length <= static::LENGTH_LIMIT_MEDIUMTEXT) {
|
||||
return 'MEDIUMTEXT';
|
||||
}
|
||||
}
|
||||
|
||||
return 'LONGTEXT';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
|
||||
{
|
||||
if (isset($fieldDeclaration['version']) && $fieldDeclaration['version'] == true) {
|
||||
return 'TIMESTAMP';
|
||||
}
|
||||
|
||||
return 'DATETIME';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateTypeDeclarationSQL(array $fieldDeclaration)
|
||||
{
|
||||
return 'DATE';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
|
||||
{
|
||||
return 'TIME';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getBooleanTypeDeclarationSQL(array $field)
|
||||
{
|
||||
return 'TINYINT(1)';
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain DBMS specific SQL code portion needed to set the COLLATION
|
||||
* of a field declaration to be used in statements like CREATE TABLE.
|
||||
*
|
||||
* @param string $collation name of the collation
|
||||
*
|
||||
* @return string DBMS specific SQL code portion needed to set the COLLATION
|
||||
* of a field declaration.
|
||||
*/
|
||||
public function getCollationFieldDeclaration($collation)
|
||||
{
|
||||
return 'COLLATE ' . $collation;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* MySql prefers "autoincrement" identity columns since sequences can only
|
||||
* be emulated with a table.
|
||||
*/
|
||||
public function prefersIdentityColumns()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* MySql supports this through AUTO_INCREMENT columns.
|
||||
*/
|
||||
public function supportsIdentityColumns()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function supportsInlineColumnComments()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListTablesSQL()
|
||||
{
|
||||
return "SHOW FULL TABLES WHERE Table_type = 'BASE TABLE'";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListTableColumnsSQL($table, $database = null)
|
||||
{
|
||||
if ($database) {
|
||||
return "SELECT COLUMN_NAME AS Field, COLUMN_TYPE AS Type, IS_NULLABLE AS `Null`, ".
|
||||
"COLUMN_KEY AS `Key`, COLUMN_DEFAULT AS `Default`, EXTRA AS Extra, COLUMN_COMMENT AS Comment, " .
|
||||
"CHARACTER_SET_NAME AS CharacterSet, COLLATION_NAME AS CollactionName ".
|
||||
"FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = '" . $database . "' AND TABLE_NAME = '" . $table . "'";
|
||||
}
|
||||
|
||||
return 'DESCRIBE ' . $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getCreateDatabaseSQL($name)
|
||||
{
|
||||
return 'CREATE DATABASE ' . $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDropDatabaseSQL($name)
|
||||
{
|
||||
return 'DROP DATABASE ' . $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function _getCreateTableSQL($tableName, array $columns, array $options = array())
|
||||
{
|
||||
$queryFields = $this->getColumnDeclarationListSQL($columns);
|
||||
|
||||
if (isset($options['uniqueConstraints']) && ! empty($options['uniqueConstraints'])) {
|
||||
foreach ($options['uniqueConstraints'] as $index => $definition) {
|
||||
$queryFields .= ', ' . $this->getUniqueConstraintDeclarationSQL($index, $definition);
|
||||
}
|
||||
}
|
||||
|
||||
// add all indexes
|
||||
if (isset($options['indexes']) && ! empty($options['indexes'])) {
|
||||
foreach($options['indexes'] as $index => $definition) {
|
||||
$queryFields .= ', ' . $this->getIndexDeclarationSQL($index, $definition);
|
||||
}
|
||||
}
|
||||
|
||||
// attach all primary keys
|
||||
if (isset($options['primary']) && ! empty($options['primary'])) {
|
||||
$keyColumns = array_unique(array_values($options['primary']));
|
||||
$queryFields .= ', PRIMARY KEY(' . implode(', ', $keyColumns) . ')';
|
||||
}
|
||||
|
||||
$query = 'CREATE ';
|
||||
|
||||
if (!empty($options['temporary'])) {
|
||||
$query .= 'TEMPORARY ';
|
||||
}
|
||||
|
||||
$query .= 'TABLE ' . $tableName . ' (' . $queryFields . ') ';
|
||||
$query .= $this->buildTableOptions($options);
|
||||
$query .= $this->buildPartitionOptions($options);
|
||||
|
||||
$sql[] = $query;
|
||||
|
||||
if (isset($options['foreignKeys'])) {
|
||||
foreach ((array) $options['foreignKeys'] as $definition) {
|
||||
$sql[] = $this->getCreateForeignKeySQL($definition, $tableName);
|
||||
}
|
||||
}
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build SQL for table options
|
||||
*
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function buildTableOptions(array $options)
|
||||
{
|
||||
if (isset($options['table_options'])) {
|
||||
return $options['table_options'];
|
||||
}
|
||||
|
||||
$tableOptions = array();
|
||||
|
||||
// Charset
|
||||
if ( ! isset($options['charset'])) {
|
||||
$options['charset'] = 'utf8';
|
||||
}
|
||||
|
||||
$tableOptions[] = sprintf('DEFAULT CHARACTER SET %s', $options['charset']);
|
||||
|
||||
// Collate
|
||||
if ( ! isset($options['collate'])) {
|
||||
$options['collate'] = 'utf8_unicode_ci';
|
||||
}
|
||||
|
||||
$tableOptions[] = sprintf('COLLATE %s', $options['collate']);
|
||||
|
||||
// Engine
|
||||
if ( ! isset($options['engine'])) {
|
||||
$options['engine'] = 'InnoDB';
|
||||
}
|
||||
|
||||
$tableOptions[] = sprintf('ENGINE = %s', $options['engine']);
|
||||
|
||||
// Auto increment
|
||||
if (isset($options['auto_increment'])) {
|
||||
$tableOptions[] = sprintf('AUTO_INCREMENT = %s', $options['auto_increment']);
|
||||
}
|
||||
|
||||
// Comment
|
||||
if (isset($options['comment'])) {
|
||||
$comment = trim($options['comment'], " '");
|
||||
|
||||
$tableOptions[] = sprintf("COMMENT = '%s' ", str_replace("'", "''", $comment));
|
||||
}
|
||||
|
||||
// Row format
|
||||
if (isset($options['row_format'])) {
|
||||
$tableOptions[] = sprintf('ROW_FORMAT = %s', $options['row_format']);
|
||||
}
|
||||
|
||||
return implode(' ', $tableOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build SQL for partition options.
|
||||
*
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function buildPartitionOptions(array $options)
|
||||
{
|
||||
return (isset($options['partition_options']))
|
||||
? ' ' . $options['partition_options']
|
||||
: '';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getAlterTableSQL(TableDiff $diff)
|
||||
{
|
||||
$columnSql = array();
|
||||
$queryParts = array();
|
||||
if ($diff->newName !== false) {
|
||||
$queryParts[] = 'RENAME TO ' . $diff->newName;
|
||||
}
|
||||
|
||||
foreach ($diff->addedColumns as $column) {
|
||||
if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$columnArray = $column->toArray();
|
||||
$columnArray['comment'] = $this->getColumnComment($column);
|
||||
$queryParts[] = 'ADD ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray);
|
||||
}
|
||||
|
||||
foreach ($diff->removedColumns as $column) {
|
||||
if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$queryParts[] = 'DROP ' . $column->getQuotedName($this);
|
||||
}
|
||||
|
||||
foreach ($diff->changedColumns as $columnDiff) {
|
||||
if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* @var $columnDiff \Doctrine\DBAL\Schema\ColumnDiff */
|
||||
$column = $columnDiff->column;
|
||||
$columnArray = $column->toArray();
|
||||
$columnArray['comment'] = $this->getColumnComment($column);
|
||||
$queryParts[] = 'CHANGE ' . ($columnDiff->oldColumnName) . ' '
|
||||
. $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray);
|
||||
}
|
||||
|
||||
foreach ($diff->renamedColumns as $oldColumnName => $column) {
|
||||
if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$columnArray = $column->toArray();
|
||||
$columnArray['comment'] = $this->getColumnComment($column);
|
||||
$queryParts[] = 'CHANGE ' . $oldColumnName . ' '
|
||||
. $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray);
|
||||
}
|
||||
|
||||
$sql = array();
|
||||
$tableSql = array();
|
||||
|
||||
if ( ! $this->onSchemaAlterTable($diff, $tableSql)) {
|
||||
if (count($queryParts) > 0) {
|
||||
$sql[] = 'ALTER TABLE ' . $diff->name . ' ' . implode(", ", $queryParts);
|
||||
}
|
||||
$sql = array_merge(
|
||||
$this->getPreAlterTableIndexForeignKeySQL($diff),
|
||||
$sql,
|
||||
$this->getPostAlterTableIndexForeignKeySQL($diff)
|
||||
);
|
||||
}
|
||||
|
||||
return array_merge($sql, $tableSql, $columnSql);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff)
|
||||
{
|
||||
$sql = array();
|
||||
$table = $diff->name;
|
||||
|
||||
foreach ($diff->removedIndexes as $remKey => $remIndex) {
|
||||
|
||||
foreach ($diff->addedIndexes as $addKey => $addIndex) {
|
||||
if ($remIndex->getColumns() == $addIndex->getColumns()) {
|
||||
|
||||
$type = '';
|
||||
if ($addIndex->isUnique()) {
|
||||
$type = 'UNIQUE ';
|
||||
}
|
||||
|
||||
$query = 'ALTER TABLE ' . $table . ' DROP INDEX ' . $remIndex->getName() . ', ';
|
||||
$query .= 'ADD ' . $type . 'INDEX ' . $addIndex->getName();
|
||||
$query .= ' (' . $this->getIndexFieldDeclarationListSQL($addIndex->getQuotedColumns($this)) . ')';
|
||||
|
||||
$sql[] = $query;
|
||||
|
||||
unset($diff->removedIndexes[$remKey]);
|
||||
unset($diff->addedIndexes[$addKey]);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql = array_merge($sql, parent::getPreAlterTableIndexForeignKeySQL($diff));
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getCreateIndexSQLFlags(Index $index)
|
||||
{
|
||||
$type = '';
|
||||
if ($index->isUnique()) {
|
||||
$type .= 'UNIQUE ';
|
||||
} else if ($index->hasFlag('fulltext')) {
|
||||
$type .= 'FULLTEXT ';
|
||||
}
|
||||
|
||||
return $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getIntegerTypeDeclarationSQL(array $field)
|
||||
{
|
||||
return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($field);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getBigIntTypeDeclarationSQL(array $field)
|
||||
{
|
||||
return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($field);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSmallIntTypeDeclarationSQL(array $field)
|
||||
{
|
||||
return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($field);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef)
|
||||
{
|
||||
$autoinc = '';
|
||||
if ( ! empty($columnDef['autoincrement'])) {
|
||||
$autoinc = ' AUTO_INCREMENT';
|
||||
}
|
||||
$unsigned = (isset($columnDef['unsigned']) && $columnDef['unsigned']) ? ' UNSIGNED' : '';
|
||||
|
||||
return $unsigned . $autoinc;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getAdvancedForeignKeyOptionsSQL(\Doctrine\DBAL\Schema\ForeignKeyConstraint $foreignKey)
|
||||
{
|
||||
$query = '';
|
||||
if ($foreignKey->hasOption('match')) {
|
||||
$query .= ' MATCH ' . $foreignKey->getOption('match');
|
||||
}
|
||||
$query .= parent::getAdvancedForeignKeyOptionsSQL($foreignKey);
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDropIndexSQL($index, $table=null)
|
||||
{
|
||||
if ($index instanceof Index) {
|
||||
$indexName = $index->getQuotedName($this);
|
||||
} else if(is_string($index)) {
|
||||
$indexName = $index;
|
||||
} else {
|
||||
throw new \InvalidArgumentException('MysqlPlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.');
|
||||
}
|
||||
|
||||
if ($table instanceof Table) {
|
||||
$table = $table->getQuotedName($this);
|
||||
} else if(!is_string($table)) {
|
||||
throw new \InvalidArgumentException('MysqlPlatform::getDropIndexSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.');
|
||||
}
|
||||
|
||||
if ($index instanceof Index && $index->isPrimary()) {
|
||||
// mysql primary keys are always named "PRIMARY",
|
||||
// so we cannot use them in statements because of them being keyword.
|
||||
return $this->getDropPrimaryKeySQL($table);
|
||||
}
|
||||
|
||||
return 'DROP INDEX ' . $indexName . ' ON ' . $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $table
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getDropPrimaryKeySQL($table)
|
||||
{
|
||||
return 'ALTER TABLE ' . $table . ' DROP PRIMARY KEY';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSetTransactionIsolationSQL($level)
|
||||
{
|
||||
return 'SET SESSION TRANSACTION ISOLATION LEVEL ' . $this->_getTransactionIsolationLevelSQL($level);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'mysql';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getReadLockSQL()
|
||||
{
|
||||
return 'LOCK IN SHARE MODE';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function initializeDoctrineTypeMappings()
|
||||
{
|
||||
$this->doctrineTypeMapping = array(
|
||||
'tinyint' => 'boolean',
|
||||
'smallint' => 'smallint',
|
||||
'mediumint' => 'integer',
|
||||
'int' => 'integer',
|
||||
'integer' => 'integer',
|
||||
'bigint' => 'bigint',
|
||||
'tinytext' => 'text',
|
||||
'mediumtext' => 'text',
|
||||
'longtext' => 'text',
|
||||
'text' => 'text',
|
||||
'varchar' => 'string',
|
||||
'string' => 'string',
|
||||
'char' => 'string',
|
||||
'date' => 'date',
|
||||
'datetime' => 'datetime',
|
||||
'timestamp' => 'datetime',
|
||||
'time' => 'time',
|
||||
'float' => 'float',
|
||||
'double' => 'float',
|
||||
'real' => 'float',
|
||||
'decimal' => 'decimal',
|
||||
'numeric' => 'decimal',
|
||||
'year' => 'date',
|
||||
'longblob' => 'blob',
|
||||
'blob' => 'blob',
|
||||
'mediumblob' => 'blob',
|
||||
'tinyblob' => 'blob',
|
||||
'binary' => 'blob',
|
||||
'varbinary' => 'blob',
|
||||
'set' => 'simple_array',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getVarcharMaxLength()
|
||||
{
|
||||
return 65535;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getReservedKeywordsClass()
|
||||
{
|
||||
return 'Doctrine\DBAL\Platforms\Keywords\MySQLKeywords';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* MySQL commits a transaction implicitly when DROP TABLE is executed, however not
|
||||
* if DROP TEMPORARY TABLE is executed.
|
||||
*/
|
||||
public function getDropTemporaryTableSQL($table)
|
||||
{
|
||||
if ($table instanceof Table) {
|
||||
$table = $table->getQuotedName($this);
|
||||
} else if(!is_string($table)) {
|
||||
throw new \InvalidArgumentException('getDropTableSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.');
|
||||
}
|
||||
|
||||
return 'DROP TEMPORARY TABLE ' . $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the SQL Snippet used to declare a BLOB column type.
|
||||
* TINYBLOB : 2 ^ 8 - 1 = 255
|
||||
* BLOB : 2 ^ 16 - 1 = 65535
|
||||
* MEDIUMBLOB : 2 ^ 24 - 1 = 16777215
|
||||
* LONGBLOB : 2 ^ 32 - 1 = 4294967295
|
||||
*
|
||||
* @param array $field
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBlobTypeDeclarationSQL(array $field)
|
||||
{
|
||||
if ( ! empty($field['length']) && is_numeric($field['length'])) {
|
||||
$length = $field['length'];
|
||||
|
||||
if ($length <= static::LENGTH_LIMIT_TINYBLOB) {
|
||||
return 'TINYBLOB';
|
||||
}
|
||||
|
||||
if ($length <= static::LENGTH_LIMIT_BLOB) {
|
||||
return 'BLOB';
|
||||
}
|
||||
|
||||
if ($length <= static::LENGTH_LIMIT_MEDIUMBLOB) {
|
||||
return 'MEDIUMBLOB';
|
||||
}
|
||||
}
|
||||
|
||||
return 'LONGBLOB';
|
||||
}
|
||||
}
|
||||
897
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/OraclePlatform.php
vendored
Normal file
897
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/OraclePlatform.php
vendored
Normal file
@@ -0,0 +1,897 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Platforms;
|
||||
|
||||
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
|
||||
use Doctrine\DBAL\Schema\Index;
|
||||
use Doctrine\DBAL\Schema\Sequence;
|
||||
use Doctrine\DBAL\Schema\Table;
|
||||
use Doctrine\DBAL\Schema\TableDiff;
|
||||
use Doctrine\DBAL\DBALException;
|
||||
|
||||
/**
|
||||
* OraclePlatform.
|
||||
*
|
||||
* @since 2.0
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class OraclePlatform extends AbstractPlatform
|
||||
{
|
||||
/**
|
||||
* Assertion for Oracle identifiers.
|
||||
*
|
||||
* @link http://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements008.htm
|
||||
*
|
||||
* @param string $identifier
|
||||
*
|
||||
* @throws DBALException
|
||||
*/
|
||||
static public function assertValidIdentifier($identifier)
|
||||
{
|
||||
if ( ! preg_match('(^(([a-zA-Z]{1}[a-zA-Z0-9_$#]{0,})|("[^"]+"))$)', $identifier)) {
|
||||
throw new DBALException("Invalid Oracle identifier");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSubstringExpression($value, $position, $length = null)
|
||||
{
|
||||
if ($length !== null) {
|
||||
return "SUBSTR($value, $position, $length)";
|
||||
}
|
||||
|
||||
return "SUBSTR($value, $position)";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getNowExpression($type = 'timestamp')
|
||||
{
|
||||
switch ($type) {
|
||||
case 'date':
|
||||
case 'time':
|
||||
case 'timestamp':
|
||||
default:
|
||||
return 'TO_CHAR(CURRENT_TIMESTAMP, \'YYYY-MM-DD HH24:MI:SS\')';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getLocateExpression($str, $substr, $startPos = false)
|
||||
{
|
||||
if ($startPos == false) {
|
||||
return 'INSTR('.$str.', '.$substr.')';
|
||||
}
|
||||
|
||||
return 'INSTR('.$str.', '.$substr.', '.$startPos.')';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getGuidExpression()
|
||||
{
|
||||
return 'SYS_GUID()';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* Note: Since Oracle timestamp differences are calculated down to the microsecond we have to truncate
|
||||
* them to the difference in days. This is obviously a restriction of the original functionality, but we
|
||||
* need to make this a portable function.
|
||||
*/
|
||||
public function getDateDiffExpression($date1, $date2)
|
||||
{
|
||||
return "TRUNC(TO_NUMBER(SUBSTR((" . $date1 . "-" . $date2 . "), 1, INSTR(" . $date1 . "-" . $date2 .", ' '))))";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateAddHourExpression($date, $hours)
|
||||
{
|
||||
return '(' . $date . '+' . $hours . '/24)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateSubHourExpression($date, $hours)
|
||||
{
|
||||
return '(' . $date . '-' . $hours . '/24)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateAddDaysExpression($date, $days)
|
||||
{
|
||||
return '(' . $date . '+' . $days . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateSubDaysExpression($date, $days)
|
||||
{
|
||||
return '(' . $date . '-' . $days . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateAddMonthExpression($date, $months)
|
||||
{
|
||||
return "ADD_MONTHS(" . $date . ", " . $months . ")";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateSubMonthExpression($date, $months)
|
||||
{
|
||||
return "ADD_MONTHS(" . $date . ", -" . $months . ")";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getBitAndComparisonExpression($value1, $value2)
|
||||
{
|
||||
return 'BITAND('.$value1 . ', ' . $value2 . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getBitOrComparisonExpression($value1, $value2)
|
||||
{
|
||||
return '(' . $value1 . '-' .
|
||||
$this->getBitAndComparisonExpression($value1, $value2)
|
||||
. '+' . $value2 . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* Need to specifiy minvalue, since start with is hidden in the system and MINVALUE <= START WITH.
|
||||
* Therefore we can use MINVALUE to be able to get a hint what START WITH was for later introspection
|
||||
* in {@see listSequences()}
|
||||
*/
|
||||
public function getCreateSequenceSQL(Sequence $sequence)
|
||||
{
|
||||
return 'CREATE SEQUENCE ' . $sequence->getQuotedName($this) .
|
||||
' START WITH ' . $sequence->getInitialValue() .
|
||||
' MINVALUE ' . $sequence->getInitialValue() .
|
||||
' INCREMENT BY ' . $sequence->getAllocationSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getAlterSequenceSQL(\Doctrine\DBAL\Schema\Sequence $sequence)
|
||||
{
|
||||
return 'ALTER SEQUENCE ' . $sequence->getQuotedName($this) .
|
||||
' INCREMENT BY ' . $sequence->getAllocationSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSequenceNextValSQL($sequenceName)
|
||||
{
|
||||
return 'SELECT ' . $sequenceName . '.nextval FROM DUAL';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSetTransactionIsolationSQL($level)
|
||||
{
|
||||
return 'SET TRANSACTION ISOLATION LEVEL ' . $this->_getTransactionIsolationLevelSQL($level);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function _getTransactionIsolationLevelSQL($level)
|
||||
{
|
||||
switch ($level) {
|
||||
case \Doctrine\DBAL\Connection::TRANSACTION_READ_UNCOMMITTED:
|
||||
return 'READ UNCOMMITTED';
|
||||
case \Doctrine\DBAL\Connection::TRANSACTION_READ_COMMITTED:
|
||||
return 'READ COMMITTED';
|
||||
case \Doctrine\DBAL\Connection::TRANSACTION_REPEATABLE_READ:
|
||||
case \Doctrine\DBAL\Connection::TRANSACTION_SERIALIZABLE:
|
||||
return 'SERIALIZABLE';
|
||||
default:
|
||||
return parent::_getTransactionIsolationLevelSQL($level);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getBooleanTypeDeclarationSQL(array $field)
|
||||
{
|
||||
return 'NUMBER(1)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getIntegerTypeDeclarationSQL(array $field)
|
||||
{
|
||||
return 'NUMBER(10)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getBigIntTypeDeclarationSQL(array $field)
|
||||
{
|
||||
return 'NUMBER(20)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSmallIntTypeDeclarationSQL(array $field)
|
||||
{
|
||||
return 'NUMBER(5)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
|
||||
{
|
||||
return 'TIMESTAMP(0)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateTimeTzTypeDeclarationSQL(array $fieldDeclaration)
|
||||
{
|
||||
return 'TIMESTAMP(0) WITH TIME ZONE';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateTypeDeclarationSQL(array $fieldDeclaration)
|
||||
{
|
||||
return 'DATE';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
|
||||
{
|
||||
return 'DATE';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed)
|
||||
{
|
||||
return $fixed ? ($length ? 'CHAR(' . $length . ')' : 'CHAR(2000)')
|
||||
: ($length ? 'VARCHAR2(' . $length . ')' : 'VARCHAR2(4000)');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getClobTypeDeclarationSQL(array $field)
|
||||
{
|
||||
return 'CLOB';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListDatabasesSQL()
|
||||
{
|
||||
return 'SELECT username FROM all_users';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListSequencesSQL($database)
|
||||
{
|
||||
return "SELECT sequence_name, min_value, increment_by FROM sys.all_sequences ".
|
||||
"WHERE SEQUENCE_OWNER = '".strtoupper($database)."'";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function _getCreateTableSQL($table, array $columns, array $options = array())
|
||||
{
|
||||
$indexes = isset($options['indexes']) ? $options['indexes'] : array();
|
||||
$options['indexes'] = array();
|
||||
$sql = parent::_getCreateTableSQL($table, $columns, $options);
|
||||
|
||||
foreach ($columns as $name => $column) {
|
||||
if (isset($column['sequence'])) {
|
||||
$sql[] = $this->getCreateSequenceSQL($column['sequence'], 1);
|
||||
}
|
||||
|
||||
if (isset($column['autoincrement']) && $column['autoincrement'] ||
|
||||
(isset($column['autoinc']) && $column['autoinc'])) {
|
||||
$sql = array_merge($sql, $this->getCreateAutoincrementSql($name, $table));
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($indexes) && ! empty($indexes)) {
|
||||
foreach ($indexes as $index) {
|
||||
$sql[] = $this->getCreateIndexSQL($index, $table);
|
||||
}
|
||||
}
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @license New BSD License
|
||||
* @link http://ezcomponents.org/docs/api/trunk/DatabaseSchema/ezcDbSchemaOracleReader.html
|
||||
*/
|
||||
public function getListTableIndexesSQL($table, $currentDatabase = null)
|
||||
{
|
||||
$table = strtoupper($table);
|
||||
|
||||
return "SELECT uind.index_name AS name, " .
|
||||
" uind.index_type AS type, " .
|
||||
" decode( uind.uniqueness, 'NONUNIQUE', 0, 'UNIQUE', 1 ) AS is_unique, " .
|
||||
" uind_col.column_name AS column_name, " .
|
||||
" uind_col.column_position AS column_pos, " .
|
||||
" (SELECT ucon.constraint_type FROM user_constraints ucon WHERE ucon.constraint_name = uind.index_name) AS is_primary ".
|
||||
"FROM user_indexes uind, user_ind_columns uind_col " .
|
||||
"WHERE uind.index_name = uind_col.index_name AND uind_col.table_name = '$table' ORDER BY uind_col.column_position ASC";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListTablesSQL()
|
||||
{
|
||||
return 'SELECT * FROM sys.user_tables';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListViewsSQL($database)
|
||||
{
|
||||
return 'SELECT view_name, text FROM sys.user_views';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getCreateViewSQL($name, $sql)
|
||||
{
|
||||
return 'CREATE VIEW ' . $name . ' AS ' . $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDropViewSQL($name)
|
||||
{
|
||||
return 'DROP VIEW '. $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $table
|
||||
* @param integer $start
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getCreateAutoincrementSql($name, $table, $start = 1)
|
||||
{
|
||||
$table = strtoupper($table);
|
||||
$name = strtoupper($name);
|
||||
|
||||
$sql = array();
|
||||
|
||||
$indexName = $table . '_AI_PK';
|
||||
|
||||
$idx = new Index($indexName, array($name), true, true);
|
||||
|
||||
$sql[] = 'DECLARE
|
||||
constraints_Count NUMBER;
|
||||
BEGIN
|
||||
SELECT COUNT(CONSTRAINT_NAME) INTO constraints_Count FROM USER_CONSTRAINTS WHERE TABLE_NAME = \''.$table.'\' AND CONSTRAINT_TYPE = \'P\';
|
||||
IF constraints_Count = 0 OR constraints_Count = \'\' THEN
|
||||
EXECUTE IMMEDIATE \''.$this->getCreateConstraintSQL($idx, $table).'\';
|
||||
END IF;
|
||||
END;';
|
||||
|
||||
$sequenceName = $table . '_' . $name . '_SEQ';
|
||||
$sequence = new Sequence($sequenceName, $start);
|
||||
$sql[] = $this->getCreateSequenceSQL($sequence);
|
||||
|
||||
$triggerName = $table . '_AI_PK';
|
||||
$sql[] = 'CREATE TRIGGER ' . $triggerName . '
|
||||
BEFORE INSERT
|
||||
ON ' . $table . '
|
||||
FOR EACH ROW
|
||||
DECLARE
|
||||
last_Sequence NUMBER;
|
||||
last_InsertID NUMBER;
|
||||
BEGIN
|
||||
SELECT ' . $sequenceName . '.NEXTVAL INTO :NEW.' . $name . ' FROM DUAL;
|
||||
IF (:NEW.' . $name . ' IS NULL OR :NEW.'.$name.' = 0) THEN
|
||||
SELECT ' . $sequenceName . '.NEXTVAL INTO :NEW.' . $name . ' FROM DUAL;
|
||||
ELSE
|
||||
SELECT NVL(Last_Number, 0) INTO last_Sequence
|
||||
FROM User_Sequences
|
||||
WHERE Sequence_Name = \'' . $sequenceName . '\';
|
||||
SELECT :NEW.' . $name . ' INTO last_InsertID FROM DUAL;
|
||||
WHILE (last_InsertID > last_Sequence) LOOP
|
||||
SELECT ' . $sequenceName . '.NEXTVAL INTO last_Sequence FROM DUAL;
|
||||
END LOOP;
|
||||
END IF;
|
||||
END;';
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $table
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getDropAutoincrementSql($table)
|
||||
{
|
||||
$table = strtoupper($table);
|
||||
$trigger = $table . '_AI_PK';
|
||||
|
||||
$sql[] = 'DROP TRIGGER ' . $trigger;
|
||||
$sql[] = $this->getDropSequenceSQL($table.'_SEQ');
|
||||
|
||||
$indexName = $table . '_AI_PK';
|
||||
$sql[] = $this->getDropConstraintSQL($indexName, $table);
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListTableForeignKeysSQL($table)
|
||||
{
|
||||
$table = strtoupper($table);
|
||||
|
||||
return "SELECT alc.constraint_name,
|
||||
alc.DELETE_RULE,
|
||||
alc.search_condition,
|
||||
cols.column_name \"local_column\",
|
||||
cols.position,
|
||||
r_alc.table_name \"references_table\",
|
||||
r_cols.column_name \"foreign_column\"
|
||||
FROM user_cons_columns cols
|
||||
LEFT JOIN user_constraints alc
|
||||
ON alc.constraint_name = cols.constraint_name
|
||||
LEFT JOIN user_constraints r_alc
|
||||
ON alc.r_constraint_name = r_alc.constraint_name
|
||||
LEFT JOIN user_cons_columns r_cols
|
||||
ON r_alc.constraint_name = r_cols.constraint_name
|
||||
AND cols.position = r_cols.position
|
||||
WHERE alc.constraint_name = cols.constraint_name
|
||||
AND alc.constraint_type = 'R'
|
||||
AND alc.table_name = '".$table."'";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListTableConstraintsSQL($table)
|
||||
{
|
||||
$table = strtoupper($table);
|
||||
return 'SELECT * FROM user_constraints WHERE table_name = \'' . $table . '\'';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListTableColumnsSQL($table, $database = null)
|
||||
{
|
||||
$table = strtoupper($table);
|
||||
|
||||
$tabColumnsTableName = "user_tab_columns";
|
||||
$ownerCondition = '';
|
||||
|
||||
if (null !== $database){
|
||||
$database = strtoupper($database);
|
||||
$tabColumnsTableName = "all_tab_columns";
|
||||
$ownerCondition = "AND c.owner = '".$database."'";
|
||||
}
|
||||
|
||||
return "SELECT c.*, d.comments FROM $tabColumnsTableName c ".
|
||||
"INNER JOIN user_col_comments d ON d.TABLE_NAME = c.TABLE_NAME AND d.COLUMN_NAME = c.COLUMN_NAME ".
|
||||
"WHERE c.table_name = '" . $table . "' ".$ownerCondition." ORDER BY c.column_name";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDropSequenceSQL($sequence)
|
||||
{
|
||||
if ($sequence instanceof Sequence) {
|
||||
$sequence = $sequence->getQuotedName($this);
|
||||
}
|
||||
|
||||
return 'DROP SEQUENCE ' . $sequence;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDropForeignKeySQL($foreignKey, $table)
|
||||
{
|
||||
if ($foreignKey instanceof ForeignKeyConstraint) {
|
||||
$foreignKey = $foreignKey->getQuotedName($this);
|
||||
}
|
||||
|
||||
if ($table instanceof Table) {
|
||||
$table = $table->getQuotedName($this);
|
||||
}
|
||||
|
||||
return 'ALTER TABLE ' . $table . ' DROP CONSTRAINT ' . $foreignKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDropDatabaseSQL($database)
|
||||
{
|
||||
return 'DROP USER ' . $database . ' CASCADE';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getAlterTableSQL(TableDiff $diff)
|
||||
{
|
||||
$sql = array();
|
||||
$commentsSQL = array();
|
||||
$columnSql = array();
|
||||
|
||||
$fields = array();
|
||||
|
||||
foreach ($diff->addedColumns as $column) {
|
||||
if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fields[] = $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
|
||||
if ($comment = $this->getColumnComment($column)) {
|
||||
$commentsSQL[] = $this->getCommentOnColumnSQL($diff->name, $column->getName(), $comment);
|
||||
}
|
||||
}
|
||||
|
||||
if (count($fields)) {
|
||||
$sql[] = 'ALTER TABLE ' . $diff->name . ' ADD (' . implode(', ', $fields) . ')';
|
||||
}
|
||||
|
||||
$fields = array();
|
||||
foreach ($diff->changedColumns as $columnDiff) {
|
||||
if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$column = $columnDiff->column;
|
||||
$columnHasChangedComment = $columnDiff->hasChanged('comment');
|
||||
|
||||
/**
|
||||
* Do not add query part if only comment has changed
|
||||
*/
|
||||
if ( ! ($columnHasChangedComment && count($columnDiff->changedProperties) === 1)) {
|
||||
$columnInfo = $column->toArray();
|
||||
|
||||
if ( ! $columnDiff->hasChanged('notnull')) {
|
||||
$columnInfo['notnull'] = false;
|
||||
}
|
||||
|
||||
$fields[] = $column->getQuotedName($this) . ' ' . $this->getColumnDeclarationSQL('', $columnInfo);
|
||||
}
|
||||
|
||||
if ($columnHasChangedComment) {
|
||||
$commentsSQL[] = $this->getCommentOnColumnSQL(
|
||||
$diff->name,
|
||||
$column->getName(),
|
||||
$this->getColumnComment($column)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (count($fields)) {
|
||||
$sql[] = 'ALTER TABLE ' . $diff->name . ' MODIFY (' . implode(', ', $fields) . ')';
|
||||
}
|
||||
|
||||
foreach ($diff->renamedColumns as $oldColumnName => $column) {
|
||||
if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$sql[] = 'ALTER TABLE ' . $diff->name . ' RENAME COLUMN ' . $oldColumnName .' TO ' . $column->getQuotedName($this);
|
||||
}
|
||||
|
||||
$fields = array();
|
||||
foreach ($diff->removedColumns as $column) {
|
||||
if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$fields[] = $column->getQuotedName($this);
|
||||
}
|
||||
|
||||
if (count($fields)) {
|
||||
$sql[] = 'ALTER TABLE ' . $diff->name . ' DROP (' . implode(', ', $fields).')';
|
||||
}
|
||||
|
||||
$tableSql = array();
|
||||
|
||||
if ( ! $this->onSchemaAlterTable($diff, $tableSql)) {
|
||||
if ($diff->newName !== false) {
|
||||
$sql[] = 'ALTER TABLE ' . $diff->name . ' RENAME TO ' . $diff->newName;
|
||||
}
|
||||
|
||||
$sql = array_merge($sql, $this->_getAlterTableIndexForeignKeySQL($diff), $commentsSQL);
|
||||
}
|
||||
|
||||
return array_merge($sql, $tableSql, $columnSql);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function prefersSequences()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function supportsCommentOnStatement()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'oracle';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function doModifyLimitQuery($query, $limit, $offset = null)
|
||||
{
|
||||
$limit = (int) $limit;
|
||||
$offset = (int) $offset;
|
||||
|
||||
if (preg_match('/^\s*SELECT/i', $query)) {
|
||||
if (!preg_match('/\sFROM\s/i', $query)) {
|
||||
$query .= " FROM dual";
|
||||
}
|
||||
if ($limit > 0) {
|
||||
$max = $offset + $limit;
|
||||
$column = '*';
|
||||
if ($offset > 0) {
|
||||
$min = $offset + 1;
|
||||
$query = 'SELECT * FROM (SELECT a.' . $column . ', rownum AS doctrine_rownum FROM (' .
|
||||
$query .
|
||||
') a WHERE rownum <= ' . $max . ') WHERE doctrine_rownum >= ' . $min;
|
||||
} else {
|
||||
$query = 'SELECT a.' . $column . ' FROM (' . $query . ') a WHERE ROWNUM <= ' . $max;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* Oracle returns all column names in SQL result sets in uppercase.
|
||||
*/
|
||||
public function getSQLResultCasing($column)
|
||||
{
|
||||
return strtoupper($column);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getCreateTemporaryTableSnippetSQL()
|
||||
{
|
||||
return "CREATE GLOBAL TEMPORARY TABLE";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateTimeTzFormatString()
|
||||
{
|
||||
return 'Y-m-d H:i:sP';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateFormatString()
|
||||
{
|
||||
return 'Y-m-d 00:00:00';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getTimeFormatString()
|
||||
{
|
||||
return '1900-01-01 H:i:s';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function fixSchemaElementName($schemaElementName)
|
||||
{
|
||||
if (strlen($schemaElementName) > 30) {
|
||||
// Trim it
|
||||
return substr($schemaElementName, 0, 30);
|
||||
}
|
||||
|
||||
return $schemaElementName;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getMaxIdentifierLength()
|
||||
{
|
||||
return 30;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function supportsSequences()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function supportsForeignKeyOnUpdate()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function supportsReleaseSavepoints()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getTruncateTableSQL($tableName, $cascade = false)
|
||||
{
|
||||
return 'TRUNCATE TABLE '.$tableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDummySelectSQL()
|
||||
{
|
||||
return 'SELECT 1 FROM DUAL';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function initializeDoctrineTypeMappings()
|
||||
{
|
||||
$this->doctrineTypeMapping = array(
|
||||
'integer' => 'integer',
|
||||
'number' => 'integer',
|
||||
'pls_integer' => 'boolean',
|
||||
'binary_integer' => 'boolean',
|
||||
'varchar' => 'string',
|
||||
'varchar2' => 'string',
|
||||
'nvarchar2' => 'string',
|
||||
'char' => 'string',
|
||||
'nchar' => 'string',
|
||||
'date' => 'datetime',
|
||||
'timestamp' => 'datetime',
|
||||
'timestamptz' => 'datetimetz',
|
||||
'float' => 'float',
|
||||
'long' => 'string',
|
||||
'clob' => 'text',
|
||||
'nclob' => 'text',
|
||||
'raw' => 'text',
|
||||
'long raw' => 'text',
|
||||
'rowid' => 'string',
|
||||
'urowid' => 'string',
|
||||
'blob' => 'blob',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function releaseSavePoint($savepoint)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getReservedKeywordsClass()
|
||||
{
|
||||
return 'Doctrine\DBAL\Platforms\Keywords\OracleKeywords';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getBlobTypeDeclarationSQL(array $field)
|
||||
{
|
||||
return 'BLOB';
|
||||
}
|
||||
}
|
||||
880
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
vendored
Normal file
880
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
vendored
Normal file
@@ -0,0 +1,880 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Platforms;
|
||||
|
||||
use Doctrine\DBAL\Schema\TableDiff;
|
||||
|
||||
/**
|
||||
* PostgreSqlPlatform.
|
||||
*
|
||||
* @since 2.0
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @todo Rename: PostgreSQLPlatform
|
||||
*/
|
||||
class PostgreSqlPlatform extends AbstractPlatform
|
||||
{
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $useBooleanTrueFalseStrings = true;
|
||||
|
||||
/**
|
||||
* PostgreSQL has different behavior with some drivers
|
||||
* with regard to how booleans have to be handled.
|
||||
*
|
||||
* Enables use of 'true'/'false' or otherwise 1 and 0 instead.
|
||||
*
|
||||
* @param bool $flag
|
||||
*/
|
||||
public function setUseBooleanTrueFalseStrings($flag)
|
||||
{
|
||||
$this->useBooleanTrueFalseStrings = (bool)$flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSubstringExpression($value, $from, $length = null)
|
||||
{
|
||||
if ($length === null) {
|
||||
return 'SUBSTRING(' . $value . ' FROM ' . $from . ')';
|
||||
}
|
||||
|
||||
return 'SUBSTRING(' . $value . ' FROM ' . $from . ' FOR ' . $length . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getNowExpression()
|
||||
{
|
||||
return 'LOCALTIMESTAMP(0)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getRegexpExpression()
|
||||
{
|
||||
return 'SIMILAR TO';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getLocateExpression($str, $substr, $startPos = false)
|
||||
{
|
||||
if ($startPos !== false) {
|
||||
$str = $this->getSubstringExpression($str, $startPos);
|
||||
|
||||
return 'CASE WHEN (POSITION('.$substr.' IN '.$str.') = 0) THEN 0 ELSE (POSITION('.$substr.' IN '.$str.') + '.($startPos-1).') END';
|
||||
}
|
||||
|
||||
return 'POSITION('.$substr.' IN '.$str.')';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateDiffExpression($date1, $date2)
|
||||
{
|
||||
return '(DATE(' . $date1 . ')-DATE(' . $date2 . '))';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateAddHourExpression($date, $hours)
|
||||
{
|
||||
return "(" . $date ." + (" . $hours . " || ' hour')::interval)";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateSubHourExpression($date, $hours)
|
||||
{
|
||||
return "(" . $date ." - (" . $hours . " || ' hour')::interval)";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateAddDaysExpression($date, $days)
|
||||
{
|
||||
return "(" . $date ." + (" . $days . " || ' day')::interval)";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateSubDaysExpression($date, $days)
|
||||
{
|
||||
return "(" . $date ." - (" . $days . " || ' day')::interval)";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateAddMonthExpression($date, $months)
|
||||
{
|
||||
return "(" . $date ." + (" . $months . " || ' month')::interval)";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateSubMonthExpression($date, $months)
|
||||
{
|
||||
return "(" . $date ." - (" . $months . " || ' month')::interval)";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function supportsSequences()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function supportsSchemas()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function supportsIdentityColumns()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function supportsCommentOnStatement()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function prefersSequences()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function hasNativeGuidType()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListDatabasesSQL()
|
||||
{
|
||||
return 'SELECT datname FROM pg_database';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListSequencesSQL($database)
|
||||
{
|
||||
return "SELECT
|
||||
c.relname, n.nspname AS schemaname
|
||||
FROM
|
||||
pg_class c, pg_namespace n
|
||||
WHERE relkind = 'S' AND n.oid = c.relnamespace AND
|
||||
(n.nspname NOT LIKE 'pg_%' AND n.nspname != 'information_schema')";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListTablesSQL()
|
||||
{
|
||||
return "SELECT tablename AS table_name, schemaname AS schema_name
|
||||
FROM pg_tables WHERE schemaname NOT LIKE 'pg_%' AND schemaname != 'information_schema' AND tablename != 'geometry_columns' AND tablename != 'spatial_ref_sys'";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListViewsSQL($database)
|
||||
{
|
||||
return 'SELECT viewname, definition FROM pg_views';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListTableForeignKeysSQL($table, $database = null)
|
||||
{
|
||||
return "SELECT r.conname, pg_catalog.pg_get_constraintdef(r.oid, true) as condef
|
||||
FROM pg_catalog.pg_constraint r
|
||||
WHERE r.conrelid =
|
||||
(
|
||||
SELECT c.oid
|
||||
FROM pg_catalog.pg_class c, pg_catalog.pg_namespace n
|
||||
WHERE " .$this->getTableWhereClause($table) ." AND n.oid = c.relnamespace
|
||||
)
|
||||
AND r.contype = 'f'";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getCreateViewSQL($name, $sql)
|
||||
{
|
||||
return 'CREATE VIEW ' . $name . ' AS ' . $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDropViewSQL($name)
|
||||
{
|
||||
return 'DROP VIEW '. $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListTableConstraintsSQL($table)
|
||||
{
|
||||
return "SELECT
|
||||
relname
|
||||
FROM
|
||||
pg_class
|
||||
WHERE oid IN (
|
||||
SELECT indexrelid
|
||||
FROM pg_index, pg_class
|
||||
WHERE pg_class.relname = '$table'
|
||||
AND pg_class.oid = pg_index.indrelid
|
||||
AND (indisunique = 't' OR indisprimary = 't')
|
||||
)";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @license New BSD License
|
||||
* @link http://ezcomponents.org/docs/api/trunk/DatabaseSchema/ezcDbSchemaPgsqlReader.html
|
||||
*/
|
||||
public function getListTableIndexesSQL($table, $currentDatabase = null)
|
||||
{
|
||||
return "SELECT relname, pg_index.indisunique, pg_index.indisprimary,
|
||||
pg_index.indkey, pg_index.indrelid
|
||||
FROM pg_class, pg_index
|
||||
WHERE oid IN (
|
||||
SELECT indexrelid
|
||||
FROM pg_index si, pg_class sc, pg_namespace sn
|
||||
WHERE " . $this->getTableWhereClause($table, 'sc', 'sn')." AND sc.oid=si.indrelid AND sc.relnamespace = sn.oid
|
||||
) AND pg_index.indexrelid = oid";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $table
|
||||
* @param string $classAlias
|
||||
* @param string $namespaceAlias
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getTableWhereClause($table, $classAlias = 'c', $namespaceAlias = 'n')
|
||||
{
|
||||
$whereClause = $namespaceAlias.".nspname NOT IN ('pg_catalog', 'information_schema', 'pg_toast') AND ";
|
||||
if (strpos($table, ".") !== false) {
|
||||
list($schema, $table) = explode(".", $table);
|
||||
$schema = "'" . $schema . "'";
|
||||
} else {
|
||||
$schema = "ANY(string_to_array((select replace(setting,'\"\$user\"',user) from pg_catalog.pg_settings where name = 'search_path'),','))";
|
||||
}
|
||||
$whereClause .= "$classAlias.relname = '" . $table . "' AND $namespaceAlias.nspname = $schema";
|
||||
|
||||
return $whereClause;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getListTableColumnsSQL($table, $database = null)
|
||||
{
|
||||
return "SELECT
|
||||
a.attnum,
|
||||
a.attname AS field,
|
||||
t.typname AS type,
|
||||
format_type(a.atttypid, a.atttypmod) AS complete_type,
|
||||
(SELECT t1.typname FROM pg_catalog.pg_type t1 WHERE t1.oid = t.typbasetype) AS domain_type,
|
||||
(SELECT format_type(t2.typbasetype, t2.typtypmod) FROM
|
||||
pg_catalog.pg_type t2 WHERE t2.typtype = 'd' AND t2.oid = a.atttypid) AS domain_complete_type,
|
||||
a.attnotnull AS isnotnull,
|
||||
(SELECT 't'
|
||||
FROM pg_index
|
||||
WHERE c.oid = pg_index.indrelid
|
||||
AND pg_index.indkey[0] = a.attnum
|
||||
AND pg_index.indisprimary = 't'
|
||||
) AS pri,
|
||||
(SELECT pg_attrdef.adsrc
|
||||
FROM pg_attrdef
|
||||
WHERE c.oid = pg_attrdef.adrelid
|
||||
AND pg_attrdef.adnum=a.attnum
|
||||
) AS default,
|
||||
(SELECT pg_description.description
|
||||
FROM pg_description WHERE pg_description.objoid = c.oid AND a.attnum = pg_description.objsubid
|
||||
) AS comment
|
||||
FROM pg_attribute a, pg_class c, pg_type t, pg_namespace n
|
||||
WHERE ".$this->getTableWhereClause($table, 'c', 'n') ."
|
||||
AND a.attnum > 0
|
||||
AND a.attrelid = c.oid
|
||||
AND a.atttypid = t.oid
|
||||
AND n.oid = c.relnamespace
|
||||
ORDER BY a.attnum";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getCreateDatabaseSQL($name)
|
||||
{
|
||||
return 'CREATE DATABASE ' . $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getAdvancedForeignKeyOptionsSQL(\Doctrine\DBAL\Schema\ForeignKeyConstraint $foreignKey)
|
||||
{
|
||||
$query = '';
|
||||
|
||||
if ($foreignKey->hasOption('match')) {
|
||||
$query .= ' MATCH ' . $foreignKey->getOption('match');
|
||||
}
|
||||
|
||||
$query .= parent::getAdvancedForeignKeyOptionsSQL($foreignKey);
|
||||
|
||||
if ($foreignKey->hasOption('deferrable') && $foreignKey->getOption('deferrable') !== false) {
|
||||
$query .= ' DEFERRABLE';
|
||||
} else {
|
||||
$query .= ' NOT DEFERRABLE';
|
||||
}
|
||||
|
||||
if (($foreignKey->hasOption('feferred') && $foreignKey->getOption('feferred') !== false)
|
||||
|| ($foreignKey->hasOption('deferred') && $foreignKey->getOption('deferred') !== false)
|
||||
) {
|
||||
$query .= ' INITIALLY DEFERRED';
|
||||
} else {
|
||||
$query .= ' INITIALLY IMMEDIATE';
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getAlterTableSQL(TableDiff $diff)
|
||||
{
|
||||
$sql = array();
|
||||
$commentsSQL = array();
|
||||
$columnSql = array();
|
||||
|
||||
foreach ($diff->addedColumns as $column) {
|
||||
if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$query = 'ADD ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
|
||||
$sql[] = 'ALTER TABLE ' . $diff->name . ' ' . $query;
|
||||
if ($comment = $this->getColumnComment($column)) {
|
||||
$commentsSQL[] = $this->getCommentOnColumnSQL($diff->name, $column->getName(), $comment);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($diff->removedColumns as $column) {
|
||||
if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$query = 'DROP ' . $column->getQuotedName($this);
|
||||
$sql[] = 'ALTER TABLE ' . $diff->name . ' ' . $query;
|
||||
}
|
||||
|
||||
foreach ($diff->changedColumns as $columnDiff) {
|
||||
/** @var $columnDiff \Doctrine\DBAL\Schema\ColumnDiff */
|
||||
if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$oldColumnName = $columnDiff->oldColumnName;
|
||||
$column = $columnDiff->column;
|
||||
|
||||
if ($columnDiff->hasChanged('type')) {
|
||||
$type = $column->getType();
|
||||
|
||||
// here was a server version check before, but DBAL API does not support this anymore.
|
||||
$query = 'ALTER ' . $oldColumnName . ' TYPE ' . $type->getSqlDeclaration($column->toArray(), $this);
|
||||
$sql[] = 'ALTER TABLE ' . $diff->name . ' ' . $query;
|
||||
}
|
||||
|
||||
if ($columnDiff->hasChanged('default')) {
|
||||
$query = 'ALTER ' . $oldColumnName . ' SET ' . $this->getDefaultValueDeclarationSQL($column->toArray());
|
||||
$sql[] = 'ALTER TABLE ' . $diff->name . ' ' . $query;
|
||||
}
|
||||
|
||||
if ($columnDiff->hasChanged('notnull')) {
|
||||
$query = 'ALTER ' . $oldColumnName . ' ' . ($column->getNotNull() ? 'SET' : 'DROP') . ' NOT NULL';
|
||||
$sql[] = 'ALTER TABLE ' . $diff->name . ' ' . $query;
|
||||
}
|
||||
|
||||
if ($columnDiff->hasChanged('autoincrement')) {
|
||||
if ($column->getAutoincrement()) {
|
||||
// add autoincrement
|
||||
$seqName = $diff->name . '_' . $oldColumnName . '_seq';
|
||||
|
||||
$sql[] = "CREATE SEQUENCE " . $seqName;
|
||||
$sql[] = "SELECT setval('" . $seqName . "', (SELECT MAX(" . $oldColumnName . ") FROM " . $diff->name . "))";
|
||||
$query = "ALTER " . $oldColumnName . " SET DEFAULT nextval('" . $seqName . "')";
|
||||
$sql[] = "ALTER TABLE " . $diff->name . " " . $query;
|
||||
} else {
|
||||
// Drop autoincrement, but do NOT drop the sequence. It might be re-used by other tables or have
|
||||
$query = "ALTER " . $oldColumnName . " " . "DROP DEFAULT";
|
||||
$sql[] = "ALTER TABLE " . $diff->name . " " . $query;
|
||||
}
|
||||
}
|
||||
|
||||
if ($columnDiff->hasChanged('comment')) {
|
||||
$commentsSQL[] = $this->getCommentOnColumnSQL(
|
||||
$diff->name,
|
||||
$column->getName(),
|
||||
$this->getColumnComment($column)
|
||||
);
|
||||
}
|
||||
|
||||
if ($columnDiff->hasChanged('length')) {
|
||||
$query = 'ALTER ' . $column->getName() . ' TYPE ' . $column->getType()->getSqlDeclaration($column->toArray(), $this);
|
||||
$sql[] = 'ALTER TABLE ' . $diff->name . ' ' . $query;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($diff->renamedColumns as $oldColumnName => $column) {
|
||||
if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$sql[] = 'ALTER TABLE ' . $diff->name . ' RENAME COLUMN ' . $oldColumnName . ' TO ' . $column->getQuotedName($this);
|
||||
}
|
||||
|
||||
$tableSql = array();
|
||||
|
||||
if ( ! $this->onSchemaAlterTable($diff, $tableSql)) {
|
||||
if ($diff->newName !== false) {
|
||||
$sql[] = 'ALTER TABLE ' . $diff->name . ' RENAME TO ' . $diff->newName;
|
||||
}
|
||||
|
||||
$sql = array_merge($sql, $this->_getAlterTableIndexForeignKeySQL($diff), $commentsSQL);
|
||||
}
|
||||
|
||||
return array_merge($sql, $tableSql, $columnSql);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getCommentOnColumnSQL($tableName, $columnName, $comment)
|
||||
{
|
||||
$comment = $comment === null ? 'NULL' : "'$comment'";
|
||||
|
||||
return "COMMENT ON COLUMN $tableName.$columnName IS $comment";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getCreateSequenceSQL(\Doctrine\DBAL\Schema\Sequence $sequence)
|
||||
{
|
||||
return 'CREATE SEQUENCE ' . $sequence->getQuotedName($this) .
|
||||
' INCREMENT BY ' . $sequence->getAllocationSize() .
|
||||
' MINVALUE ' . $sequence->getInitialValue() .
|
||||
' START ' . $sequence->getInitialValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getAlterSequenceSQL(\Doctrine\DBAL\Schema\Sequence $sequence)
|
||||
{
|
||||
return 'ALTER SEQUENCE ' . $sequence->getQuotedName($this) .
|
||||
' INCREMENT BY ' . $sequence->getAllocationSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDropSequenceSQL($sequence)
|
||||
{
|
||||
if ($sequence instanceof \Doctrine\DBAL\Schema\Sequence) {
|
||||
$sequence = $sequence->getQuotedName($this);
|
||||
}
|
||||
return 'DROP SEQUENCE ' . $sequence . ' CASCADE';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getCreateSchemaSQL($schemaName)
|
||||
{
|
||||
return 'CREATE SCHEMA ' . $schemaName;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function schemaNeedsCreation($schemaName)
|
||||
{
|
||||
return !in_array($schemaName, array('default', 'public'));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDropForeignKeySQL($foreignKey, $table)
|
||||
{
|
||||
return $this->getDropConstraintSQL($foreignKey, $table);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function _getCreateTableSQL($tableName, array $columns, array $options = array())
|
||||
{
|
||||
$queryFields = $this->getColumnDeclarationListSQL($columns);
|
||||
|
||||
if (isset($options['primary']) && ! empty($options['primary'])) {
|
||||
$keyColumns = array_unique(array_values($options['primary']));
|
||||
$queryFields .= ', PRIMARY KEY(' . implode(', ', $keyColumns) . ')';
|
||||
}
|
||||
|
||||
$query = 'CREATE TABLE ' . $tableName . ' (' . $queryFields . ')';
|
||||
|
||||
$sql[] = $query;
|
||||
|
||||
if (isset($options['indexes']) && ! empty($options['indexes'])) {
|
||||
foreach ($options['indexes'] as $index) {
|
||||
$sql[] = $this->getCreateIndexSQL($index, $tableName);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($options['foreignKeys'])) {
|
||||
foreach ((array) $options['foreignKeys'] as $definition) {
|
||||
$sql[] = $this->getCreateForeignKeySQL($definition, $tableName);
|
||||
}
|
||||
}
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* Postgres wants boolean values converted to the strings 'true'/'false'.
|
||||
*/
|
||||
public function convertBooleans($item)
|
||||
{
|
||||
if ( ! $this->useBooleanTrueFalseStrings) {
|
||||
return parent::convertBooleans($item);
|
||||
}
|
||||
|
||||
if (is_array($item)) {
|
||||
foreach ($item as $key => $value) {
|
||||
if (is_bool($value) || is_numeric($item)) {
|
||||
$item[$key] = ($value) ? 'true' : 'false';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (is_bool($item) || is_numeric($item)) {
|
||||
$item = ($item) ? 'true' : 'false';
|
||||
}
|
||||
}
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSequenceNextValSQL($sequenceName)
|
||||
{
|
||||
return "SELECT NEXTVAL('" . $sequenceName . "')";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSetTransactionIsolationSQL($level)
|
||||
{
|
||||
return 'SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL '
|
||||
. $this->_getTransactionIsolationLevelSQL($level);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getBooleanTypeDeclarationSQL(array $field)
|
||||
{
|
||||
return 'BOOLEAN';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getIntegerTypeDeclarationSQL(array $field)
|
||||
{
|
||||
if ( ! empty($field['autoincrement'])) {
|
||||
return 'SERIAL';
|
||||
}
|
||||
|
||||
return 'INT';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getBigIntTypeDeclarationSQL(array $field)
|
||||
{
|
||||
if ( ! empty($field['autoincrement'])) {
|
||||
return 'BIGSERIAL';
|
||||
}
|
||||
return 'BIGINT';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getSmallIntTypeDeclarationSQL(array $field)
|
||||
{
|
||||
return 'SMALLINT';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getGuidTypeDeclarationSQL(array $field)
|
||||
{
|
||||
return 'UUID';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
|
||||
{
|
||||
return 'TIMESTAMP(0) WITHOUT TIME ZONE';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateTimeTzTypeDeclarationSQL(array $fieldDeclaration)
|
||||
{
|
||||
return 'TIMESTAMP(0) WITH TIME ZONE';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateTypeDeclarationSQL(array $fieldDeclaration)
|
||||
{
|
||||
return 'DATE';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
|
||||
{
|
||||
return 'TIME(0) WITHOUT TIME ZONE';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getGuidExpression()
|
||||
{
|
||||
return 'UUID_GENERATE_V4()';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed)
|
||||
{
|
||||
return $fixed ? ($length ? 'CHAR(' . $length . ')' : 'CHAR(255)')
|
||||
: ($length ? 'VARCHAR(' . $length . ')' : 'VARCHAR(255)');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getClobTypeDeclarationSQL(array $field)
|
||||
{
|
||||
return 'TEXT';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'postgresql';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* PostgreSQL returns all column names in SQL result sets in lowercase.
|
||||
*/
|
||||
public function getSQLResultCasing($column)
|
||||
{
|
||||
return strtolower($column);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateTimeTzFormatString()
|
||||
{
|
||||
return 'Y-m-d H:i:sO';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getEmptyIdentityInsertSQL($quotedTableName, $quotedIdentifierColumnName)
|
||||
{
|
||||
return 'INSERT INTO ' . $quotedTableName . ' (' . $quotedIdentifierColumnName . ') VALUES (DEFAULT)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getTruncateTableSQL($tableName, $cascade = false)
|
||||
{
|
||||
return 'TRUNCATE '.$tableName.' '.(($cascade)?'CASCADE':'');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getReadLockSQL()
|
||||
{
|
||||
return 'FOR SHARE';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function initializeDoctrineTypeMappings()
|
||||
{
|
||||
$this->doctrineTypeMapping = array(
|
||||
'smallint' => 'smallint',
|
||||
'int2' => 'smallint',
|
||||
'serial' => 'integer',
|
||||
'serial4' => 'integer',
|
||||
'int' => 'integer',
|
||||
'int4' => 'integer',
|
||||
'integer' => 'integer',
|
||||
'bigserial' => 'bigint',
|
||||
'serial8' => 'bigint',
|
||||
'bigint' => 'bigint',
|
||||
'int8' => 'bigint',
|
||||
'bool' => 'boolean',
|
||||
'boolean' => 'boolean',
|
||||
'text' => 'text',
|
||||
'varchar' => 'string',
|
||||
'interval' => 'string',
|
||||
'_varchar' => 'string',
|
||||
'char' => 'string',
|
||||
'bpchar' => 'string',
|
||||
'inet' => 'string',
|
||||
'date' => 'date',
|
||||
'datetime' => 'datetime',
|
||||
'timestamp' => 'datetime',
|
||||
'timestamptz' => 'datetimetz',
|
||||
'time' => 'time',
|
||||
'timetz' => 'time',
|
||||
'float' => 'float',
|
||||
'float4' => 'float',
|
||||
'float8' => 'float',
|
||||
'double' => 'float',
|
||||
'double precision' => 'float',
|
||||
'real' => 'float',
|
||||
'decimal' => 'decimal',
|
||||
'money' => 'decimal',
|
||||
'numeric' => 'decimal',
|
||||
'year' => 'date',
|
||||
'uuid' => 'guid',
|
||||
'bytea' => 'blob',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getVarcharMaxLength()
|
||||
{
|
||||
return 65535;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function getReservedKeywordsClass()
|
||||
{
|
||||
return 'Doctrine\DBAL\Platforms\Keywords\PostgreSQLKeywords';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getBlobTypeDeclarationSQL(array $field)
|
||||
{
|
||||
return 'BYTEA';
|
||||
}
|
||||
}
|
||||
50
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAzurePlatform.php
vendored
Normal file
50
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAzurePlatform.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Platforms;
|
||||
|
||||
use Doctrine\DBAL\Schema\Table;
|
||||
|
||||
/**
|
||||
* Platform to ensure compatibility of Doctrine with SQL Azure
|
||||
*
|
||||
* On top of SQL Server 2008 the following functionality is added:
|
||||
*
|
||||
* - Create tables with the FEDERATED ON syntax.
|
||||
*/
|
||||
class SQLAzurePlatform extends SQLServer2008Platform
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getCreateTableSQL(Table $table, $createFlags=self::CREATE_INDEXES)
|
||||
{
|
||||
$sql = parent::getCreateTableSQL($table, $createFlags);
|
||||
|
||||
if ($table->hasOption('azure.federatedOnColumnName')) {
|
||||
$distributionName = $table->getOption('azure.federatedOnDistributionName');
|
||||
$columnName = $table->getOption('azure.federatedOnColumnName');
|
||||
$stmt = ' FEDERATED ON (' . $distributionName . ' = ' . $columnName . ')';
|
||||
|
||||
$sql[0] = $sql[0] . $stmt;
|
||||
}
|
||||
|
||||
return $sql;
|
||||
}
|
||||
}
|
||||
63
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServer2005Platform.php
vendored
Normal file
63
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServer2005Platform.php
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Platforms;
|
||||
|
||||
/**
|
||||
* Platform to ensure compatibility of Doctrine with Microsoft SQL Server 2005 version and
|
||||
* higher.
|
||||
*
|
||||
* Differences to SQL Server 2008 are:
|
||||
*
|
||||
* - DATETIME2 datatype does not exist, only DATETIME which has a precision of
|
||||
* 3. This is not supported by PHP DateTime, so we are emulating it by
|
||||
* setting .000 manually.
|
||||
* - Starting with SQLServer2005 VARCHAR(MAX), VARBINARY(MAX) and
|
||||
* NVARCHAR(max) replace the old TEXT, NTEXT and IMAGE types. See
|
||||
* {@link http://www.sql-server-helper.com/faq/sql-server-2005-varchar-max-p01.aspx}
|
||||
* for more information.
|
||||
*/
|
||||
class SQLServer2005Platform extends SQLServerPlatform
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function supportsLimitOffset()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getClobTypeDeclarationSQL(array $field)
|
||||
{
|
||||
return 'VARCHAR(MAX)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* Returns Microsoft SQL Server 2005 specific keywords class
|
||||
*/
|
||||
protected function getReservedKeywordsClass()
|
||||
{
|
||||
return 'Doctrine\DBAL\Platforms\Keywords\SQLServer2005Keywords';
|
||||
}
|
||||
}
|
||||
119
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServer2008Platform.php
vendored
Normal file
119
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServer2008Platform.php
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Platforms;
|
||||
|
||||
/**
|
||||
* Platform to ensure compatibility of Doctrine with Microsoft SQL Server 2008 version.
|
||||
*
|
||||
* Differences to SQL Server 2005 and before are that a new DATETIME2 type was
|
||||
* introduced that has a higher precision.
|
||||
*/
|
||||
class SQLServer2008Platform extends SQLServer2005Platform
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
|
||||
{
|
||||
// 3 - microseconds precision length
|
||||
// http://msdn.microsoft.com/en-us/library/ms187819.aspx
|
||||
return 'DATETIME2(6)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateTypeDeclarationSQL(array $fieldDeclaration)
|
||||
{
|
||||
return 'DATE';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
|
||||
{
|
||||
return 'TIME(0)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateTimeTzTypeDeclarationSQL(array $fieldDeclaration)
|
||||
{
|
||||
return 'DATETIMEOFFSET(6)';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateTimeFormatString()
|
||||
{
|
||||
return 'Y-m-d H:i:s.u';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateTimeTzFormatString()
|
||||
{
|
||||
return 'Y-m-d H:i:s.u P';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getDateFormatString()
|
||||
{
|
||||
return 'Y-m-d';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getTimeFormatString()
|
||||
{
|
||||
return 'H:i:s';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* Adding Datetime2 Type
|
||||
*/
|
||||
protected function initializeDoctrineTypeMappings()
|
||||
{
|
||||
parent::initializeDoctrineTypeMappings();
|
||||
$this->doctrineTypeMapping['datetime2'] = 'datetime';
|
||||
$this->doctrineTypeMapping['date'] = 'date';
|
||||
$this->doctrineTypeMapping['time'] = 'time';
|
||||
$this->doctrineTypeMapping['datetimeoffset'] = 'datetimetz';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* Returns Microsoft SQL Server 2008 specific keywords class
|
||||
*/
|
||||
protected function getReservedKeywordsClass()
|
||||
{
|
||||
return 'Doctrine\DBAL\Platforms\Keywords\SQLServer2008Keywords';
|
||||
}
|
||||
}
|
||||
98
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServer2012Platform.php
vendored
Normal file
98
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServer2012Platform.php
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Platforms;
|
||||
|
||||
use Doctrine\DBAL\Schema\Sequence;
|
||||
|
||||
/**
|
||||
* Platform to ensure compatibility of Doctrine with Microsoft SQL Server 2012 version.
|
||||
*
|
||||
* Differences to SQL Server 2008 and before are that sequences are introduced.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
*/
|
||||
class SQLServer2012Platform extends SQLServer2008Platform
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getAlterSequenceSQL(Sequence $sequence)
|
||||
{
|
||||
return 'ALTER SEQUENCE ' . $sequence->getQuotedName($this) .
|
||||
' INCREMENT BY ' . $sequence->getAllocationSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getCreateSequenceSQL(Sequence $sequence)
|
||||
{
|
||||
return 'CREATE SEQUENCE ' . $sequence->getQuotedName($this) .
|
||||
' START WITH ' . $sequence->getInitialValue() .
|
||||
' INCREMENT BY ' . $sequence->getAllocationSize() .
|
||||
' MINVALUE ' . $sequence->getInitialValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDropSequenceSQL($sequence)
|
||||
{
|
||||
if ($sequence instanceof Sequence) {
|
||||
$sequence = $sequence->getQuotedName($this);
|
||||
}
|
||||
|
||||
return 'DROP SEQUENCE ' . $sequence;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getListSequencesSQL($database)
|
||||
{
|
||||
return 'SELECT seq.name, seq.increment, seq.start_value FROM sys.sequences AS seq';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSequenceNextValSQL($sequenceName)
|
||||
{
|
||||
return 'SELECT NEXT VALUE FOR ' . $sequenceName;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supportsSequences()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* Returns Microsoft SQL Server 2012 specific keywords class
|
||||
*/
|
||||
protected function getReservedKeywordsClass()
|
||||
{
|
||||
return 'Doctrine\DBAL\Platforms\Keywords\SQLServer2012Keywords';
|
||||
}
|
||||
}
|
||||
1169
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
vendored
Normal file
1169
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1027
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
vendored
Normal file
1027
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
145
vendor/doctrine/dbal/lib/Doctrine/DBAL/Portability/Connection.php
vendored
Normal file
145
vendor/doctrine/dbal/lib/Doctrine/DBAL/Portability/Connection.php
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Portability;
|
||||
|
||||
use Doctrine\DBAL\Driver;
|
||||
use Doctrine\DBAL\Cache\QueryCacheProfile;
|
||||
|
||||
/**
|
||||
* Portability wrapper for a Connection.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class Connection extends \Doctrine\DBAL\Connection
|
||||
{
|
||||
const PORTABILITY_ALL = 255;
|
||||
const PORTABILITY_NONE = 0;
|
||||
const PORTABILITY_RTRIM = 1;
|
||||
const PORTABILITY_EMPTY_TO_NULL = 4;
|
||||
const PORTABILITY_FIX_CASE = 8;
|
||||
|
||||
const PORTABILITY_ORACLE = 9;
|
||||
const PORTABILITY_POSTGRESQL = 13;
|
||||
const PORTABILITY_SQLITE = 13;
|
||||
const PORTABILITY_OTHERVENDORS = 12;
|
||||
const PORTABILITY_DRIZZLE = 13;
|
||||
const PORTABILITY_SQLSRV = 13;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
private $portability = self::PORTABILITY_NONE;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
private $case;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function connect()
|
||||
{
|
||||
$ret = parent::connect();
|
||||
if ($ret) {
|
||||
$params = $this->getParams();
|
||||
if (isset($params['portability'])) {
|
||||
if ($this->_platform->getName() === "oracle") {
|
||||
$params['portability'] = $params['portability'] & self::PORTABILITY_ORACLE;
|
||||
} else if ($this->_platform->getName() === "postgresql") {
|
||||
$params['portability'] = $params['portability'] & self::PORTABILITY_POSTGRESQL;
|
||||
} else if ($this->_platform->getName() === "sqlite") {
|
||||
$params['portability'] = $params['portability'] & self::PORTABILITY_SQLITE;
|
||||
} else if ($this->_platform->getName() === "drizzle") {
|
||||
$params['portability'] = self::PORTABILITY_DRIZZLE;
|
||||
} else if ($this->_platform->getName() === 'sqlsrv') {
|
||||
$params['portability'] = $params['portabililty'] & self::PORTABILITY_SQLSRV;
|
||||
} else {
|
||||
$params['portability'] = $params['portability'] & self::PORTABILITY_OTHERVENDORS;
|
||||
}
|
||||
$this->portability = $params['portability'];
|
||||
}
|
||||
if (isset($params['fetch_case']) && $this->portability & self::PORTABILITY_FIX_CASE) {
|
||||
if ($this->_conn instanceof \Doctrine\DBAL\Driver\PDOConnection) {
|
||||
// make use of c-level support for case handling
|
||||
$this->_conn->setAttribute(\PDO::ATTR_CASE, $params['fetch_case']);
|
||||
} else {
|
||||
$this->case = ($params['fetch_case'] == \PDO::CASE_LOWER) ? CASE_LOWER : CASE_UPPER;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getPortability()
|
||||
{
|
||||
return $this->portability;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer
|
||||
*/
|
||||
public function getFetchCase()
|
||||
{
|
||||
return $this->case;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function executeQuery($query, array $params = array(), $types = array(), QueryCacheProfile $qcp = null)
|
||||
{
|
||||
$stmt = new Statement(parent::executeQuery($query, $params, $types, $qcp), $this);
|
||||
$stmt->setFetchMode($this->defaultFetchMode);
|
||||
|
||||
return $stmt;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function prepare($statement)
|
||||
{
|
||||
$stmt = new Statement(parent::prepare($statement), $this);
|
||||
$stmt->setFetchMode($this->defaultFetchMode);
|
||||
|
||||
return $stmt;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query()
|
||||
{
|
||||
$this->connect();
|
||||
|
||||
$stmt = call_user_func_array(array($this->_conn, 'query'), func_get_args());
|
||||
$stmt = new Statement($stmt, $this);
|
||||
$stmt->setFetchMode($this->defaultFetchMode);
|
||||
|
||||
return $stmt;
|
||||
}
|
||||
}
|
||||
240
vendor/doctrine/dbal/lib/Doctrine/DBAL/Portability/Statement.php
vendored
Normal file
240
vendor/doctrine/dbal/lib/Doctrine/DBAL/Portability/Statement.php
vendored
Normal file
@@ -0,0 +1,240 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Portability;
|
||||
|
||||
use PDO;
|
||||
|
||||
/**
|
||||
* Portability wrapper for a Statement.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
private $portability;
|
||||
|
||||
/**
|
||||
* @var \Doctrine\DBAL\Driver\Statement
|
||||
*/
|
||||
private $stmt;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
private $case;
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
private $defaultFetchMode = PDO::FETCH_BOTH;
|
||||
|
||||
/**
|
||||
* Wraps <tt>Statement</tt> and applies portability measures.
|
||||
*
|
||||
* @param \Doctrine\DBAL\Driver\Statement $stmt
|
||||
* @param \Doctrine\DBAL\Portability\Connection $conn
|
||||
*/
|
||||
public function __construct($stmt, Connection $conn)
|
||||
{
|
||||
$this->stmt = $stmt;
|
||||
$this->portability = $conn->getPortability();
|
||||
$this->case = $conn->getFetchCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function bindParam($column, &$variable, $type = null,$length = null)
|
||||
{
|
||||
return $this->stmt->bindParam($column, $variable, $type);
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
||||
public function bindValue($param, $value, $type = null)
|
||||
{
|
||||
return $this->stmt->bindValue($param, $value, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function closeCursor()
|
||||
{
|
||||
return $this->stmt->closeCursor();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function columnCount()
|
||||
{
|
||||
return $this->stmt->columnCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function errorCode()
|
||||
{
|
||||
return $this->stmt->errorCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function errorInfo()
|
||||
{
|
||||
return $this->stmt->errorInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function execute($params = null)
|
||||
{
|
||||
return $this->stmt->execute($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setFetchMode($fetchMode, $arg1 = null, $arg2 = null)
|
||||
{
|
||||
$this->defaultFetchMode = $fetchMode;
|
||||
|
||||
return $this->stmt->setFetchMode($fetchMode, $arg1, $arg2);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
$data = $this->fetchAll();
|
||||
|
||||
return new \ArrayIterator($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetch($fetchMode = null)
|
||||
{
|
||||
$fetchMode = $fetchMode ?: $this->defaultFetchMode;
|
||||
|
||||
$row = $this->stmt->fetch($fetchMode);
|
||||
|
||||
$row = $this->fixRow($row,
|
||||
$this->portability & (Connection::PORTABILITY_EMPTY_TO_NULL|Connection::PORTABILITY_RTRIM),
|
||||
!is_null($this->case) && ($fetchMode == PDO::FETCH_ASSOC || $fetchMode == PDO::FETCH_BOTH) && ($this->portability & Connection::PORTABILITY_FIX_CASE)
|
||||
);
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchAll($fetchMode = null, $columnIndex = 0)
|
||||
{
|
||||
$fetchMode = $fetchMode ?: $this->defaultFetchMode;
|
||||
|
||||
if ($columnIndex != 0) {
|
||||
$rows = $this->stmt->fetchAll($fetchMode, $columnIndex);
|
||||
} else {
|
||||
$rows = $this->stmt->fetchAll($fetchMode);
|
||||
}
|
||||
|
||||
$iterateRow = $this->portability & (Connection::PORTABILITY_EMPTY_TO_NULL|Connection::PORTABILITY_RTRIM);
|
||||
$fixCase = !is_null($this->case) && ($fetchMode == PDO::FETCH_ASSOC || $fetchMode == PDO::FETCH_BOTH) && ($this->portability & Connection::PORTABILITY_FIX_CASE);
|
||||
if ( ! $iterateRow && !$fixCase) {
|
||||
return $rows;
|
||||
}
|
||||
|
||||
foreach ($rows as $num => $row) {
|
||||
$rows[$num] = $this->fixRow($row, $iterateRow, $fixCase);
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $row
|
||||
* @param integer $iterateRow
|
||||
* @param boolean $fixCase
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function fixRow($row, $iterateRow, $fixCase)
|
||||
{
|
||||
if ( ! $row) {
|
||||
return $row;
|
||||
}
|
||||
|
||||
if ($fixCase) {
|
||||
$row = array_change_key_case($row, $this->case);
|
||||
}
|
||||
|
||||
if ($iterateRow) {
|
||||
foreach ($row as $k => $v) {
|
||||
if (($this->portability & Connection::PORTABILITY_EMPTY_TO_NULL) && $v === '') {
|
||||
$row[$k] = null;
|
||||
} else if (($this->portability & Connection::PORTABILITY_RTRIM) && is_string($v)) {
|
||||
$row[$k] = rtrim($v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchColumn($columnIndex = 0)
|
||||
{
|
||||
$value = $this->stmt->fetchColumn($columnIndex);
|
||||
|
||||
if ($this->portability & (Connection::PORTABILITY_EMPTY_TO_NULL|Connection::PORTABILITY_RTRIM)) {
|
||||
if (($this->portability & Connection::PORTABILITY_EMPTY_TO_NULL) && $value === '') {
|
||||
$value = null;
|
||||
} else if (($this->portability & Connection::PORTABILITY_RTRIM) && is_string($value)) {
|
||||
$value = rtrim($value);
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rowCount()
|
||||
{
|
||||
return $this->stmt->rowCount();
|
||||
}
|
||||
}
|
||||
134
vendor/doctrine/dbal/lib/Doctrine/DBAL/Query/Expression/CompositeExpression.php
vendored
Normal file
134
vendor/doctrine/dbal/lib/Doctrine/DBAL/Query/Expression/CompositeExpression.php
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Query\Expression;
|
||||
|
||||
/**
|
||||
* Composite expression is responsible to build a group of similar expression.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.1
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class CompositeExpression implements \Countable
|
||||
{
|
||||
/**
|
||||
* Constant that represents an AND composite expression.
|
||||
*/
|
||||
const TYPE_AND = 'AND';
|
||||
|
||||
/**
|
||||
* Constant that represents an OR composite expression.
|
||||
*/
|
||||
const TYPE_OR = 'OR';
|
||||
|
||||
/**
|
||||
* The instance type of composite expression.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* Each expression part of the composite expression.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $parts = array();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $type Instance type of composite expression.
|
||||
* @param array $parts Composition of expressions to be joined on composite expression.
|
||||
*/
|
||||
public function __construct($type, array $parts = array())
|
||||
{
|
||||
$this->type = $type;
|
||||
|
||||
$this->addMultiple($parts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds multiple parts to composite expression.
|
||||
*
|
||||
* @param array $parts
|
||||
*
|
||||
* @return \Doctrine\DBAL\Query\Expression\CompositeExpression
|
||||
*/
|
||||
public function addMultiple(array $parts = array())
|
||||
{
|
||||
foreach ((array) $parts as $part) {
|
||||
$this->add($part);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an expression to composite expression.
|
||||
*
|
||||
* @param mixed $part
|
||||
*
|
||||
* @return \Doctrine\DBAL\Query\Expression\CompositeExpression
|
||||
*/
|
||||
public function add($part)
|
||||
{
|
||||
if ( ! empty($part) || ($part instanceof self && $part->count() > 0)) {
|
||||
$this->parts[] = $part;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the amount of expressions on composite expression.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
return count($this->parts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the string representation of this composite expression.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (count($this->parts) === 1) {
|
||||
return (string) $this->parts[0];
|
||||
}
|
||||
|
||||
return '(' . implode(') ' . $this->type . ' (', $this->parts) . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of this composite expression (AND/OR).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
}
|
||||
313
vendor/doctrine/dbal/lib/Doctrine/DBAL/Query/Expression/ExpressionBuilder.php
vendored
Normal file
313
vendor/doctrine/dbal/lib/Doctrine/DBAL/Query/Expression/ExpressionBuilder.php
vendored
Normal file
@@ -0,0 +1,313 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Query\Expression;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
|
||||
/**
|
||||
* ExpressionBuilder class is responsible to dynamically create SQL query parts.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.1
|
||||
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class ExpressionBuilder
|
||||
{
|
||||
const EQ = '=';
|
||||
const NEQ = '<>';
|
||||
const LT = '<';
|
||||
const LTE = '<=';
|
||||
const GT = '>';
|
||||
const GTE = '>=';
|
||||
|
||||
/**
|
||||
* The DBAL Connection.
|
||||
*
|
||||
* @var \Doctrine\DBAL\Connection
|
||||
*/
|
||||
private $connection;
|
||||
|
||||
/**
|
||||
* Initializes a new <tt>ExpressionBuilder</tt>.
|
||||
*
|
||||
* @param \Doctrine\DBAL\Connection $connection The DBAL Connection.
|
||||
*/
|
||||
public function __construct(Connection $connection)
|
||||
{
|
||||
$this->connection = $connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a conjunction of the given boolean expressions.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* [php]
|
||||
* // (u.type = ?) AND (u.role = ?)
|
||||
* $expr->andX('u.type = ?', 'u.role = ?'));
|
||||
*
|
||||
* @param mixed $x Optional clause. Defaults = null, but requires
|
||||
* at least one defined when converting to string.
|
||||
*
|
||||
* @return \Doctrine\DBAL\Query\Expression\CompositeExpression
|
||||
*/
|
||||
public function andX($x = null)
|
||||
{
|
||||
return new CompositeExpression(CompositeExpression::TYPE_AND, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a disjunction of the given boolean expressions.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* [php]
|
||||
* // (u.type = ?) OR (u.role = ?)
|
||||
* $qb->where($qb->expr()->orX('u.type = ?', 'u.role = ?'));
|
||||
*
|
||||
* @param mixed $x Optional clause. Defaults = null, but requires
|
||||
* at least one defined when converting to string.
|
||||
*
|
||||
* @return \Doctrine\DBAL\Query\Expression\CompositeExpression
|
||||
*/
|
||||
public function orX($x = null)
|
||||
{
|
||||
return new CompositeExpression(CompositeExpression::TYPE_OR, func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a comparison expression.
|
||||
*
|
||||
* @param mixed $x The left expression.
|
||||
* @param string $operator One of the ExpressionBuilder::* constants.
|
||||
* @param mixed $y The right expression.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function comparison($x, $operator, $y)
|
||||
{
|
||||
return $x . ' ' . $operator . ' ' . $y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an equality comparison expression with the given arguments.
|
||||
*
|
||||
* First argument is considered the left expression and the second is the right expression.
|
||||
* When converted to string, it will generated a <left expr> = <right expr>. Example:
|
||||
*
|
||||
* [php]
|
||||
* // u.id = ?
|
||||
* $expr->eq('u.id', '?');
|
||||
*
|
||||
* @param mixed $x The left expression.
|
||||
* @param mixed $y The right expression.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function eq($x, $y)
|
||||
{
|
||||
return $this->comparison($x, self::EQ, $y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a non equality comparison expression with the given arguments.
|
||||
* First argument is considered the left expression and the second is the right expression.
|
||||
* When converted to string, it will generated a <left expr> <> <right expr>. Example:
|
||||
*
|
||||
* [php]
|
||||
* // u.id <> 1
|
||||
* $q->where($q->expr()->neq('u.id', '1'));
|
||||
*
|
||||
* @param mixed $x The left expression.
|
||||
* @param mixed $y The right expression.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function neq($x, $y)
|
||||
{
|
||||
return $this->comparison($x, self::NEQ, $y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a lower-than comparison expression with the given arguments.
|
||||
* First argument is considered the left expression and the second is the right expression.
|
||||
* When converted to string, it will generated a <left expr> < <right expr>. Example:
|
||||
*
|
||||
* [php]
|
||||
* // u.id < ?
|
||||
* $q->where($q->expr()->lt('u.id', '?'));
|
||||
*
|
||||
* @param mixed $x The left expression.
|
||||
* @param mixed $y The right expression.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function lt($x, $y)
|
||||
{
|
||||
return $this->comparison($x, self::LT, $y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a lower-than-equal comparison expression with the given arguments.
|
||||
* First argument is considered the left expression and the second is the right expression.
|
||||
* When converted to string, it will generated a <left expr> <= <right expr>. Example:
|
||||
*
|
||||
* [php]
|
||||
* // u.id <= ?
|
||||
* $q->where($q->expr()->lte('u.id', '?'));
|
||||
*
|
||||
* @param mixed $x The left expression.
|
||||
* @param mixed $y The right expression.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function lte($x, $y)
|
||||
{
|
||||
return $this->comparison($x, self::LTE, $y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a greater-than comparison expression with the given arguments.
|
||||
* First argument is considered the left expression and the second is the right expression.
|
||||
* When converted to string, it will generated a <left expr> > <right expr>. Example:
|
||||
*
|
||||
* [php]
|
||||
* // u.id > ?
|
||||
* $q->where($q->expr()->gt('u.id', '?'));
|
||||
*
|
||||
* @param mixed $x The left expression.
|
||||
* @param mixed $y The right expression.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function gt($x, $y)
|
||||
{
|
||||
return $this->comparison($x, self::GT, $y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a greater-than-equal comparison expression with the given arguments.
|
||||
* First argument is considered the left expression and the second is the right expression.
|
||||
* When converted to string, it will generated a <left expr> >= <right expr>. Example:
|
||||
*
|
||||
* [php]
|
||||
* // u.id >= ?
|
||||
* $q->where($q->expr()->gte('u.id', '?'));
|
||||
*
|
||||
* @param mixed $x The left expression.
|
||||
* @param mixed $y The right expression.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function gte($x, $y)
|
||||
{
|
||||
return $this->comparison($x, self::GTE, $y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an IS NULL expression with the given arguments.
|
||||
*
|
||||
* @param string $x The field in string format to be restricted by IS NULL.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function isNull($x)
|
||||
{
|
||||
return $x . ' IS NULL';
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an IS NOT NULL expression with the given arguments.
|
||||
*
|
||||
* @param string $x The field in string format to be restricted by IS NOT NULL.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function isNotNull($x)
|
||||
{
|
||||
return $x . ' IS NOT NULL';
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a LIKE() comparison expression with the given arguments.
|
||||
*
|
||||
* @param string $x Field in string format to be inspected by LIKE() comparison.
|
||||
* @param mixed $y Argument to be used in LIKE() comparison.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function like($x, $y)
|
||||
{
|
||||
return $this->comparison($x, 'LIKE', $y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a NOT LIKE() comparison expression with the given arguments.
|
||||
*
|
||||
* @param string $x Field in string format to be inspected by NOT LIKE() comparison.
|
||||
* @param mixed $y Argument to be used in NOT LIKE() comparison.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function notLike($x, $y)
|
||||
{
|
||||
return $this->comparison($x, 'NOT LIKE', $y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a IN () comparison expression with the given arguments.
|
||||
*
|
||||
* @param string $x The field in string format to be inspected by IN() comparison.
|
||||
* @param array $y The array of values to be used by IN() comparison.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function in($x, array $y)
|
||||
{
|
||||
return $this->comparison($x, 'IN', '('.implode(', ', $y).')');
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a NOT IN () comparison expression with the given arguments.
|
||||
*
|
||||
* @param string $x The field in string format to be inspected by NOT IN() comparison.
|
||||
* @param array $y The array of values to be used by NOT IN() comparison.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function notIn($x, array $y)
|
||||
{
|
||||
return $this->comparison($x, 'NOT IN', '('.implode(', ', $y).')');
|
||||
}
|
||||
|
||||
/**
|
||||
* Quotes a given input parameter.
|
||||
*
|
||||
* @param mixed $input The parameter to be quoted.
|
||||
* @param string|null $type The type of the parameter.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function literal($input, $type = null)
|
||||
{
|
||||
return $this->connection->quote($input, $type);
|
||||
}
|
||||
}
|
||||
1189
vendor/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php
vendored
Normal file
1189
vendor/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
41
vendor/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryException.php
vendored
Normal file
41
vendor/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryException.php
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Query;
|
||||
|
||||
use Doctrine\DBAL\DBALException;
|
||||
|
||||
/**
|
||||
* @since 2.1.4
|
||||
*/
|
||||
class QueryException extends DBALException
|
||||
{
|
||||
/**
|
||||
* @param string $alias
|
||||
* @param array $registeredAliases
|
||||
*
|
||||
* @return \Doctrine\DBAL\Query\QueryException
|
||||
*/
|
||||
static public function unknownAlias($alias, $registeredAliases)
|
||||
{
|
||||
return new self("The given alias '" . $alias . "' is not part of " .
|
||||
"any FROM or JOIN clause table. The currently registered " .
|
||||
"aliases are: " . implode(", ", $registeredAliases) . ".");
|
||||
}
|
||||
}
|
||||
0
vendor/doctrine/dbal/lib/Doctrine/DBAL/README.markdown
vendored
Normal file
0
vendor/doctrine/dbal/lib/Doctrine/DBAL/README.markdown
vendored
Normal file
233
vendor/doctrine/dbal/lib/Doctrine/DBAL/SQLParserUtils.php
vendored
Normal file
233
vendor/doctrine/dbal/lib/Doctrine/DBAL/SQLParserUtils.php
vendored
Normal file
@@ -0,0 +1,233 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
|
||||
/**
|
||||
* Utility class that parses sql statements with regard to types and parameters.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class SQLParserUtils
|
||||
{
|
||||
const POSITIONAL_TOKEN = '\?';
|
||||
const NAMED_TOKEN = '(?<!:):[a-zA-Z_][a-zA-Z0-9_]*';
|
||||
|
||||
// Quote characters within string literals can be preceded by a backslash.
|
||||
const ESCAPED_SINGLE_QUOTED_TEXT = "'(?:[^'\\\\]|\\\\'|\\\\\\\\)*'";
|
||||
const ESCAPED_DOUBLE_QUOTED_TEXT = '"(?:[^"\\\\]|\\\\"|\\\\\\\\)*"';
|
||||
|
||||
/**
|
||||
* Gets an array of the placeholders in an sql statements as keys and their positions in the query string.
|
||||
*
|
||||
* Returns an integer => integer pair (indexed from zero) for a positional statement
|
||||
* and a string => int[] pair for a named statement.
|
||||
*
|
||||
* @param string $statement
|
||||
* @param boolean $isPositional
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
static public function getPlaceholderPositions($statement, $isPositional = true)
|
||||
{
|
||||
$match = ($isPositional) ? '?' : ':';
|
||||
if (strpos($statement, $match) === false) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$token = ($isPositional) ? self::POSITIONAL_TOKEN : self::NAMED_TOKEN;
|
||||
$paramMap = array();
|
||||
|
||||
foreach (self::getUnquotedStatementFragments($statement) as $fragment) {
|
||||
preg_match_all("/$token/", $fragment[0], $matches, PREG_OFFSET_CAPTURE);
|
||||
foreach ($matches[0] as $placeholder) {
|
||||
if ($isPositional) {
|
||||
$paramMap[] = $placeholder[1] + $fragment[1];
|
||||
} else {
|
||||
$pos = $placeholder[1] + $fragment[1];
|
||||
$paramMap[$pos] = substr($placeholder[0], 1, strlen($placeholder[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $paramMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* For a positional query this method can rewrite the sql statement with regard to array parameters.
|
||||
*
|
||||
* @param string $query The SQL query to execute.
|
||||
* @param array $params The parameters to bind to the query.
|
||||
* @param array $types The types the previous parameters are in.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws SQLParserUtilsException
|
||||
*/
|
||||
static public function expandListParameters($query, $params, $types)
|
||||
{
|
||||
$isPositional = is_int(key($params));
|
||||
$arrayPositions = array();
|
||||
$bindIndex = -1;
|
||||
|
||||
foreach ($types as $name => $type) {
|
||||
++$bindIndex;
|
||||
|
||||
if ($type !== Connection::PARAM_INT_ARRAY && $type !== Connection::PARAM_STR_ARRAY) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($isPositional) {
|
||||
$name = $bindIndex;
|
||||
}
|
||||
|
||||
$arrayPositions[$name] = false;
|
||||
}
|
||||
|
||||
if (( ! $arrayPositions && $isPositional)) {
|
||||
return array($query, $params, $types);
|
||||
}
|
||||
|
||||
$paramPos = self::getPlaceholderPositions($query, $isPositional);
|
||||
|
||||
if ($isPositional) {
|
||||
$paramOffset = 0;
|
||||
$queryOffset = 0;
|
||||
|
||||
foreach ($paramPos as $needle => $needlePos) {
|
||||
if ( ! isset($arrayPositions[$needle])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$needle += $paramOffset;
|
||||
$needlePos += $queryOffset;
|
||||
$count = count($params[$needle]);
|
||||
|
||||
$params = array_merge(
|
||||
array_slice($params, 0, $needle),
|
||||
$params[$needle],
|
||||
array_slice($params, $needle + 1)
|
||||
);
|
||||
|
||||
$types = array_merge(
|
||||
array_slice($types, 0, $needle),
|
||||
$count ?
|
||||
array_fill(0, $count, $types[$needle] - Connection::ARRAY_PARAM_OFFSET) : // array needles are at PDO::PARAM_* + 100
|
||||
array(),
|
||||
array_slice($types, $needle + 1)
|
||||
);
|
||||
|
||||
$expandStr = $count ? implode(", ", array_fill(0, $count, "?")) : 'NULL';
|
||||
$query = substr($query, 0, $needlePos) . $expandStr . substr($query, $needlePos + 1);
|
||||
|
||||
$paramOffset += ($count - 1); // Grows larger by number of parameters minus the replaced needle.
|
||||
$queryOffset += (strlen($expandStr) - 1);
|
||||
}
|
||||
|
||||
return array($query, $params, $types);
|
||||
}
|
||||
|
||||
$queryOffset = 0;
|
||||
$typesOrd = array();
|
||||
$paramsOrd = array();
|
||||
|
||||
foreach ($paramPos as $pos => $paramName) {
|
||||
$paramLen = strlen($paramName) + 1;
|
||||
$value = static::extractParam($paramName, $params, true);
|
||||
|
||||
if ( ! isset($arrayPositions[$paramName]) && ! isset($arrayPositions[':' . $paramName])) {
|
||||
$pos += $queryOffset;
|
||||
$queryOffset -= ($paramLen - 1);
|
||||
$paramsOrd[] = $value;
|
||||
$typesOrd[] = static::extractParam($paramName, $types, false, \PDO::PARAM_STR);
|
||||
$query = substr($query, 0, $pos) . '?' . substr($query, ($pos + $paramLen));
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$count = count($value);
|
||||
$expandStr = $count > 0 ? implode(', ', array_fill(0, $count, '?')) : 'NULL';
|
||||
|
||||
foreach ($value as $val) {
|
||||
$paramsOrd[] = $val;
|
||||
$typesOrd[] = static::extractParam($paramName, $types, false) - Connection::ARRAY_PARAM_OFFSET;
|
||||
}
|
||||
|
||||
$pos += $queryOffset;
|
||||
$queryOffset += (strlen($expandStr) - $paramLen);
|
||||
$query = substr($query, 0, $pos) . $expandStr . substr($query, ($pos + $paramLen));
|
||||
}
|
||||
|
||||
return array($query, $paramsOrd, $typesOrd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Slice the SQL statement around pairs of quotes and
|
||||
* return string fragments of SQL outside of quoted literals.
|
||||
* Each fragment is captured as a 2-element array:
|
||||
*
|
||||
* 0 => matched fragment string,
|
||||
* 1 => offset of fragment in $statement
|
||||
*
|
||||
* @param string $statement
|
||||
* @return array
|
||||
*/
|
||||
static private function getUnquotedStatementFragments($statement)
|
||||
{
|
||||
$literal = self::ESCAPED_SINGLE_QUOTED_TEXT . '|' . self::ESCAPED_DOUBLE_QUOTED_TEXT;
|
||||
preg_match_all("/([^'\"]+)(?:$literal)?/s", $statement, $fragments, PREG_OFFSET_CAPTURE);
|
||||
|
||||
return $fragments[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $paramName The name of the parameter (without a colon in front)
|
||||
* @param array $paramsOrTypes A hash of parameters or types
|
||||
* @param bool $isParam
|
||||
* @param mixed $defaultValue An optional default value. If omitted, an exception is thrown
|
||||
*
|
||||
* @throws SQLParserUtilsException
|
||||
* @return mixed
|
||||
*/
|
||||
static private function extractParam($paramName, $paramsOrTypes, $isParam, $defaultValue = null)
|
||||
{
|
||||
if (array_key_exists($paramName, $paramsOrTypes)) {
|
||||
return $paramsOrTypes[$paramName];
|
||||
}
|
||||
|
||||
// Hash keys can be prefixed with a colon for compatibility
|
||||
if (array_key_exists(':' . $paramName, $paramsOrTypes)) {
|
||||
return $paramsOrTypes[':' . $paramName];
|
||||
}
|
||||
|
||||
if (null !== $defaultValue) {
|
||||
return $defaultValue;
|
||||
}
|
||||
|
||||
if ($isParam) {
|
||||
throw SQLParserUtilsException::missingParam($paramName);
|
||||
}
|
||||
|
||||
throw SQLParserUtilsException::missingType($paramName);
|
||||
}
|
||||
}
|
||||
53
vendor/doctrine/dbal/lib/Doctrine/DBAL/SQLParserUtilsException.php
vendored
Normal file
53
vendor/doctrine/dbal/lib/Doctrine/DBAL/SQLParserUtilsException.php
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/*
|
||||
* $Id: $
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL;
|
||||
|
||||
/**
|
||||
* Doctrine\DBAL\ConnectionException
|
||||
*
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.4
|
||||
* @author Lars Strojny <lars@strojny.net>
|
||||
*/
|
||||
class SQLParserUtilsException extends DBALException
|
||||
{
|
||||
/**
|
||||
* @param string $paramName
|
||||
*
|
||||
* @return \Doctrine\DBAL\SQLParserUtilsException
|
||||
*/
|
||||
public static function missingParam($paramName)
|
||||
{
|
||||
return new self(sprintf('Value for :%1$s not found in params array. Params array key should be "%1$s"', $paramName));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $typeName
|
||||
*
|
||||
* @return \Doctrine\DBAL\SQLParserUtilsException
|
||||
*/
|
||||
public static function missingType($typeName)
|
||||
{
|
||||
return new self(sprintf('Value for :%1$s not found in types array. Types array key should be "%1$s"', $typeName));
|
||||
}
|
||||
}
|
||||
226
vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractAsset.php
vendored
Normal file
226
vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractAsset.php
vendored
Normal file
@@ -0,0 +1,226 @@
|
||||
<?php
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the MIT license. For more information, see
|
||||
* <http://www.doctrine-project.org>.
|
||||
*/
|
||||
|
||||
namespace Doctrine\DBAL\Schema;
|
||||
|
||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
|
||||
/**
|
||||
* The abstract asset allows to reset the name of all assets without publishing this to the public userland.
|
||||
*
|
||||
* This encapsulation hack is necessary to keep a consistent state of the database schema. Say we have a list of tables
|
||||
* array($tableName => Table($tableName)); if you want to rename the table, you have to make sure
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
abstract class AbstractAsset
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_name;
|
||||
|
||||
/**
|
||||
* Namespace of the asset. If none isset the default namespace is assumed.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected $_namespace = null;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_quoted = false;
|
||||
|
||||
/**
|
||||
* Sets the name of this asset.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function _setName($name)
|
||||
{
|
||||
if ($this->isIdentifierQuoted($name)) {
|
||||
$this->_quoted = true;
|
||||
$name = $this->trimQuotes($name);
|
||||
}
|
||||
if (strpos($name, ".") !== false) {
|
||||
$parts = explode(".", $name);
|
||||
$this->_namespace = $parts[0];
|
||||
$name = $parts[1];
|
||||
}
|
||||
$this->_name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this asset in the default namespace?
|
||||
*
|
||||
* @param string $defaultNamespaceName
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isInDefaultNamespace($defaultNamespaceName)
|
||||
{
|
||||
return $this->_namespace == $defaultNamespaceName || $this->_namespace === null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the namespace name of this asset.
|
||||
*
|
||||
* If NULL is returned this means the default namespace is used.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getNamespaceName()
|
||||
{
|
||||
return $this->_namespace;
|
||||
}
|
||||
|
||||
/**
|
||||
* The shortest name is stripped of the default namespace. All other
|
||||
* namespaced elements are returned as full-qualified names.
|
||||
*
|
||||
* @param string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getShortestName($defaultNamespaceName)
|
||||
{
|
||||
$shortestName = $this->getName();
|
||||
if ($this->_namespace == $defaultNamespaceName) {
|
||||
$shortestName = $this->_name;
|
||||
}
|
||||
|
||||
return strtolower($shortestName);
|
||||
}
|
||||
|
||||
/**
|
||||
* The normalized name is full-qualified and lowerspaced. Lowerspacing is
|
||||
* actually wrong, but we have to do it to keep our sanity. If you are
|
||||
* using database objects that only differentiate in the casing (FOO vs
|
||||
* Foo) then you will NOT be able to use Doctrine Schema abstraction.
|
||||
*
|
||||
* Every non-namespaced element is prefixed with the default namespace
|
||||
* name which is passed as argument to this method.
|
||||
*
|
||||
* @param string $defaultNamespaceName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFullQualifiedName($defaultNamespaceName)
|
||||
{
|
||||
$name = $this->getName();
|
||||
if ( ! $this->_namespace) {
|
||||
$name = $defaultNamespaceName . "." . $name;
|
||||
}
|
||||
|
||||
return strtolower($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this asset's name is quoted.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isQuoted()
|
||||
{
|
||||
return $this->_quoted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this identifier is quoted.
|
||||
*
|
||||
* @param string $identifier
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
protected function isIdentifierQuoted($identifier)
|
||||
{
|
||||
return (isset($identifier[0]) && ($identifier[0] == '`' || $identifier[0] == '"'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Trim quotes from the identifier.
|
||||
*
|
||||
* @param string $identifier
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function trimQuotes($identifier)
|
||||
{
|
||||
return str_replace(array('`', '"'), '', $identifier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of this schema asset.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
if ($this->_namespace) {
|
||||
return $this->_namespace . "." . $this->_name;
|
||||
}
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the quoted representation of this asset but only if it was defined with one. Otherwise
|
||||
* return the plain unquoted value as inserted.
|
||||
*
|
||||
* @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getQuotedName(AbstractPlatform $platform)
|
||||
{
|
||||
$keywords = $platform->getReservedKeywordsList();
|
||||
$parts = explode(".", $this->getName());
|
||||
foreach ($parts as $k => $v) {
|
||||
$parts[$k] = ($this->_quoted || $keywords->isKeyword($v)) ? $platform->quoteIdentifier($v) : $v;
|
||||
}
|
||||
|
||||
return implode(".", $parts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an identifier from a list of column names obeying a certain string length.
|
||||
*
|
||||
* This is especially important for Oracle, since it does not allow identifiers larger than 30 chars,
|
||||
* however building idents automatically for foreign keys, composite keys or such can easily create
|
||||
* very long names.
|
||||
*
|
||||
* @param array $columnNames
|
||||
* @param string $prefix
|
||||
* @param integer $maxSize
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function _generateIdentifierName($columnNames, $prefix='', $maxSize=30)
|
||||
{
|
||||
$hash = implode("", array_map(function($column) {
|
||||
return dechex(crc32($column));
|
||||
}, $columnNames));
|
||||
|
||||
return substr(strtoupper($prefix . "_" . $hash), 0, $maxSize);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user