init without trunk
This commit is contained in:
parent
ed24ac4994
commit
bb809e7233
14652 changed files with 177862 additions and 94817 deletions
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;
|
||||
} elseif ($fetchMode === PDO::FETCH_NUM) {
|
||||
return array_values($row);
|
||||
} elseif ($fetchMode === PDO::FETCH_BOTH) {
|
||||
return array_merge($row, array_values($row));
|
||||
} elseif ($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;
|
||||
} elseif ($fetchMode == PDO::FETCH_NUM) {
|
||||
return array_values($row);
|
||||
} elseif ($fetchMode == PDO::FETCH_BOTH) {
|
||||
return array_merge($row, array_values($row));
|
||||
} elseif ($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();
|
||||
}
|
||||
}
|
||||
152
vendor/doctrine/dbal/lib/Doctrine/DBAL/Configuration.php
vendored
Normal file
152
vendor/doctrine/dbal/lib/Doctrine/DBAL/Configuration.php
vendored
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
<?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|null
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default auto-commit mode for connections.
|
||||
*
|
||||
* If a connection is in auto-commit mode, then all its SQL statements will be executed and committed as individual
|
||||
* transactions. Otherwise, its SQL statements are grouped into transactions that are terminated by a call to either
|
||||
* the method commit or the method rollback. By default, new connections are in auto-commit mode.
|
||||
*
|
||||
* @param boolean $autoCommit True to enable auto-commit mode; false to disable it.
|
||||
*
|
||||
* @see getAutoCommit
|
||||
*/
|
||||
public function setAutoCommit($autoCommit)
|
||||
{
|
||||
$this->_attributes['autoCommit'] = (boolean) $autoCommit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default auto-commit mode for connections.
|
||||
*
|
||||
* @return boolean True if auto-commit mode is enabled by default for connections, false otherwise.
|
||||
*
|
||||
* @see setAutoCommit
|
||||
*/
|
||||
public function getAutoCommit()
|
||||
{
|
||||
if (isset($this->_attributes['autoCommit'])) {
|
||||
return $this->_attributes['autoCommit'];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
1626
vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php
vendored
Normal file
1626
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.");
|
||||
}
|
||||
}
|
||||
390
vendor/doctrine/dbal/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php
vendored
Normal file
390
vendor/doctrine/dbal/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php
vendored
Normal file
|
|
@ -0,0 +1,390 @@
|
|||
<?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]) {
|
||||
$this->_conn = $this->connections[$connectionName];
|
||||
|
||||
if ($forceMasterAsSlave && ! $this->keepSlave) {
|
||||
$this->connections['slave'] = $this->_conn;
|
||||
}
|
||||
|
||||
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');
|
||||
|
||||
parent::beginTransaction();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function commit()
|
||||
{
|
||||
$this->connect('master');
|
||||
|
||||
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 close()
|
||||
{
|
||||
unset($this->connections['master']);
|
||||
unset($this->connections['slave']);
|
||||
|
||||
parent::close();
|
||||
|
||||
$this->_conn = null;
|
||||
$this->connections = array('master' => null, 'slave' => null);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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');
|
||||
|
||||
parent::createSavepoint($savepoint);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function releaseSavepoint($savepoint)
|
||||
{
|
||||
$this->connect('master');
|
||||
|
||||
parent::releaseSavepoint($savepoint);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function rollbackSavepoint($savepoint)
|
||||
{
|
||||
$this->connect('master');
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
259
vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php
vendored
Normal file
259
vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php
vendored
Normal file
|
|
@ -0,0 +1,259 @@
|
|||
<?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\Driver\DriverException;
|
||||
use Doctrine\DBAL\Driver\ExceptionConverterDriver;
|
||||
|
||||
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.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new instance for an invalid specified platform version.
|
||||
*
|
||||
* @param string $version The invalid platform version given.
|
||||
* @param string $expectedFormat The expected platform version format.
|
||||
*
|
||||
* @return DBALException
|
||||
*/
|
||||
public static function invalidPlatformVersionSpecified($version, $expectedFormat)
|
||||
{
|
||||
return new self(
|
||||
sprintf(
|
||||
'Invalid platform version "%s" specified. ' .
|
||||
'The platform version has to be specified in the format: "%s".',
|
||||
$version,
|
||||
$expectedFormat
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $url The URL that was provided in the connection parameters (if any).
|
||||
*
|
||||
* @return \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
public static function driverRequired($url = null)
|
||||
{
|
||||
if ($url) {
|
||||
return new self(
|
||||
sprintf(
|
||||
"The options 'driver' or 'driverClass' are mandatory if a connection URL without scheme " .
|
||||
"is given to DriverManager::getConnection(). Given URL: %s",
|
||||
$url
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
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 \Doctrine\DBAL\Driver $driver
|
||||
* @param \Exception $driverEx
|
||||
* @param string $sql
|
||||
* @param array $params
|
||||
*
|
||||
* @return \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
public static function driverExceptionDuringQuery(Driver $driver, \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();
|
||||
|
||||
if ($driver instanceof ExceptionConverterDriver && $driverEx instanceof DriverException) {
|
||||
return $driver->convertException($msg, $driverEx);
|
||||
}
|
||||
|
||||
return new self($msg, 0, $driverEx);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Doctrine\DBAL\Driver $driver
|
||||
* @param \Exception $driverEx
|
||||
*
|
||||
* @return \Doctrine\DBAL\DBALException
|
||||
*/
|
||||
public static function driverException(Driver $driver, \Exception $driverEx)
|
||||
{
|
||||
$msg = "An exception occured in driver: " . $driverEx->getMessage();
|
||||
|
||||
if ($driver instanceof ExceptionConverterDriver && $driverEx instanceof DriverException) {
|
||||
return $driver->convertException($msg, $driverEx);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
60
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractDB2Driver.php
vendored
Normal file
60
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractDB2Driver.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\Driver;
|
||||
|
||||
use Doctrine\DBAL\Driver;
|
||||
use Doctrine\DBAL\Platforms\DB2Platform;
|
||||
use Doctrine\DBAL\Schema\DB2SchemaManager;
|
||||
|
||||
/**
|
||||
* Abstract base implementation of the {@link Doctrine\DBAL\Driver} interface for IBM DB2 based drivers.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
abstract class AbstractDB2Driver implements Driver
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabase(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
$params = $conn->getParams();
|
||||
|
||||
return $params['dbname'];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabasePlatform()
|
||||
{
|
||||
return new DB2Platform();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
return new DB2SchemaManager($conn);
|
||||
}
|
||||
}
|
||||
75
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractDriverException.php
vendored
Normal file
75
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractDriverException.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;
|
||||
|
||||
/**
|
||||
* Abstract base implementation of the {@link DriverException} interface.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
abstract class AbstractDriverException extends \Exception implements DriverException
|
||||
{
|
||||
/**
|
||||
* The driver specific error code.
|
||||
*
|
||||
* @var integer|string|null
|
||||
*/
|
||||
private $errorCode;
|
||||
|
||||
/**
|
||||
* The SQLSTATE of the driver.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
private $sqlState;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $message The driver error message.
|
||||
* @param string|null $sqlState The SQLSTATE the driver is in at the time the error occured, if any.
|
||||
* @param integer|string|null $errorCode The driver specific error code if any.
|
||||
*/
|
||||
public function __construct($message, $sqlState = null, $errorCode = null)
|
||||
{
|
||||
parent::__construct($message);
|
||||
|
||||
$this->errorCode = $errorCode;
|
||||
$this->sqlState = $sqlState;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getErrorCode()
|
||||
{
|
||||
return $this->errorCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSQLState()
|
||||
{
|
||||
return $this->sqlState;
|
||||
}
|
||||
}
|
||||
175
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php
vendored
Normal file
175
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php
vendored
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
<?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 Doctrine\DBAL\DBALException;
|
||||
use Doctrine\DBAL\Driver;
|
||||
use Doctrine\DBAL\Exception;
|
||||
use Doctrine\DBAL\Platforms\MySQL57Platform;
|
||||
use Doctrine\DBAL\Platforms\MySqlPlatform;
|
||||
use Doctrine\DBAL\Schema\MySqlSchemaManager;
|
||||
use Doctrine\DBAL\VersionAwarePlatformDriver;
|
||||
|
||||
/**
|
||||
* Abstract base implementation of the {@link Doctrine\DBAL\Driver} interface for MySQL based drivers.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
abstract class AbstractMySQLDriver implements Driver, ExceptionConverterDriver, VersionAwarePlatformDriver
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @link http://dev.mysql.com/doc/refman/5.7/en/error-messages-client.html
|
||||
* @link http://dev.mysql.com/doc/refman/5.7/en/error-messages-server.html
|
||||
*/
|
||||
public function convertException($message, DriverException $exception)
|
||||
{
|
||||
switch ($exception->getErrorCode()) {
|
||||
case '1050':
|
||||
return new Exception\TableExistsException($message, $exception);
|
||||
|
||||
case '1051':
|
||||
case '1146':
|
||||
return new Exception\TableNotFoundException($message, $exception);
|
||||
|
||||
case '1216':
|
||||
case '1217':
|
||||
case '1451':
|
||||
case '1452':
|
||||
case '1701':
|
||||
return new Exception\ForeignKeyConstraintViolationException($message, $exception);
|
||||
|
||||
case '1062':
|
||||
case '1557':
|
||||
case '1569':
|
||||
case '1586':
|
||||
return new Exception\UniqueConstraintViolationException($message, $exception);
|
||||
|
||||
case '1054':
|
||||
case '1166':
|
||||
case '1611':
|
||||
return new Exception\InvalidFieldNameException($message, $exception);
|
||||
|
||||
case '1052':
|
||||
case '1060':
|
||||
case '1110':
|
||||
return new Exception\NonUniqueFieldNameException($message, $exception);
|
||||
|
||||
case '1064':
|
||||
case '1149':
|
||||
case '1287':
|
||||
case '1341':
|
||||
case '1342':
|
||||
case '1343':
|
||||
case '1344':
|
||||
case '1382':
|
||||
case '1479':
|
||||
case '1541':
|
||||
case '1554':
|
||||
case '1626':
|
||||
return new Exception\SyntaxErrorException($message, $exception);
|
||||
|
||||
case '1044':
|
||||
case '1045':
|
||||
case '1046':
|
||||
case '1049':
|
||||
case '1095':
|
||||
case '1142':
|
||||
case '1143':
|
||||
case '1227':
|
||||
case '1370':
|
||||
case '2002':
|
||||
case '2005':
|
||||
return new Exception\ConnectionException($message, $exception);
|
||||
|
||||
case '1048':
|
||||
case '1121':
|
||||
case '1138':
|
||||
case '1171':
|
||||
case '1252':
|
||||
case '1263':
|
||||
case '1566':
|
||||
return new Exception\NotNullConstraintViolationException($message, $exception);
|
||||
}
|
||||
|
||||
return new Exception\DriverException($message, $exception);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createDatabasePlatformForVersion($version)
|
||||
{
|
||||
if ( ! preg_match('/^(?P<major>\d+)(?:\.(?P<minor>\d+)(?:\.(?P<patch>\d+))?)?/', $version, $versionParts)) {
|
||||
throw DBALException::invalidPlatformVersionSpecified(
|
||||
$version,
|
||||
'<major_version>.<minor_version>.<patch_version>'
|
||||
);
|
||||
}
|
||||
|
||||
if (false !== stripos($version, 'mariadb')) {
|
||||
return $this->getDatabasePlatform();
|
||||
}
|
||||
|
||||
$majorVersion = $versionParts['major'];
|
||||
$minorVersion = isset($versionParts['minor']) ? $versionParts['minor'] : 0;
|
||||
$patchVersion = isset($versionParts['patch']) ? $versionParts['patch'] : 0;
|
||||
$version = $majorVersion . '.' . $minorVersion . '.' . $patchVersion;
|
||||
|
||||
if (version_compare($version, '5.7', '>=')) {
|
||||
return new MySQL57Platform();
|
||||
}
|
||||
|
||||
return $this->getDatabasePlatform();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabase(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
$params = $conn->getParams();
|
||||
|
||||
if (isset($params['dbname'])) {
|
||||
return $params['dbname'];
|
||||
}
|
||||
|
||||
return $conn->query('SELECT DATABASE()')->fetchColumn();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabasePlatform()
|
||||
{
|
||||
return new MySqlPlatform();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
return new MySqlSchemaManager($conn);
|
||||
}
|
||||
}
|
||||
151
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractOracleDriver.php
vendored
Normal file
151
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractOracleDriver.php
vendored
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
<?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 Doctrine\DBAL\Driver;
|
||||
use Doctrine\DBAL\Exception;
|
||||
use Doctrine\DBAL\Platforms\OraclePlatform;
|
||||
use Doctrine\DBAL\Schema\OracleSchemaManager;
|
||||
|
||||
/**
|
||||
* Abstract base implementation of the {@link Doctrine\DBAL\Driver} interface for Oracle based drivers.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
abstract class AbstractOracleDriver implements Driver, ExceptionConverterDriver
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function convertException($message, DriverException $exception)
|
||||
{
|
||||
switch ($exception->getErrorCode()) {
|
||||
case '1':
|
||||
case '2299':
|
||||
case '38911':
|
||||
return new Exception\UniqueConstraintViolationException($message, $exception);
|
||||
|
||||
case '904':
|
||||
return new Exception\InvalidFieldNameException($message, $exception);
|
||||
|
||||
case '918':
|
||||
case '960':
|
||||
return new Exception\NonUniqueFieldNameException($message, $exception);
|
||||
|
||||
case '923':
|
||||
return new Exception\SyntaxErrorException($message, $exception);
|
||||
|
||||
case '942':
|
||||
return new Exception\TableNotFoundException($message, $exception);
|
||||
|
||||
case '955':
|
||||
return new Exception\TableExistsException($message, $exception);
|
||||
|
||||
case '1017':
|
||||
case '12545':
|
||||
return new Exception\ConnectionException($message, $exception);
|
||||
|
||||
case '1400':
|
||||
return new Exception\NotNullConstraintViolationException($message, $exception);
|
||||
|
||||
case '2266':
|
||||
case '2291':
|
||||
case '2292':
|
||||
return new Exception\ForeignKeyConstraintViolationException($message, $exception);
|
||||
}
|
||||
|
||||
return new Exception\DriverException($message, $exception);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabase(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
$params = $conn->getParams();
|
||||
|
||||
return $params['user'];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabasePlatform()
|
||||
{
|
||||
return new OraclePlatform();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
return new OracleSchemaManager($conn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an appropriate Easy Connect String for the given parameters.
|
||||
*
|
||||
* @param array $params The connection parameters to return the Easy Connect STring for.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @link http://download.oracle.com/docs/cd/E11882_01/network.112/e10836/naming.htm
|
||||
*/
|
||||
protected function getEasyConnectString(array $params)
|
||||
{
|
||||
if ( ! empty($params['host'])) {
|
||||
if ( ! isset($params['port'])) {
|
||||
$params['port'] = 1521;
|
||||
}
|
||||
|
||||
$serviceName = $params['dbname'];
|
||||
|
||||
if ( ! empty($params['servicename'])) {
|
||||
$serviceName = $params['servicename'];
|
||||
}
|
||||
|
||||
$service = 'SID=' . $serviceName;
|
||||
$pooled = '';
|
||||
$instance = '';
|
||||
|
||||
if (isset($params['service']) && $params['service'] == true) {
|
||||
$service = 'SERVICE_NAME=' . $serviceName;
|
||||
}
|
||||
|
||||
if (isset($params['instancename']) && ! empty($params['instancename'])) {
|
||||
$instance = '(INSTANCE_NAME = ' . $params['instancename'] . ')';
|
||||
}
|
||||
|
||||
if (isset($params['pooled']) && $params['pooled'] == true) {
|
||||
$pooled = '(SERVER=POOLED)';
|
||||
}
|
||||
|
||||
return '(DESCRIPTION=' .
|
||||
'(ADDRESS=(PROTOCOL=TCP)(HOST=' . $params['host'] . ')(PORT=' . $params['port'] . '))' .
|
||||
'(CONNECT_DATA=(' . $service . ')' . $instance . $pooled . '))';
|
||||
|
||||
}
|
||||
|
||||
return isset($params['dbname']) ? $params['dbname'] : '';
|
||||
}
|
||||
}
|
||||
148
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php
vendored
Normal file
148
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.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\Driver;
|
||||
|
||||
use Doctrine\DBAL\DBALException;
|
||||
use Doctrine\DBAL\Driver;
|
||||
use Doctrine\DBAL\Exception;
|
||||
use Doctrine\DBAL\Platforms\PostgreSQL91Platform;
|
||||
use Doctrine\DBAL\Platforms\PostgreSQL92Platform;
|
||||
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
|
||||
use Doctrine\DBAL\Schema\PostgreSqlSchemaManager;
|
||||
use Doctrine\DBAL\VersionAwarePlatformDriver;
|
||||
|
||||
/**
|
||||
* Abstract base implementation of the {@link Doctrine\DBAL\Driver} interface for PostgreSQL based drivers.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
abstract class AbstractPostgreSQLDriver implements Driver, ExceptionConverterDriver, VersionAwarePlatformDriver
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @link http://www.postgresql.org/docs/9.3/static/errcodes-appendix.html
|
||||
*/
|
||||
public function convertException($message, DriverException $exception)
|
||||
{
|
||||
switch ($exception->getSQLState()) {
|
||||
case '0A000':
|
||||
// Foreign key constraint violations during a TRUNCATE operation
|
||||
// are considered "feature not supported" in PostgreSQL.
|
||||
if (strpos($exception->getMessage(), 'truncate') !== false) {
|
||||
return new Exception\ForeignKeyConstraintViolationException($message, $exception);
|
||||
}
|
||||
|
||||
break;
|
||||
case '23502':
|
||||
return new Exception\NotNullConstraintViolationException($message, $exception);
|
||||
|
||||
case '23503':
|
||||
return new Exception\ForeignKeyConstraintViolationException($message, $exception);
|
||||
|
||||
case '23505':
|
||||
return new Exception\UniqueConstraintViolationException($message, $exception);
|
||||
|
||||
case '42601':
|
||||
return new Exception\SyntaxErrorException($message, $exception);
|
||||
|
||||
case '42702':
|
||||
return new Exception\NonUniqueFieldNameException($message, $exception);
|
||||
|
||||
case '42703':
|
||||
return new Exception\InvalidFieldNameException($message, $exception);
|
||||
|
||||
case '42P01':
|
||||
return new Exception\TableNotFoundException($message, $exception);
|
||||
|
||||
case '42P07':
|
||||
return new Exception\TableExistsException($message, $exception);
|
||||
|
||||
case '7':
|
||||
// In some case (mainly connection errors) the PDO exception does not provide a SQLSTATE via its code.
|
||||
// The exception code is always set to 7 here.
|
||||
// We have to match against the SQLSTATE in the error message in these cases.
|
||||
if (strpos($exception->getMessage(), 'SQLSTATE[08006]') !== false) {
|
||||
return new Exception\ConnectionException($message, $exception);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return new Exception\DriverException($message, $exception);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createDatabasePlatformForVersion($version)
|
||||
{
|
||||
if ( ! preg_match('/^(?P<major>\d+)(?:\.(?P<minor>\d+)(?:\.(?P<patch>\d+))?)?/', $version, $versionParts)) {
|
||||
throw DBALException::invalidPlatformVersionSpecified(
|
||||
$version,
|
||||
'<major_version>.<minor_version>.<patch_version>'
|
||||
);
|
||||
}
|
||||
|
||||
$majorVersion = $versionParts['major'];
|
||||
$minorVersion = isset($versionParts['minor']) ? $versionParts['minor'] : 0;
|
||||
$patchVersion = isset($versionParts['patch']) ? $versionParts['patch'] : 0;
|
||||
$version = $majorVersion . '.' . $minorVersion . '.' . $patchVersion;
|
||||
|
||||
switch(true) {
|
||||
case version_compare($version, '9.2', '>='):
|
||||
return new PostgreSQL92Platform();
|
||||
case version_compare($version, '9.1', '>='):
|
||||
return new PostgreSQL91Platform();
|
||||
default:
|
||||
return new PostgreSqlPlatform();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabase(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
$params = $conn->getParams();
|
||||
|
||||
return (isset($params['dbname']))
|
||||
? $params['dbname']
|
||||
: $conn->query('SELECT CURRENT_DATABASE()')->fetchColumn();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabasePlatform()
|
||||
{
|
||||
return new PostgreSqlPlatform();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
return new PostgreSqlSchemaManager($conn);
|
||||
}
|
||||
}
|
||||
141
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLAnywhereDriver.php
vendored
Normal file
141
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLAnywhereDriver.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\Driver;
|
||||
|
||||
use Doctrine\DBAL\DBALException;
|
||||
use Doctrine\DBAL\Driver;
|
||||
use Doctrine\DBAL\Exception;
|
||||
use Doctrine\DBAL\Platforms\SQLAnywhere11Platform;
|
||||
use Doctrine\DBAL\Platforms\SQLAnywhere12Platform;
|
||||
use Doctrine\DBAL\Platforms\SQLAnywhere16Platform;
|
||||
use Doctrine\DBAL\Platforms\SQLAnywherePlatform;
|
||||
use Doctrine\DBAL\Schema\SQLAnywhereSchemaManager;
|
||||
use Doctrine\DBAL\VersionAwarePlatformDriver;
|
||||
|
||||
/**
|
||||
* Abstract base implementation of the {@link Doctrine\DBAL\Driver} interface for SAP Sybase SQL Anywhere based drivers.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
abstract class AbstractSQLAnywhereDriver implements Driver, ExceptionConverterDriver, VersionAwarePlatformDriver
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @link http://dcx.sybase.com/index.html#sa160/en/saerrors/sqlerror.html
|
||||
*/
|
||||
public function convertException($message, DriverException $exception)
|
||||
{
|
||||
switch ($exception->getErrorCode()) {
|
||||
case '-100':
|
||||
case '-103':
|
||||
case '-832':
|
||||
return new Exception\ConnectionException($message, $exception);
|
||||
case '-143':
|
||||
return new Exception\InvalidFieldNameException($message, $exception);
|
||||
case '-193':
|
||||
case '-196':
|
||||
return new Exception\UniqueConstraintViolationException($message, $exception);
|
||||
case '-194':
|
||||
case '-198':
|
||||
return new Exception\ForeignKeyConstraintViolationException($message, $exception);
|
||||
case '-144':
|
||||
return new Exception\NonUniqueFieldNameException($message, $exception);
|
||||
case '-184':
|
||||
case '-195':
|
||||
return new Exception\NotNullConstraintViolationException($message, $exception);
|
||||
case '-131':
|
||||
return new Exception\SyntaxErrorException($message, $exception);
|
||||
case '-110':
|
||||
return new Exception\TableExistsException($message, $exception);
|
||||
case '-141':
|
||||
case '-1041':
|
||||
return new Exception\TableNotFoundException($message, $exception);
|
||||
}
|
||||
|
||||
return new Exception\DriverException($message, $exception);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createDatabasePlatformForVersion($version)
|
||||
{
|
||||
if ( ! preg_match(
|
||||
'/^(?P<major>\d+)(?:\.(?P<minor>\d+)(?:\.(?P<patch>\d+)(?:\.(?P<build>\d+))?)?)?/',
|
||||
$version,
|
||||
$versionParts
|
||||
)) {
|
||||
throw DBALException::invalidPlatformVersionSpecified(
|
||||
$version,
|
||||
'<major_version>.<minor_version>.<patch_version>.<build_version>'
|
||||
);
|
||||
}
|
||||
|
||||
$majorVersion = $versionParts['major'];
|
||||
$minorVersion = isset($versionParts['minor']) ? $versionParts['minor'] : 0;
|
||||
$patchVersion = isset($versionParts['patch']) ? $versionParts['patch'] : 0;
|
||||
$buildVersion = isset($versionParts['build']) ? $versionParts['build'] : 0;
|
||||
$version = $majorVersion . '.' . $minorVersion . '.' . $patchVersion . '.' . $buildVersion;
|
||||
|
||||
switch(true) {
|
||||
case version_compare($version, '16', '>='):
|
||||
return new SQLAnywhere16Platform();
|
||||
case version_compare($version, '12', '>='):
|
||||
return new SQLAnywhere12Platform();
|
||||
case version_compare($version, '11', '>='):
|
||||
return new SQLAnywhere11Platform();
|
||||
default:
|
||||
return new SQLAnywherePlatform();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabase(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
$params = $conn->getParams();
|
||||
|
||||
if (isset($params['dbname'])) {
|
||||
return $params['dbname'];
|
||||
}
|
||||
|
||||
return $conn->query('SELECT DB_NAME()')->fetchColumn();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabasePlatform()
|
||||
{
|
||||
return new SQLAnywhere12Platform();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
return new SQLAnywhereSchemaManager($conn);
|
||||
}
|
||||
}
|
||||
104
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLServerDriver.php
vendored
Normal file
104
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLServerDriver.php
vendored
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
<?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 Doctrine\DBAL\DBALException;
|
||||
use Doctrine\DBAL\Driver;
|
||||
use Doctrine\DBAL\Platforms\SQLServer2005Platform;
|
||||
use Doctrine\DBAL\Platforms\SQLServer2008Platform;
|
||||
use Doctrine\DBAL\Platforms\SQLServer2012Platform;
|
||||
use Doctrine\DBAL\Platforms\SQLServerPlatform;
|
||||
use Doctrine\DBAL\Schema\SQLServerSchemaManager;
|
||||
use Doctrine\DBAL\VersionAwarePlatformDriver;
|
||||
|
||||
/**
|
||||
* Abstract base implementation of the {@link Doctrine\DBAL\Driver} interface for Microsoft SQL Server based drivers.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
abstract class AbstractSQLServerDriver implements Driver, VersionAwarePlatformDriver
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createDatabasePlatformForVersion($version)
|
||||
{
|
||||
if ( ! preg_match(
|
||||
'/^(?P<major>\d+)(?:\.(?P<minor>\d+)(?:\.(?P<patch>\d+)(?:\.(?P<build>\d+))?)?)?/',
|
||||
$version,
|
||||
$versionParts
|
||||
)) {
|
||||
throw DBALException::invalidPlatformVersionSpecified(
|
||||
$version,
|
||||
'<major_version>.<minor_version>.<patch_version>.<build_version>'
|
||||
);
|
||||
}
|
||||
|
||||
$majorVersion = $versionParts['major'];
|
||||
$minorVersion = isset($versionParts['minor']) ? $versionParts['minor'] : 0;
|
||||
$patchVersion = isset($versionParts['patch']) ? $versionParts['patch'] : 0;
|
||||
$buildVersion = isset($versionParts['build']) ? $versionParts['build'] : 0;
|
||||
$version = $majorVersion . '.' . $minorVersion . '.' . $patchVersion . '.' . $buildVersion;
|
||||
|
||||
switch(true) {
|
||||
case version_compare($version, '11.00.2100', '>='):
|
||||
return new SQLServer2012Platform();
|
||||
case version_compare($version, '10.00.1600', '>='):
|
||||
return new SQLServer2008Platform();
|
||||
case version_compare($version, '9.00.1399', '>='):
|
||||
return new SQLServer2005Platform();
|
||||
default:
|
||||
return new SQLServerPlatform();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabase(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
$params = $conn->getParams();
|
||||
|
||||
if (isset($params['dbname'])) {
|
||||
return $params['dbname'];
|
||||
}
|
||||
|
||||
return $conn->query('SELECT DB_NAME()')->fetchColumn();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabasePlatform()
|
||||
{
|
||||
return new SQLServer2008Platform();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
||||
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
return new SQLServerSchemaManager($conn);
|
||||
}
|
||||
}
|
||||
113
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLiteDriver.php
vendored
Normal file
113
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractSQLiteDriver.php
vendored
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
<?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 Doctrine\DBAL\Driver;
|
||||
use Doctrine\DBAL\Exception;
|
||||
use Doctrine\DBAL\Platforms\SqlitePlatform;
|
||||
use Doctrine\DBAL\Schema\SqliteSchemaManager;
|
||||
|
||||
/**
|
||||
* Abstract base implementation of the {@link Doctrine\DBAL\Driver} interface for SQLite based drivers.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
abstract class AbstractSQLiteDriver implements Driver, ExceptionConverterDriver
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @link http://www.sqlite.org/c3ref/c_abort.html
|
||||
*/
|
||||
public function convertException($message, DriverException $exception)
|
||||
{
|
||||
if (strpos($exception->getMessage(), 'must be unique') !== false ||
|
||||
strpos($exception->getMessage(), 'is not unique') !== false ||
|
||||
strpos($exception->getMessage(), 'are not unique') !== false ||
|
||||
strpos($exception->getMessage(), 'UNIQUE constraint failed') !== false
|
||||
) {
|
||||
return new Exception\UniqueConstraintViolationException($message, $exception);
|
||||
}
|
||||
|
||||
if (strpos($exception->getMessage(), 'may not be NULL') !== false ||
|
||||
strpos($exception->getMessage(), 'NOT NULL constraint failed') !== false
|
||||
) {
|
||||
return new Exception\NotNullConstraintViolationException($message, $exception);
|
||||
}
|
||||
|
||||
if (strpos($exception->getMessage(), 'no such table:') !== false) {
|
||||
return new Exception\TableNotFoundException($message, $exception);
|
||||
}
|
||||
|
||||
if (strpos($exception->getMessage(), 'already exists') !== false) {
|
||||
return new Exception\TableExistsException($message, $exception);
|
||||
}
|
||||
|
||||
if (strpos($exception->getMessage(), 'has no column named') !== false) {
|
||||
return new Exception\InvalidFieldNameException($message, $exception);
|
||||
}
|
||||
|
||||
if (strpos($exception->getMessage(), 'ambiguous column name') !== false) {
|
||||
return new Exception\NonUniqueFieldNameException($message, $exception);
|
||||
}
|
||||
|
||||
if (strpos($exception->getMessage(), 'syntax error') !== false) {
|
||||
return new Exception\SyntaxErrorException($message, $exception);
|
||||
}
|
||||
|
||||
if (strpos($exception->getMessage(), 'attempt to write a readonly database') !== false) {
|
||||
return new Exception\ReadOnlyException($message, $exception);
|
||||
}
|
||||
|
||||
if (strpos($exception->getMessage(), 'unable to open database file') !== false) {
|
||||
return new Exception\ConnectionException($message, $exception);
|
||||
}
|
||||
|
||||
return new Exception\DriverException($message, $exception);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabase(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
$params = $conn->getParams();
|
||||
|
||||
return isset($params['path']) ? $params['path'] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabasePlatform()
|
||||
{
|
||||
return new SqlitePlatform();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
return new SqliteSchemaManager($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();
|
||||
}
|
||||
59
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/DriverException.php
vendored
Normal file
59
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/DriverException.php
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<?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;
|
||||
|
||||
/**
|
||||
* Contract for a driver exception.
|
||||
*
|
||||
* Driver exceptions provide the SQLSTATE of the driver
|
||||
* and the driver specific error code at the time the error occurred.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
interface DriverException
|
||||
{
|
||||
/**
|
||||
* Returns the driver specific error code if available.
|
||||
*
|
||||
* Returns null if no driver specific error code is available
|
||||
* for the error raised by the driver.
|
||||
*
|
||||
* @return integer|string|null
|
||||
*/
|
||||
public function getErrorCode();
|
||||
|
||||
/**
|
||||
* Returns the driver error message.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMessage();
|
||||
|
||||
/**
|
||||
* Returns the SQLSTATE the driver was in at the time the error occurred.
|
||||
*
|
||||
* Returns null if the driver does not provide a SQLSTATE for the error occurred.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getSQLState();
|
||||
}
|
||||
42
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/DrizzlePDOMySql/Connection.php
vendored
Normal file
42
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/DrizzlePDOMySql/Connection.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\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);
|
||||
}
|
||||
}
|
||||
78
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/DrizzlePDOMySql/Driver.php
vendored
Normal file
78
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/DrizzlePDOMySql/Driver.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\Driver\DrizzlePDOMySql;
|
||||
|
||||
use Doctrine\DBAL\Platforms\DrizzlePlatform;
|
||||
use Doctrine\DBAL\Schema\DrizzleSchemaManager;
|
||||
|
||||
/**
|
||||
* Drizzle driver using PDO MySql.
|
||||
*
|
||||
* @author Kim Hemsø Rasmussen <kimhemsoe@gmail.com>
|
||||
*/
|
||||
class Driver extends \Doctrine\DBAL\Driver\PDOMySql\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;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createDatabasePlatformForVersion($version)
|
||||
{
|
||||
return $this->getDatabasePlatform();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDatabasePlatform()
|
||||
{
|
||||
return new DrizzlePlatform();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
|
||||
{
|
||||
return new DrizzleSchemaManager($conn);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'drizzle_pdo_mysql';
|
||||
}
|
||||
}
|
||||
44
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/ExceptionConverterDriver.php
vendored
Normal file
44
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/ExceptionConverterDriver.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;
|
||||
|
||||
/**
|
||||
* Contract for a driver that is capable of converting DBAL driver exceptions into standardized DBAL driver exceptions.
|
||||
*
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
interface ExceptionConverterDriver
|
||||
{
|
||||
/**
|
||||
* Converts a given DBAL driver exception into a standardized DBAL driver exception.
|
||||
*
|
||||
* It evaluates the vendor specific error code and SQLSTATE and transforms
|
||||
* it into a unified {@link Doctrine\DBAL\Exception\DriverException} subclass.
|
||||
*
|
||||
* @param string $message The DBAL exception message to use.
|
||||
* @param \Doctrine\DBAL\Driver\DriverException $exception The DBAL driver exception to convert.
|
||||
*
|
||||
* @return \Doctrine\DBAL\Exception\DriverException An instance of one of the DriverException subclasses.
|
||||
*/
|
||||
public function convertException($message, DriverException $exception);
|
||||
}
|
||||
178
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php
vendored
Normal file
178
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php
vendored
Normal file
|
|
@ -0,0 +1,178 @@
|
|||
<?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\Connection;
|
||||
use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
|
||||
|
||||
class DB2Connection implements Connection, ServerInfoAwareConnection
|
||||
{
|
||||
/**
|
||||
* @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 getServerVersion()
|
||||
{
|
||||
$serverInfo = db2_server_info($this->_conn);
|
||||
|
||||
return $serverInfo->DBMS_VER;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function requiresQueryForServerVersion()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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(),
|
||||
);
|
||||
}
|
||||
}
|
||||
67
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Driver.php
vendored
Normal file
67
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Driver.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\Driver\IBMDB2;
|
||||
|
||||
use Doctrine\DBAL\Driver\AbstractDB2Driver;
|
||||
|
||||
/**
|
||||
* IBM DB2 Driver.
|
||||
*
|
||||
* @since 2.0
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class DB2Driver extends AbstractDB2Driver
|
||||
{
|
||||
/**
|
||||
* {@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 getName()
|
||||
{
|
||||
return 'ibm_db2';
|
||||
}
|
||||
}
|
||||
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
|
||||
{
|
||||
}
|
||||
362
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php
vendored
Normal file
362
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php
vendored
Normal file
|
|
@ -0,0 +1,362 @@
|
|||
<?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 string Name of the default class to instantiate when fetch mode is \PDO::FETCH_CLASS.
|
||||
*/
|
||||
private $defaultFetchClass = '\stdClass';
|
||||
|
||||
/**
|
||||
* @var string Constructor arguments for the default class to instantiate when fetch mode is \PDO::FETCH_CLASS.
|
||||
*/
|
||||
private $defaultFetchClassCtorArgs = array();
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
private $_defaultFetchMode = \PDO::FETCH_BOTH;
|
||||
|
||||
/**
|
||||
* Indicates whether the statement is in the state when fetching results is possible
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $result = false;
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
if (!db2_free_result($this->_stmt)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->result = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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;
|
||||
}
|
||||
|
||||
if ($params === null) {
|
||||
ksort($this->_bindParam);
|
||||
|
||||
$params = array();
|
||||
|
||||
foreach ($this->_bindParam as $column => $value) {
|
||||
$params[] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$retval = @db2_execute($this->_stmt, $params);
|
||||
|
||||
if ($retval === false) {
|
||||
throw new DB2Exception(db2_stmt_errormsg());
|
||||
}
|
||||
|
||||
$this->result = true;
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null)
|
||||
{
|
||||
$this->_defaultFetchMode = $fetchMode;
|
||||
$this->defaultFetchClass = $arg2 ? $arg2 : $this->defaultFetchClass;
|
||||
$this->defaultFetchClassCtorArgs = $arg3 ? (array) $arg3 : $this->defaultFetchClassCtorArgs;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
$data = $this->fetchAll();
|
||||
|
||||
return new \ArrayIterator($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetch($fetchMode = null)
|
||||
{
|
||||
// do not try fetching from the statement if it's not expected to contain result
|
||||
// in order to prevent exceptional situation
|
||||
if (!$this->result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$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_CLASS:
|
||||
$className = $this->defaultFetchClass;
|
||||
$ctorArgs = $this->defaultFetchClassCtorArgs;
|
||||
|
||||
if (func_num_args() >= 2) {
|
||||
$args = func_get_args();
|
||||
$className = $args[1];
|
||||
$ctorArgs = isset($args[2]) ? $args[2] : array();
|
||||
}
|
||||
|
||||
$result = db2_fetch_object($this->_stmt);
|
||||
|
||||
if ($result instanceof \stdClass) {
|
||||
$result = $this->castObject($result, $className, $ctorArgs);
|
||||
}
|
||||
|
||||
return $result;
|
||||
case \PDO::FETCH_NUM:
|
||||
return db2_fetch_array($this->_stmt);
|
||||
case \PDO::FETCH_OBJ:
|
||||
return db2_fetch_object($this->_stmt);
|
||||
default:
|
||||
throw new DB2Exception("Given Fetch-Style " . $fetchMode . " is not supported.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchAll($fetchMode = null)
|
||||
{
|
||||
$rows = array();
|
||||
|
||||
switch ($fetchMode) {
|
||||
case \PDO::FETCH_CLASS:
|
||||
while ($row = call_user_func_array(array($this, 'fetch'), func_get_args())) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
break;
|
||||
case \PDO::FETCH_COLUMN:
|
||||
while ($row = $this->fetchColumn()) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
while ($row = $this->fetch($fetchMode)) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchColumn($columnIndex = 0)
|
||||
{
|
||||
$row = $this->fetch(\PDO::FETCH_NUM);
|
||||
|
||||
if (false === $row) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return isset($row[$columnIndex]) ? $row[$columnIndex] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rowCount()
|
||||
{
|
||||
return (@db2_num_rows($this->_stmt))?:0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts a stdClass object to the given class name mapping its' properties.
|
||||
*
|
||||
* @param \stdClass $sourceObject Object to cast from.
|
||||
* @param string|object $destinationClass Name of the class or class instance to cast to.
|
||||
* @param array $ctorArgs Arguments to use for constructing the destination class instance.
|
||||
*
|
||||
* @return object
|
||||
*
|
||||
* @throws DB2Exception
|
||||
*/
|
||||
private function castObject(\stdClass $sourceObject, $destinationClass, array $ctorArgs = array())
|
||||
{
|
||||
if ( ! is_string($destinationClass)) {
|
||||
if ( ! is_object($destinationClass)) {
|
||||
throw new DB2Exception(sprintf(
|
||||
'Destination class has to be of type string or object, %s given.', gettype($destinationClass)
|
||||
));
|
||||
}
|
||||
} else {
|
||||
$destinationClass = new \ReflectionClass($destinationClass);
|
||||
$destinationClass = $destinationClass->newInstanceArgs($ctorArgs);
|
||||
}
|
||||
|
||||
$sourceReflection = new \ReflectionObject($sourceObject);
|
||||
$destinationClassReflection = new \ReflectionObject($destinationClass);
|
||||
/** @var \ReflectionProperty[] $destinationProperties */
|
||||
$destinationProperties = array_change_key_case($destinationClassReflection->getProperties(), \CASE_LOWER);
|
||||
|
||||
foreach ($sourceReflection->getProperties() as $sourceProperty) {
|
||||
$sourceProperty->setAccessible(true);
|
||||
|
||||
$name = $sourceProperty->getName();
|
||||
$value = $sourceProperty->getValue($sourceObject);
|
||||
|
||||
// Try to find a case-matching property.
|
||||
if ($destinationClassReflection->hasProperty($name)) {
|
||||
$destinationProperty = $destinationClassReflection->getProperty($name);
|
||||
|
||||
$destinationProperty->setAccessible(true);
|
||||
$destinationProperty->setValue($destinationClass, $value);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$name = strtolower($name);
|
||||
|
||||
// Try to find a property without matching case.
|
||||
// Fallback for the driver returning either all uppercase or all lowercase column names.
|
||||
if (isset($destinationProperties[$name])) {
|
||||
$destinationProperty = $destinationProperties[$name];
|
||||
|
||||
$destinationProperty->setAccessible(true);
|
||||
$destinationProperty->setValue($destinationClass, $value);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$destinationClass->$name = $value;
|
||||
}
|
||||
|
||||
return $destinationClass;
|
||||
}
|
||||
}
|
||||
49
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Driver.php
vendored
Normal file
49
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/Driver.php
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?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\AbstractMySQLDriver;
|
||||
use Doctrine\DBAL\DBALException;
|
||||
|
||||
/**
|
||||
* @author Kim Hemsø Rasmussen <kimhemsoe@gmail.com>
|
||||
*/
|
||||
class Driver extends AbstractMySQLDriver
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
|
||||
{
|
||||
try {
|
||||
return new MysqliConnection($params, $username, $password, $driverOptions);
|
||||
} catch (MysqliException $e) {
|
||||
throw DBALException::driverException($this, $e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'mysqli';
|
||||
}
|
||||
}
|
||||
266
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php
vendored
Normal file
266
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php
vendored
Normal file
|
|
@ -0,0 +1,266 @@
|
|||
<?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;
|
||||
use Doctrine\DBAL\Driver\PingableConnection;
|
||||
use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
|
||||
|
||||
/**
|
||||
* @author Kim Hemsø Rasmussen <kimhemsoe@gmail.com>
|
||||
* @author Till Klampaeckel <till@php.net>
|
||||
*/
|
||||
class MysqliConnection implements Connection, PingableConnection, ServerInfoAwareConnection
|
||||
{
|
||||
/**
|
||||
* Name of the option to set connection flags
|
||||
*/
|
||||
const OPTION_FLAGS = 'flags';
|
||||
|
||||
/**
|
||||
* @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');
|
||||
|
||||
// Fallback to default MySQL port if not given.
|
||||
if ( ! $port) {
|
||||
$port = 3306;
|
||||
}
|
||||
|
||||
$socket = isset($params['unix_socket']) ? $params['unix_socket'] : ini_get('mysqli.default_socket');
|
||||
$dbname = isset($params['dbname']) ? $params['dbname'] : null;
|
||||
|
||||
$flags = isset($driverOptions[static::OPTION_FLAGS]) ? $driverOptions[static::OPTION_FLAGS] : null;
|
||||
|
||||
$this->_conn = mysqli_init();
|
||||
|
||||
$this->setDriverOptions($driverOptions);
|
||||
|
||||
set_error_handler(function () {});
|
||||
|
||||
if ( ! $this->_conn->real_connect($params['host'], $username, $password, $dbname, $port, $socket, $flags)) {
|
||||
restore_error_handler();
|
||||
|
||||
throw new MysqliException($this->_conn->connect_error, @$this->_conn->sqlstate ?: 'HY000', $this->_conn->connect_errno);
|
||||
}
|
||||
|
||||
restore_error_handler();
|
||||
|
||||
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 getServerVersion()
|
||||
{
|
||||
$majorVersion = floor($this->_conn->server_version / 10000);
|
||||
$minorVersion = floor(($this->_conn->server_version - $majorVersion * 10000) / 100);
|
||||
$patchVersion = floor($this->_conn->server_version - $majorVersion * 10000 - $minorVersion * 100);
|
||||
|
||||
return $majorVersion . '.' . $minorVersion . '.' . $patchVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function requiresQueryForServerVersion()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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)
|
||||
{
|
||||
if (false === $this->_conn->query($statement)) {
|
||||
throw new MysqliException($this->_conn->error, $this->_conn->sqlstate, $this->_conn->errno);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the driver options to the connection.
|
||||
*
|
||||
* @param array $driverOptions
|
||||
*
|
||||
* @throws MysqliException When one of of the options is not supported.
|
||||
* @throws MysqliException When applying doesn't work - e.g. due to incorrect value.
|
||||
*/
|
||||
private function setDriverOptions(array $driverOptions = array())
|
||||
{
|
||||
$supportedDriverOptions = array(
|
||||
\MYSQLI_OPT_CONNECT_TIMEOUT,
|
||||
\MYSQLI_OPT_LOCAL_INFILE,
|
||||
\MYSQLI_INIT_COMMAND,
|
||||
\MYSQLI_READ_DEFAULT_FILE,
|
||||
\MYSQLI_READ_DEFAULT_GROUP,
|
||||
);
|
||||
|
||||
if (defined('MYSQLI_SERVER_PUBLIC_KEY')) {
|
||||
$supportedDriverOptions[] = \MYSQLI_SERVER_PUBLIC_KEY;
|
||||
}
|
||||
|
||||
$exceptionMsg = "%s option '%s' with value '%s'";
|
||||
|
||||
foreach ($driverOptions as $option => $value) {
|
||||
|
||||
if ($option === static::OPTION_FLAGS) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!in_array($option, $supportedDriverOptions, true)) {
|
||||
throw new MysqliException(
|
||||
sprintf($exceptionMsg, 'Unsupported', $option, $value)
|
||||
);
|
||||
}
|
||||
|
||||
if (@mysqli_options($this->_conn, $option, $value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$msg = sprintf($exceptionMsg, 'Failed to set', $option, $value);
|
||||
$msg .= sprintf(', error: %s (%d)', mysqli_error($this->_conn), mysqli_errno($this->_conn));
|
||||
|
||||
throw new MysqliException(
|
||||
$msg,
|
||||
$this->_conn->sqlstate,
|
||||
$this->_conn->errno
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pings the server and re-connects when `mysqli.reconnect = 1`
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function ping()
|
||||
{
|
||||
return $this->_conn->ping();
|
||||
}
|
||||
}
|
||||
32
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliException.php
vendored
Normal file
32
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliException.php
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?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\AbstractDriverException;
|
||||
|
||||
/**
|
||||
* Exception thrown in case the mysqli driver errors.
|
||||
*
|
||||
* @author Kim Hemsø Rasmussen <kimhemsoe@gmail.com>
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
*/
|
||||
class MysqliException extends AbstractDriverException
|
||||
{
|
||||
}
|
||||
403
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php
vendored
Normal file
403
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php
vendored
Normal file
|
|
@ -0,0 +1,403 @@
|
|||
<?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;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $types;
|
||||
|
||||
/**
|
||||
* Contains ref values for bindValue().
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_values = array();
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
protected $_defaultFetchMode = PDO::FETCH_BOTH;
|
||||
|
||||
/**
|
||||
* Indicates whether the statement is in the state when fetching results is possible
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $result = false;
|
||||
|
||||
/**
|
||||
* @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->sqlstate, $this->_conn->errno);
|
||||
}
|
||||
|
||||
$paramCount = $this->_stmt->param_count;
|
||||
if (0 < $paramCount) {
|
||||
$this->types = str_repeat('s', $paramCount);
|
||||
$this->_bindedValues = array_fill(1, $paramCount, null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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->types[$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->types[$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'), array($this->types) + $this->_bindedValues)) {
|
||||
throw new MysqliException($this->_stmt->error, $this->_stmt->sqlstate, $this->_stmt->errno);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $this->_stmt->execute()) {
|
||||
throw new MysqliException($this->_stmt->error, $this->_stmt->sqlstate, $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;
|
||||
} else {
|
||||
$this->_columnNames = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (false !== $this->_columnNames) {
|
||||
// Store result of every execution which has it. Otherwise it will be impossible
|
||||
// to execute a new statement in case if the previous one has non-fetched rows
|
||||
// @link http://dev.mysql.com/doc/refman/5.7/en/commands-out-of-sync.html
|
||||
$this->_stmt->store_result();
|
||||
|
||||
// Bind row values _after_ storing the result. Otherwise, if mysqli is compiled with libmysql,
|
||||
// it will have to allocate as much memory as it may be needed for the given column type
|
||||
// (e.g. for a LONGBLOB field it's 4 gigabytes)
|
||||
// @link https://bugs.php.net/bug.php?id=51386#1270673122
|
||||
//
|
||||
// Make sure that the values are bound after each execution. Otherwise, if closeCursor() has been
|
||||
// previously called on the statement, the values are unbound making the statement unusable.
|
||||
//
|
||||
// It's also important that row values are bound after _each_ call to store_result(). Otherwise,
|
||||
// if mysqli is compiled with libmysql, subsequently fetched string values will get truncated
|
||||
// to the length of the ones fetched during the previous execution.
|
||||
$this->_rowBindedValues = array_fill(0, count($this->_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->sqlstate, $this->_stmt->errno);
|
||||
}
|
||||
}
|
||||
|
||||
$this->result = true;
|
||||
|
||||
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) {
|
||||
$values[] = $v;
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetch($fetchMode = null)
|
||||
{
|
||||
// do not try fetching from the statement if it's not expected to contain result
|
||||
// in order to prevent exceptional situation
|
||||
if (!$this->result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$values = $this->_fetch();
|
||||
if (null === $values) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (false === $values) {
|
||||
throw new MysqliException($this->_stmt->error, $this->_stmt->sqlstate, $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)) !== false) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchColumn($columnIndex = 0)
|
||||
{
|
||||
$row = $this->fetch(PDO::FETCH_NUM);
|
||||
if (false === $row) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return isset($row[$columnIndex]) ? $row[$columnIndex] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function errorCode()
|
||||
{
|
||||
return $this->_stmt->errno;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function errorInfo()
|
||||
{
|
||||
return $this->_stmt->error;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function closeCursor()
|
||||
{
|
||||
$this->_stmt->free_result();
|
||||
$this->result = false;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
71
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/Driver.php
vendored
Normal file
71
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/Driver.php
vendored
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
<?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\DBALException;
|
||||
use Doctrine\DBAL\Driver\AbstractOracleDriver;
|
||||
|
||||
/**
|
||||
* A Doctrine DBAL driver for the Oracle OCI8 PHP extensions.
|
||||
*
|
||||
* @author Roman Borschel <roman@code-factory.org>
|
||||
* @since 2.0
|
||||
*/
|
||||
class Driver extends AbstractOracleDriver
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
|
||||
{
|
||||
try {
|
||||
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
|
||||
);
|
||||
} catch (OCI8Exception $e) {
|
||||
throw DBALException::driverException($this, $e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the Oracle DSN.
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return string The DSN.
|
||||
*/
|
||||
protected function _constructDsn(array $params)
|
||||
{
|
||||
return $this->getEasyConnectString($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'oci8';
|
||||
}
|
||||
}
|
||||
233
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.php
vendored
Normal file
233
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Connection.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\Driver\OCI8;
|
||||
|
||||
use Doctrine\DBAL\Driver\Connection;
|
||||
use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
|
||||
use Doctrine\DBAL\Platforms\OraclePlatform;
|
||||
|
||||
/**
|
||||
* OCI8 implementation of the Connection interface.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
class OCI8Connection implements Connection, ServerInfoAwareConnection
|
||||
{
|
||||
/**
|
||||
* @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}
|
||||
*
|
||||
* @throws \UnexpectedValueException if the version string returned by the database server
|
||||
* does not contain a parsable version number.
|
||||
*/
|
||||
public function getServerVersion()
|
||||
{
|
||||
if ( ! preg_match('/\s+(\d+\.\d+\.\d+\.\d+\.\d+)\s+/', oci_server_version($this->dbh), $version)) {
|
||||
throw new \UnexpectedValueException(
|
||||
sprintf(
|
||||
'Unexpected database version string "%s". Cannot parse an appropriate version number from it. ' .
|
||||
'Please report this database version string to the Doctrine team.',
|
||||
oci_server_version($this->dbh)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return $version[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function requiresQueryForServerVersion()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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);
|
||||
}
|
||||
}
|
||||
35
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Exception.php
vendored
Normal file
35
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Exception.php
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?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\Driver\AbstractDriverException;
|
||||
|
||||
class OCI8Exception extends AbstractDriverException
|
||||
{
|
||||
/**
|
||||
* @param array $error
|
||||
*
|
||||
* @return \Doctrine\DBAL\Driver\OCI8\OCI8Exception
|
||||
*/
|
||||
public static function fromErrorInfo($error)
|
||||
{
|
||||
return new self($error['message'], null, $error['code']);
|
||||
}
|
||||
}
|
||||
357
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
vendored
Normal file
357
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
vendored
Normal file
|
|
@ -0,0 +1,357 @@
|
|||
<?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::FETCH_COLUMN => OCI_NUM,
|
||||
);
|
||||
|
||||
/**
|
||||
* @var integer
|
||||
*/
|
||||
protected $_defaultFetchMode = PDO::FETCH_BOTH;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_paramMap = array();
|
||||
|
||||
/**
|
||||
* Holds references to bound parameter values.
|
||||
*
|
||||
* This is a new requirement for PHP7's oci8 extension that prevents bound values from being garbage collected.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $boundValues = array();
|
||||
|
||||
/**
|
||||
* Indicates whether the statement is in the state when fetching results is possible
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $result = false;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
} elseif ($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);
|
||||
|
||||
$this->boundValues[$column] =& $lob;
|
||||
|
||||
return oci_bind_by_name($this->_sth, $column, $lob, -1, OCI_B_BLOB);
|
||||
} elseif ($length !== null) {
|
||||
$this->boundValues[$column] =& $variable;
|
||||
|
||||
return oci_bind_by_name($this->_sth, $column, $variable, $length);
|
||||
}
|
||||
|
||||
$this->boundValues[$column] =& $variable;
|
||||
|
||||
return oci_bind_by_name($this->_sth, $column, $variable);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function closeCursor()
|
||||
{
|
||||
// not having the result means there's nothing to close
|
||||
if (!$this->result) {
|
||||
return true;
|
||||
}
|
||||
|
||||
oci_cancel($this->_sth);
|
||||
|
||||
$this->result = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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());
|
||||
}
|
||||
|
||||
$this->result = true;
|
||||
|
||||
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)
|
||||
{
|
||||
// do not try fetching from the statement if it's not expected to contain result
|
||||
// in order to prevent exceptional situation
|
||||
if (!$this->result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
// do not try fetching from the statement if it's not expected to contain result
|
||||
// in order to prevent exceptional situation
|
||||
if (!$this->result) {
|
||||
return array();
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
// do not try fetching from the statement if it's not expected to contain result
|
||||
// in order to prevent exceptional situation
|
||||
if (!$this->result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$row = oci_fetch_array($this->_sth, OCI_NUM | OCI_RETURN_NULLS | OCI_RETURN_LOBS);
|
||||
|
||||
if (false === $row) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return isset($row[$columnIndex]) ? $row[$columnIndex] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rowCount()
|
||||
{
|
||||
return oci_num_rows($this->_sth);
|
||||
}
|
||||
}
|
||||
133
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php
vendored
Normal file
133
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php
vendored
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
<?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, ServerInfoAwareConnection
|
||||
{
|
||||
/**
|
||||
* @param string $dsn
|
||||
* @param string|null $user
|
||||
* @param string|null $password
|
||||
* @param array|null $options
|
||||
*
|
||||
* @throws PDOException in case of an error.
|
||||
*/
|
||||
public function __construct($dsn, $user = null, $password = null, array $options = null)
|
||||
{
|
||||
try {
|
||||
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);
|
||||
} catch (\PDOException $exception) {
|
||||
throw new PDOException($exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function exec($statement)
|
||||
{
|
||||
try {
|
||||
return parent::exec($statement);
|
||||
} catch (\PDOException $exception) {
|
||||
throw new PDOException($exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getServerVersion()
|
||||
{
|
||||
return PDO::getAttribute(PDO::ATTR_SERVER_VERSION);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function prepare($prepareString, $driverOptions = array())
|
||||
{
|
||||
try {
|
||||
return parent::prepare($prepareString, $driverOptions);
|
||||
} catch (\PDOException $exception) {
|
||||
throw new PDOException($exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$argsCount = count($args);
|
||||
|
||||
try {
|
||||
if ($argsCount == 4) {
|
||||
return parent::query($args[0], $args[1], $args[2], $args[3]);
|
||||
}
|
||||
|
||||
if ($argsCount == 3) {
|
||||
return parent::query($args[0], $args[1], $args[2]);
|
||||
}
|
||||
|
||||
if ($argsCount == 2) {
|
||||
return parent::query($args[0], $args[1]);
|
||||
}
|
||||
|
||||
return parent::query($args[0]);
|
||||
} catch (\PDOException $exception) {
|
||||
throw new PDOException($exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function quote($input, $type = \PDO::PARAM_STR)
|
||||
{
|
||||
return parent::quote($input, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function lastInsertId($name = null)
|
||||
{
|
||||
return parent::lastInsertId($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function requiresQueryForServerVersion()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
75
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOException.php
vendored
Normal file
75
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOException.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;
|
||||
|
||||
/**
|
||||
* Tiny wrapper for PDOException instances to implement the {@link DriverException} interface.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
class PDOException extends \PDOException implements DriverException
|
||||
{
|
||||
/**
|
||||
* The driver specific error code.
|
||||
*
|
||||
* @var integer|string|null
|
||||
*/
|
||||
private $errorCode;
|
||||
|
||||
/**
|
||||
* The SQLSTATE of the driver.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
private $sqlState;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param \PDOException $exception The PDO exception to wrap.
|
||||
*/
|
||||
public function __construct(\PDOException $exception)
|
||||
{
|
||||
parent::__construct($exception->getMessage(), 0, $exception);
|
||||
|
||||
$this->code = $exception->getCode();
|
||||
$this->errorInfo = $exception->errorInfo;
|
||||
$this->errorCode = isset($exception->errorInfo[1]) ? $exception->errorInfo[1] : $exception->getCode();
|
||||
$this->sqlState = isset($exception->errorInfo[0]) ? $exception->errorInfo[0] : $exception->getCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getErrorCode()
|
||||
{
|
||||
return $this->errorCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSQLState()
|
||||
{
|
||||
return $this->sqlState;
|
||||
}
|
||||
}
|
||||
83
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOIbm/Driver.php
vendored
Normal file
83
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOIbm/Driver.php
vendored
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
<?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\Driver\AbstractDB2Driver;
|
||||
use Doctrine\DBAL\Driver\PDOConnection;
|
||||
|
||||
/**
|
||||
* 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 extends AbstractDB2Driver
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
|
||||
{
|
||||
$conn = new 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 getName()
|
||||
{
|
||||
return 'pdo_ibm';
|
||||
}
|
||||
}
|
||||
89
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php
vendored
Normal file
89
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.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\Driver\PDOMySql;
|
||||
|
||||
use Doctrine\DBAL\DBALException;
|
||||
use Doctrine\DBAL\Driver\AbstractMySQLDriver;
|
||||
use Doctrine\DBAL\Driver\PDOConnection;
|
||||
use PDOException;
|
||||
|
||||
/**
|
||||
* PDO MySql driver.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
class Driver extends AbstractMySQLDriver
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
|
||||
{
|
||||
try {
|
||||
$conn = new PDOConnection(
|
||||
$this->constructPdoDsn($params),
|
||||
$username,
|
||||
$password,
|
||||
$driverOptions
|
||||
);
|
||||
} catch (PDOException $e) {
|
||||
throw DBALException::driverException($this, $e);
|
||||
}
|
||||
|
||||
return $conn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the MySql PDO DSN.
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return string The DSN.
|
||||
*/
|
||||
protected 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 getName()
|
||||
{
|
||||
return 'pdo_mysql';
|
||||
}
|
||||
}
|
||||
78
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOOracle/Driver.php
vendored
Normal file
78
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOOracle/Driver.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\Driver\PDOOracle;
|
||||
|
||||
use Doctrine\DBAL\DBALException;
|
||||
use Doctrine\DBAL\Driver\AbstractOracleDriver;
|
||||
use Doctrine\DBAL\Driver\PDOConnection;
|
||||
|
||||
/**
|
||||
* 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 extends AbstractOracleDriver
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
|
||||
{
|
||||
try {
|
||||
return new PDOConnection(
|
||||
$this->constructPdoDsn($params),
|
||||
$username,
|
||||
$password,
|
||||
$driverOptions
|
||||
);
|
||||
} catch (\PDOException $e) {
|
||||
throw DBALException::driverException($this, $e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the Oracle PDO DSN.
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return string The DSN.
|
||||
*/
|
||||
private function constructPdoDsn(array $params)
|
||||
{
|
||||
$dsn = 'oci:dbname=' . $this->getEasyConnectString($params);
|
||||
|
||||
if (isset($params['charset'])) {
|
||||
$dsn .= ';charset=' . $params['charset'];
|
||||
}
|
||||
|
||||
return $dsn;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'pdo_oracle';
|
||||
}
|
||||
}
|
||||
112
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php
vendored
Normal file
112
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOPgSql/Driver.php
vendored
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
<?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\Driver\AbstractPostgreSQLDriver;
|
||||
use Doctrine\DBAL\Driver\PDOConnection;
|
||||
use Doctrine\DBAL\DBALException;
|
||||
use PDOException;
|
||||
use PDO;
|
||||
|
||||
/**
|
||||
* Driver that connects through pdo_pgsql.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
class Driver extends AbstractPostgreSQLDriver
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
|
||||
{
|
||||
try {
|
||||
$pdo = new PDOConnection(
|
||||
$this->_constructPdoDsn($params),
|
||||
$username,
|
||||
$password,
|
||||
$driverOptions
|
||||
);
|
||||
|
||||
if (defined('PDO::PGSQL_ATTR_DISABLE_PREPARES')
|
||||
&& (! isset($driverOptions[PDO::PGSQL_ATTR_DISABLE_PREPARES])
|
||||
|| true === $driverOptions[PDO::PGSQL_ATTR_DISABLE_PREPARES]
|
||||
)
|
||||
) {
|
||||
$pdo->setAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES, true);
|
||||
}
|
||||
|
||||
/* defining client_encoding via SET NAMES to avoid inconsistent DSN support
|
||||
* - the 'client_encoding' connection param only works with postgres >= 9.1
|
||||
* - passing client_encoding via the 'options' param breaks pgbouncer support
|
||||
*/
|
||||
if (isset($params['charset'])) {
|
||||
$pdo->query('SET NAMES \''.$params['charset'].'\'');
|
||||
}
|
||||
|
||||
return $pdo;
|
||||
} catch (PDOException $e) {
|
||||
throw DBALException::driverException($this, $e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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'] . ' ';
|
||||
} else {
|
||||
// Used for temporary connections to allow operations like dropping the database currently connected to.
|
||||
// Connecting without an explicit database does not work, therefore "postgres" database is used
|
||||
// as it is certainly present in every server setup.
|
||||
$dsn .= 'dbname=postgres' . ' ';
|
||||
}
|
||||
|
||||
if (isset($params['sslmode'])) {
|
||||
$dsn .= 'sslmode=' . $params['sslmode'] . ' ';
|
||||
}
|
||||
|
||||
return $dsn;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'pdo_pgsql';
|
||||
}
|
||||
}
|
||||
98
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php
vendored
Normal file
98
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.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\Driver\PDOSqlite;
|
||||
|
||||
use Doctrine\DBAL\DBALException;
|
||||
use Doctrine\DBAL\Driver\AbstractSQLiteDriver;
|
||||
use Doctrine\DBAL\Driver\PDOConnection;
|
||||
use PDOException;
|
||||
|
||||
/**
|
||||
* The PDO Sqlite driver.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
class Driver extends AbstractSQLiteDriver
|
||||
{
|
||||
/**
|
||||
* @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']);
|
||||
}
|
||||
|
||||
try {
|
||||
$pdo = new PDOConnection(
|
||||
$this->_constructPdoDsn($params),
|
||||
$username,
|
||||
$password,
|
||||
$driverOptions
|
||||
);
|
||||
} catch (PDOException $ex) {
|
||||
throw DBALException::driverException($this, $ex);
|
||||
}
|
||||
|
||||
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'];
|
||||
} elseif (isset($params['memory'])) {
|
||||
$dsn .= ':memory:';
|
||||
}
|
||||
|
||||
return $dsn;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'pdo_sqlite';
|
||||
}
|
||||
}
|
||||
69
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Connection.php
vendored
Normal file
69
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Connection.php
vendored
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
<?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;
|
||||
|
||||
use Doctrine\DBAL\Driver\PDOConnection;
|
||||
|
||||
/**
|
||||
* Sqlsrv Connection implementation.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
class Connection extends PDOConnection implements \Doctrine\DBAL\Driver\Connection
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct($dsn, $user = null, $password = null, array $options = null)
|
||||
{
|
||||
parent::__construct($dsn, $user, $password, $options);
|
||||
$this->setAttribute(\PDO::ATTR_STATEMENT_CLASS, array(Statement::class, array()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
public function lastInsertId($name = null)
|
||||
{
|
||||
if (null === $name) {
|
||||
return parent::lastInsertId($name);
|
||||
}
|
||||
|
||||
$stmt = $this->prepare('SELECT CONVERT(VARCHAR(MAX), current_value) FROM sys.sequences WHERE name = ?');
|
||||
$stmt->execute(array($name));
|
||||
|
||||
return $stmt->fetchColumn();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
81
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Driver.php
vendored
Normal file
81
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Driver.php
vendored
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
<?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;
|
||||
|
||||
use Doctrine\DBAL\Driver\AbstractSQLServerDriver;
|
||||
|
||||
/**
|
||||
* The PDO-based Sqlsrv driver.
|
||||
*
|
||||
* @since 2.0
|
||||
*/
|
||||
class Driver extends AbstractSQLServerDriver
|
||||
{
|
||||
/**
|
||||
* {@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 getName()
|
||||
{
|
||||
return 'pdo_sqlsrv';
|
||||
}
|
||||
}
|
||||
49
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Statement.php
vendored
Normal file
49
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOSqlsrv/Statement.php
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?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;
|
||||
|
||||
use Doctrine\DBAL\Driver\PDOStatement;
|
||||
use PDO;
|
||||
|
||||
/**
|
||||
* PDO SQL Server Statement
|
||||
*/
|
||||
class Statement extends PDOStatement
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function bindParam($column, &$variable, $type = PDO::PARAM_STR, $length = null, $driverOptions = null)
|
||||
{
|
||||
if ($type === PDO::PARAM_LOB && $driverOptions === null) {
|
||||
$driverOptions = PDO::SQLSRV_ENCODING_BINARY;
|
||||
}
|
||||
|
||||
return parent::bindParam($column, $variable, $type, $length, $driverOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function bindValue($param, $value, $type = PDO::PARAM_STR)
|
||||
{
|
||||
return $this->bindParam($param, $value, $type);
|
||||
}
|
||||
}
|
||||
170
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php
vendored
Normal file
170
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php
vendored
Normal file
|
|
@ -0,0 +1,170 @@
|
|||
<?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
|
||||
{
|
||||
/**
|
||||
* Protected constructor.
|
||||
*/
|
||||
protected 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.
|
||||
try {
|
||||
if ($arg2 === null && $arg3 === null) {
|
||||
return parent::setFetchMode($fetchMode);
|
||||
}
|
||||
|
||||
if ($arg3 === null) {
|
||||
return parent::setFetchMode($fetchMode, $arg2);
|
||||
}
|
||||
|
||||
return parent::setFetchMode($fetchMode, $arg2, $arg3);
|
||||
} catch (\PDOException $exception) {
|
||||
throw new PDOException($exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function bindValue($param, $value, $type = \PDO::PARAM_STR)
|
||||
{
|
||||
try {
|
||||
return parent::bindValue($param, $value, $type);
|
||||
} catch (\PDOException $exception) {
|
||||
throw new PDOException($exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function bindParam($column, &$variable, $type = \PDO::PARAM_STR, $length = null, $driverOptions = null)
|
||||
{
|
||||
try {
|
||||
return parent::bindParam($column, $variable, $type, $length, $driverOptions);
|
||||
} catch (\PDOException $exception) {
|
||||
throw new PDOException($exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function closeCursor()
|
||||
{
|
||||
try {
|
||||
return parent::closeCursor();
|
||||
} catch (\PDOException $exception) {
|
||||
// Exceptions not allowed by the interface.
|
||||
// In case driver implementations do not adhere to the interface, silence exceptions here.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function execute($params = null)
|
||||
{
|
||||
try {
|
||||
return parent::execute($params);
|
||||
} catch (\PDOException $exception) {
|
||||
throw new PDOException($exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetch($fetchMode = null, $cursorOrientation = null, $cursorOffset = null)
|
||||
{
|
||||
try {
|
||||
if ($fetchMode === null && $cursorOrientation === null && $cursorOffset === null) {
|
||||
return parent::fetch();
|
||||
}
|
||||
|
||||
if ($cursorOrientation === null && $cursorOffset === null) {
|
||||
return parent::fetch($fetchMode);
|
||||
}
|
||||
|
||||
if ($cursorOffset === null) {
|
||||
return parent::fetch($fetchMode, $cursorOrientation);
|
||||
}
|
||||
|
||||
return parent::fetch($fetchMode, $cursorOrientation, $cursorOffset);
|
||||
} catch (\PDOException $exception) {
|
||||
throw new PDOException($exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null)
|
||||
{
|
||||
try {
|
||||
if ($fetchMode === null && $fetchArgument === null && $ctorArgs === null) {
|
||||
return parent::fetchAll();
|
||||
}
|
||||
|
||||
if ($fetchArgument === null && $ctorArgs === null) {
|
||||
return parent::fetchAll($fetchMode);
|
||||
}
|
||||
|
||||
if ($ctorArgs === null) {
|
||||
return parent::fetchAll($fetchMode, $fetchArgument);
|
||||
}
|
||||
|
||||
return parent::fetchAll($fetchMode, $fetchArgument, $ctorArgs);
|
||||
} catch (\PDOException $exception) {
|
||||
throw new PDOException($exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchColumn($columnIndex = 0)
|
||||
{
|
||||
try {
|
||||
return parent::fetchColumn($columnIndex);
|
||||
} catch (\PDOException $exception) {
|
||||
throw new PDOException($exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
39
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PingableConnection.php
vendored
Normal file
39
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PingableConnection.php
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?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;
|
||||
|
||||
/**
|
||||
* An interface for connections which support a "native" ping method.
|
||||
*
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
* @author Till Klampaeckel <till@php.net>
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
interface PingableConnection
|
||||
{
|
||||
/**
|
||||
* Pings the database server to determine if the connection is still
|
||||
* available. Return true/false based on if that was successful or not.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function ping();
|
||||
}
|
||||
95
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/ResultStatement.php
vendored
Normal file
95
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/ResultStatement.php
vendored
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
<?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 The fetch mode must be one of the PDO::FETCH_* constants.
|
||||
* @param mixed $arg2
|
||||
* @param mixed $arg3
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @see PDO::FETCH_* constants.
|
||||
*/
|
||||
public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null);
|
||||
|
||||
/**
|
||||
* Returns the next row of a result set.
|
||||
*
|
||||
* @param integer|null $fetchMode Controls how the next row will be returned to the caller.
|
||||
* The value must be one of the PDO::FETCH_* constants,
|
||||
* defaulting to PDO::FETCH_BOTH.
|
||||
*
|
||||
* @return mixed The return value of this method on success depends on the fetch mode. In all cases, FALSE is
|
||||
* returned on failure.
|
||||
*
|
||||
* @see PDO::FETCH_* constants.
|
||||
*/
|
||||
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.
|
||||
* The value must be one of the PDO::FETCH_* constants,
|
||||
* defaulting to PDO::FETCH_BOTH.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @see PDO::FETCH_* constants.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
104
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLAnywhere/Driver.php
vendored
Normal file
104
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLAnywhere/Driver.php
vendored
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
<?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\SQLAnywhere;
|
||||
|
||||
use Doctrine\DBAL\DBALException;
|
||||
use Doctrine\DBAL\Driver\AbstractSQLAnywhereDriver;
|
||||
|
||||
/**
|
||||
* A Doctrine DBAL driver for the SAP Sybase SQL Anywhere PHP extension.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
class Driver extends AbstractSQLAnywhereDriver
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @throws \Doctrine\DBAL\DBALException if there was a problem establishing the connection.
|
||||
*/
|
||||
public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
|
||||
{
|
||||
try {
|
||||
return new SQLAnywhereConnection(
|
||||
$this->buildDsn(
|
||||
isset($params['host']) ? $params['host'] : null,
|
||||
isset($params['port']) ? $params['port'] : null,
|
||||
isset($params['server']) ? $params['server'] : null,
|
||||
isset($params['dbname']) ? $params['dbname'] : null,
|
||||
$username,
|
||||
$password,
|
||||
$driverOptions
|
||||
),
|
||||
isset($params['persistent']) ? $params['persistent'] : false
|
||||
);
|
||||
} catch (SQLAnywhereException $e) {
|
||||
throw DBALException::driverException($this, $e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'sqlanywhere';
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the connection string for given connection parameters and driver options.
|
||||
*
|
||||
* @param string $host Host address to connect to.
|
||||
* @param integer $port Port to use for the connection (default to SQL Anywhere standard port 2638).
|
||||
* @param string $server Database server name on the host to connect to.
|
||||
* SQL Anywhere allows multiple database server instances on the same host,
|
||||
* therefore specifying the server instance name to use is mandatory.
|
||||
* @param string $dbname Name of the database on the server instance to connect to.
|
||||
* @param string $username User name to use for connection authentication.
|
||||
* @param string $password Password to use for connection authentication.
|
||||
* @param array $driverOptions Additional parameters to use for the connection.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function buildDsn($host, $port, $server, $dbname, $username = null, $password = null, array $driverOptions = array())
|
||||
{
|
||||
$host = $host ?: 'localhost';
|
||||
$port = $port ?: 2638;
|
||||
|
||||
if (! empty($server)) {
|
||||
$server = ';ServerName=' . $server;
|
||||
}
|
||||
|
||||
return
|
||||
'HOST=' . $host . ':' . $port .
|
||||
$server .
|
||||
';DBN=' . $dbname .
|
||||
';UID=' . $username .
|
||||
';PWD=' . $password .
|
||||
';' . implode(
|
||||
';',
|
||||
array_map(function ($key, $value) {
|
||||
return $key . '=' . $value;
|
||||
}, array_keys($driverOptions), $driverOptions)
|
||||
);
|
||||
}
|
||||
}
|
||||
223
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereConnection.php
vendored
Normal file
223
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereConnection.php
vendored
Normal file
|
|
@ -0,0 +1,223 @@
|
|||
<?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\SQLAnywhere;
|
||||
|
||||
use Doctrine\DBAL\Driver\Connection;
|
||||
use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
|
||||
|
||||
/**
|
||||
* SAP Sybase SQL Anywhere implementation of the Connection interface.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
class SQLAnywhereConnection implements Connection, ServerInfoAwareConnection
|
||||
{
|
||||
/**
|
||||
* @var resource The SQL Anywhere connection resource.
|
||||
*/
|
||||
private $connection;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* Connects to database with given connection string.
|
||||
*
|
||||
* @param string $dsn The connection string.
|
||||
* @param boolean $persistent Whether or not to establish a persistent connection.
|
||||
*
|
||||
* @throws SQLAnywhereException
|
||||
*/
|
||||
public function __construct($dsn, $persistent = false)
|
||||
{
|
||||
$this->connection = $persistent ? @sasql_pconnect($dsn) : @sasql_connect($dsn);
|
||||
|
||||
if ( ! is_resource($this->connection)) {
|
||||
throw SQLAnywhereException::fromSQLAnywhereError();
|
||||
}
|
||||
|
||||
// Disable PHP warnings on error.
|
||||
if ( ! sasql_set_option($this->connection, 'verbose_errors', false)) {
|
||||
throw SQLAnywhereException::fromSQLAnywhereError($this->connection);
|
||||
}
|
||||
|
||||
// Enable auto committing by default.
|
||||
if ( ! sasql_set_option($this->connection, 'auto_commit', 'on')) {
|
||||
throw SQLAnywhereException::fromSQLAnywhereError($this->connection);
|
||||
}
|
||||
|
||||
// Enable exact, non-approximated row count retrieval.
|
||||
if ( ! sasql_set_option($this->connection, 'row_counts', true)) {
|
||||
throw SQLAnywhereException::fromSQLAnywhereError($this->connection);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @throws SQLAnywhereException
|
||||
*/
|
||||
public function beginTransaction()
|
||||
{
|
||||
if ( ! sasql_set_option($this->connection, 'auto_commit', 'off')) {
|
||||
throw SQLAnywhereException::fromSQLAnywhereError($this->connection);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @throws SQLAnywhereException
|
||||
*/
|
||||
public function commit()
|
||||
{
|
||||
if ( ! sasql_commit($this->connection)) {
|
||||
throw SQLAnywhereException::fromSQLAnywhereError($this->connection);
|
||||
}
|
||||
|
||||
$this->endTransaction();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function errorCode()
|
||||
{
|
||||
return sasql_errorcode($this->connection);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function errorInfo()
|
||||
{
|
||||
return sasql_error($this->connection);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function exec($statement)
|
||||
{
|
||||
$stmt = $this->prepare($statement);
|
||||
|
||||
$stmt->execute();
|
||||
|
||||
return $stmt->rowCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getServerVersion()
|
||||
{
|
||||
return $this->query("SELECT PROPERTY('ProductVersion')")->fetchColumn();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function lastInsertId($name = null)
|
||||
{
|
||||
if (null === $name) {
|
||||
return sasql_insert_id($this->connection);
|
||||
}
|
||||
|
||||
return $this->query('SELECT ' . $name . '.CURRVAL')->fetchColumn();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function prepare($prepareString)
|
||||
{
|
||||
return new SQLAnywhereStatement($this->connection, $prepareString);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$stmt = $this->prepare($args[0]);
|
||||
|
||||
$stmt->execute();
|
||||
|
||||
return $stmt;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function quote($input, $type = \PDO::PARAM_STR)
|
||||
{
|
||||
if (is_int($input) || is_float($input)) {
|
||||
return $input;
|
||||
}
|
||||
|
||||
return "'" . sasql_escape_string($this->connection, $input) . "'";
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function requiresQueryForServerVersion()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @throws SQLAnywhereException
|
||||
*/
|
||||
public function rollBack()
|
||||
{
|
||||
if ( ! sasql_rollback($this->connection)) {
|
||||
throw SQLAnywhereException::fromSQLAnywhereError($this->connection);
|
||||
}
|
||||
|
||||
$this->endTransaction();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ends transactional mode and enables auto commit again.
|
||||
*
|
||||
* @throws SQLAnywhereException
|
||||
*
|
||||
* @return boolean Whether or not ending transactional mode succeeded.
|
||||
*/
|
||||
private function endTransaction()
|
||||
{
|
||||
if ( ! sasql_set_option($this->connection, 'auto_commit', 'on')) {
|
||||
throw SQLAnywhereException::fromSQLAnywhereError($this->connection);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
94
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereException.php
vendored
Normal file
94
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereException.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\SQLAnywhere;
|
||||
|
||||
use Doctrine\DBAL\Driver\AbstractDriverException;
|
||||
|
||||
/**
|
||||
* SAP Sybase SQL Anywhere driver exception.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
class SQLAnywhereException extends AbstractDriverException
|
||||
{
|
||||
/**
|
||||
* Helper method to turn SQL Anywhere error into exception.
|
||||
*
|
||||
* @param resource|null $conn The SQL Anywhere connection resource to retrieve the last error from.
|
||||
* @param resource|null $stmt The SQL Anywhere statement resource to retrieve the last error from.
|
||||
*
|
||||
* @return SQLAnywhereException
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function fromSQLAnywhereError($conn = null, $stmt = null)
|
||||
{
|
||||
if (null !== $conn && ! (is_resource($conn))) {
|
||||
throw new \InvalidArgumentException('Invalid SQL Anywhere connection resource given: ' . $conn);
|
||||
}
|
||||
|
||||
if (null !== $stmt && ! (is_resource($stmt))) {
|
||||
throw new \InvalidArgumentException('Invalid SQL Anywhere statement resource given: ' . $stmt);
|
||||
}
|
||||
|
||||
$state = $conn ? sasql_sqlstate($conn) : sasql_sqlstate();
|
||||
$code = null;
|
||||
$message = null;
|
||||
|
||||
/**
|
||||
* Try retrieving the last error from statement resource if given
|
||||
*/
|
||||
if ($stmt) {
|
||||
$code = sasql_stmt_errno($stmt);
|
||||
$message = sasql_stmt_error($stmt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Try retrieving the last error from the connection resource
|
||||
* if either the statement resource is not given or the statement
|
||||
* resource is given but the last error could not be retrieved from it (fallback).
|
||||
* Depending on the type of error, it is sometimes necessary to retrieve
|
||||
* it from the connection resource even though it occurred during
|
||||
* a prepared statement.
|
||||
*/
|
||||
if ($conn && ! $code) {
|
||||
$code = sasql_errorcode($conn);
|
||||
$message = sasql_error($conn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fallback mode if either no connection resource is given
|
||||
* or the last error could not be retrieved from the given
|
||||
* connection / statement resource.
|
||||
*/
|
||||
if ( ! $conn || ! $code) {
|
||||
$code = sasql_errorcode();
|
||||
$message = sasql_error();
|
||||
}
|
||||
|
||||
if ($message) {
|
||||
return new self('SQLSTATE [' . $state . '] [' . $code . '] ' . $message, $state, $code);
|
||||
}
|
||||
|
||||
return new self('SQL Anywhere error occurred but no error message was retrieved from driver.', $state, $code);
|
||||
}
|
||||
}
|
||||
347
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereStatement.php
vendored
Normal file
347
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLAnywhere/SQLAnywhereStatement.php
vendored
Normal file
|
|
@ -0,0 +1,347 @@
|
|||
<?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\SQLAnywhere;
|
||||
|
||||
use IteratorAggregate;
|
||||
use PDO;
|
||||
use Doctrine\DBAL\Driver\Statement;
|
||||
|
||||
/**
|
||||
* SAP SQL Anywhere implementation of the Statement interface.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
class SQLAnywhereStatement implements IteratorAggregate, Statement
|
||||
{
|
||||
/**
|
||||
* @var resource The connection resource.
|
||||
*/
|
||||
private $conn;
|
||||
|
||||
/**
|
||||
* @var string Name of the default class to instantiate when fetch mode is \PDO::FETCH_CLASS.
|
||||
*/
|
||||
private $defaultFetchClass = '\stdClass';
|
||||
|
||||
/**
|
||||
* @var string Constructor arguments for the default class to instantiate when fetch mode is \PDO::FETCH_CLASS.
|
||||
*/
|
||||
private $defaultFetchClassCtorArgs = array();
|
||||
|
||||
/**
|
||||
* @var int Default fetch mode to use.
|
||||
*/
|
||||
private $defaultFetchMode = PDO::FETCH_BOTH;
|
||||
|
||||
/**
|
||||
* @var resource The result set resource to fetch.
|
||||
*/
|
||||
private $result;
|
||||
|
||||
/**
|
||||
* @var resource The prepared SQL statement to execute.
|
||||
*/
|
||||
private $stmt;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* Prepares given statement for given connection.
|
||||
*
|
||||
* @param resource $conn The connection resource to use.
|
||||
* @param string $sql The SQL statement to prepare.
|
||||
*
|
||||
* @throws SQLAnywhereException
|
||||
*/
|
||||
public function __construct($conn, $sql)
|
||||
{
|
||||
if ( ! is_resource($conn)) {
|
||||
throw new SQLAnywhereException('Invalid SQL Anywhere connection resource: ' . $conn);
|
||||
}
|
||||
|
||||
$this->conn = $conn;
|
||||
$this->stmt = sasql_prepare($conn, $sql);
|
||||
|
||||
if ( ! is_resource($this->stmt)) {
|
||||
throw SQLAnywhereException::fromSQLAnywhereError($conn);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @throws SQLAnywhereException
|
||||
*/
|
||||
public function bindParam($column, &$variable, $type = null, $length = null)
|
||||
{
|
||||
switch ($type) {
|
||||
case PDO::PARAM_INT:
|
||||
case PDO::PARAM_BOOL:
|
||||
$type = 'i';
|
||||
break;
|
||||
case PDO::PARAM_LOB:
|
||||
$type = 'b';
|
||||
break;
|
||||
case PDO::PARAM_NULL:
|
||||
case PDO::PARAM_STR:
|
||||
$type = 's';
|
||||
break;
|
||||
default:
|
||||
throw new SQLAnywhereException('Unknown type: ' . $type);
|
||||
}
|
||||
|
||||
if ( ! sasql_stmt_bind_param_ex($this->stmt, $column - 1, $variable, $type, $variable === null)) {
|
||||
throw SQLAnywhereException::fromSQLAnywhereError($this->conn, $this->stmt);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function bindValue($param, $value, $type = null)
|
||||
{
|
||||
return $this->bindParam($param, $value, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @throws SQLAnywhereException
|
||||
*/
|
||||
public function closeCursor()
|
||||
{
|
||||
if (!sasql_stmt_reset($this->stmt)) {
|
||||
throw SQLAnywhereException::fromSQLAnywhereError($this->conn, $this->stmt);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function columnCount()
|
||||
{
|
||||
return sasql_stmt_field_count($this->stmt);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function errorCode()
|
||||
{
|
||||
return sasql_stmt_errno($this->stmt);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function errorInfo()
|
||||
{
|
||||
return sasql_stmt_error($this->stmt);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @throws SQLAnywhereException
|
||||
*/
|
||||
public function execute($params = null)
|
||||
{
|
||||
if (is_array($params)) {
|
||||
$hasZeroIndex = array_key_exists(0, $params);
|
||||
|
||||
foreach ($params as $key => $val) {
|
||||
$key = ($hasZeroIndex && is_numeric($key)) ? $key + 1 : $key;
|
||||
|
||||
$this->bindValue($key, $val);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! sasql_stmt_execute($this->stmt)) {
|
||||
throw SQLAnywhereException::fromSQLAnywhereError($this->conn, $this->stmt);
|
||||
}
|
||||
|
||||
$this->result = sasql_stmt_result_metadata($this->stmt);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @throws SQLAnywhereException
|
||||
*/
|
||||
public function fetch($fetchMode = null)
|
||||
{
|
||||
if ( ! is_resource($this->result)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$fetchMode = $fetchMode ?: $this->defaultFetchMode;
|
||||
|
||||
switch ($fetchMode) {
|
||||
case PDO::FETCH_ASSOC:
|
||||
return sasql_fetch_assoc($this->result);
|
||||
case PDO::FETCH_BOTH:
|
||||
return sasql_fetch_array($this->result, SASQL_BOTH);
|
||||
case PDO::FETCH_CLASS:
|
||||
$className = $this->defaultFetchClass;
|
||||
$ctorArgs = $this->defaultFetchClassCtorArgs;
|
||||
|
||||
if (func_num_args() >= 2) {
|
||||
$args = func_get_args();
|
||||
$className = $args[1];
|
||||
$ctorArgs = isset($args[2]) ? $args[2] : array();
|
||||
}
|
||||
|
||||
$result = sasql_fetch_object($this->result);
|
||||
|
||||
if ($result instanceof \stdClass) {
|
||||
$result = $this->castObject($result, $className, $ctorArgs);
|
||||
}
|
||||
|
||||
return $result;
|
||||
case PDO::FETCH_NUM:
|
||||
return sasql_fetch_row($this->result);
|
||||
case PDO::FETCH_OBJ:
|
||||
return sasql_fetch_object($this->result);
|
||||
default:
|
||||
throw new SQLAnywhereException('Fetch mode is not supported: ' . $fetchMode);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchAll($fetchMode = null)
|
||||
{
|
||||
$rows = array();
|
||||
|
||||
switch ($fetchMode) {
|
||||
case PDO::FETCH_CLASS:
|
||||
while ($row = call_user_func_array(array($this, 'fetch'), func_get_args())) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
break;
|
||||
case PDO::FETCH_COLUMN:
|
||||
while ($row = $this->fetchColumn()) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
while ($row = $this->fetch($fetchMode)) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchColumn($columnIndex = 0)
|
||||
{
|
||||
$row = $this->fetch(PDO::FETCH_NUM);
|
||||
|
||||
if (false === $row) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return isset($row[$columnIndex]) ? $row[$columnIndex] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
return new \ArrayIterator($this->fetchAll());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rowCount()
|
||||
{
|
||||
return sasql_stmt_affected_rows($this->stmt);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null)
|
||||
{
|
||||
$this->defaultFetchMode = $fetchMode;
|
||||
$this->defaultFetchClass = $arg2 ? $arg2 : $this->defaultFetchClass;
|
||||
$this->defaultFetchClassCtorArgs = $arg3 ? (array) $arg3 : $this->defaultFetchClassCtorArgs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts a stdClass object to the given class name mapping its' properties.
|
||||
*
|
||||
* @param \stdClass $sourceObject Object to cast from.
|
||||
* @param string|object $destinationClass Name of the class or class instance to cast to.
|
||||
* @param array $ctorArgs Arguments to use for constructing the destination class instance.
|
||||
*
|
||||
* @return object
|
||||
*
|
||||
* @throws SQLAnywhereException
|
||||
*/
|
||||
private function castObject(\stdClass $sourceObject, $destinationClass, array $ctorArgs = array())
|
||||
{
|
||||
if ( ! is_string($destinationClass)) {
|
||||
if ( ! is_object($destinationClass)) {
|
||||
throw new SQLAnywhereException(sprintf(
|
||||
'Destination class has to be of type string or object, %s given.', gettype($destinationClass)
|
||||
));
|
||||
}
|
||||
} else {
|
||||
$destinationClass = new \ReflectionClass($destinationClass);
|
||||
$destinationClass = $destinationClass->newInstanceArgs($ctorArgs);
|
||||
}
|
||||
|
||||
$sourceReflection = new \ReflectionObject($sourceObject);
|
||||
$destinationClassReflection = new \ReflectionObject($destinationClass);
|
||||
|
||||
foreach ($sourceReflection->getProperties() as $sourceProperty) {
|
||||
$sourceProperty->setAccessible(true);
|
||||
|
||||
$name = $sourceProperty->getName();
|
||||
$value = $sourceProperty->getValue($sourceObject);
|
||||
|
||||
if ($destinationClassReflection->hasProperty($name)) {
|
||||
$destinationProperty = $destinationClassReflection->getProperty($name);
|
||||
|
||||
$destinationProperty->setAccessible(true);
|
||||
$destinationProperty->setValue($destinationClass, $value);
|
||||
} else {
|
||||
$destinationClass->$name = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $destinationClass;
|
||||
}
|
||||
}
|
||||
68
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/Driver.php
vendored
Normal file
68
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/Driver.php
vendored
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
<?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 Doctrine\DBAL\Driver\AbstractSQLServerDriver;
|
||||
|
||||
/**
|
||||
* Driver for ext/sqlsrv.
|
||||
*/
|
||||
class Driver extends AbstractSQLServerDriver
|
||||
{
|
||||
/**
|
||||
* {@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.");
|
||||
}
|
||||
|
||||
$serverName = $params['host'];
|
||||
if (isset($params['port'])) {
|
||||
$serverName .= ', ' . $params['port'];
|
||||
}
|
||||
|
||||
if (isset($params['dbname'])) {
|
||||
$driverOptions['Database'] = $params['dbname'];
|
||||
}
|
||||
|
||||
if (isset($params['charset'])) {
|
||||
$driverOptions['CharacterSet'] = $params['charset'];
|
||||
}
|
||||
|
||||
$driverOptions['UID'] = $username;
|
||||
$driverOptions['PWD'] = $password;
|
||||
|
||||
if (!isset($driverOptions['ReturnDatesAsStrings'])) {
|
||||
$driverOptions['ReturnDatesAsStrings'] = 1;
|
||||
}
|
||||
|
||||
return new SQLSrvConnection($serverName, $driverOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'sqlsrv';
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
192
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvConnection.php
vendored
Normal file
192
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvConnection.php
vendored
Normal file
|
|
@ -0,0 +1,192 @@
|
|||
<?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 Doctrine\DBAL\Driver\Connection;
|
||||
use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
|
||||
|
||||
/**
|
||||
* SQL Server implementation for the Connection interface.
|
||||
*
|
||||
* @since 2.3
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
*/
|
||||
class SQLSrvConnection implements Connection, ServerInfoAwareConnection
|
||||
{
|
||||
/**
|
||||
* @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)
|
||||
{
|
||||
if ( ! sqlsrv_configure('WarningsReturnAsErrors', 0)) {
|
||||
throw SQLSrvException::fromSqlSrvErrors();
|
||||
}
|
||||
|
||||
$this->conn = sqlsrv_connect($serverName, $connectionOptions);
|
||||
if ( ! $this->conn) {
|
||||
throw SQLSrvException::fromSqlSrvErrors();
|
||||
}
|
||||
$this->lastInsertId = new LastInsertId();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getServerVersion()
|
||||
{
|
||||
$serverInfo = sqlsrv_server_info($this->conn);
|
||||
|
||||
return $serverInfo['SQLServerVersion'];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function requiresQueryForServerVersion()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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;
|
||||
} elseif (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) {
|
||||
$stmt = $this->prepare('SELECT CONVERT(VARCHAR(MAX), current_value) FROM sys.sequences WHERE name = ?');
|
||||
$stmt->execute(array($name));
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
56
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvException.php
vendored
Normal file
56
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvException.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\SQLSrv;
|
||||
|
||||
|
||||
use Doctrine\DBAL\Driver\AbstractDriverException;
|
||||
|
||||
class SQLSrvException extends AbstractDriverException
|
||||
{
|
||||
/**
|
||||
* 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 = "";
|
||||
$sqlState = null;
|
||||
$errorCode = null;
|
||||
|
||||
foreach ($errors as $error) {
|
||||
$message .= "SQLSTATE [".$error['SQLSTATE'].", ".$error['code']."]: ". $error['message']."\n";
|
||||
|
||||
if (null === $sqlState) {
|
||||
$sqlState = $error['SQLSTATE'];
|
||||
}
|
||||
|
||||
if (null === $errorCode) {
|
||||
$errorCode = $error['code'];
|
||||
}
|
||||
}
|
||||
if ( ! $message) {
|
||||
$message = "SQL Server error occurred but no error message was retrieved from driver.";
|
||||
}
|
||||
|
||||
return new self(rtrim($message), $sqlState, $errorCode);
|
||||
}
|
||||
}
|
||||
384
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php
vendored
Normal file
384
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php
vendored
Normal file
|
|
@ -0,0 +1,384 @@
|
|||
<?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;
|
||||
|
||||
/**
|
||||
* References to the variables bound as statement parameters.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $variables = array();
|
||||
|
||||
/**
|
||||
* Bound parameter types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $types = 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 name of the default class to instantiate when fetch mode is \PDO::FETCH_CLASS.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $defaultFetchClass = '\stdClass';
|
||||
|
||||
/**
|
||||
* The constructor arguments for the default class to instantiate when fetch mode is \PDO::FETCH_CLASS.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $defaultFetchClassCtorArgs = array();
|
||||
|
||||
/**
|
||||
* The fetch style.
|
||||
*
|
||||
* @param integer
|
||||
*/
|
||||
private $defaultFetchMode = PDO::FETCH_BOTH;
|
||||
|
||||
/**
|
||||
* The last insert ID.
|
||||
*
|
||||
* @var \Doctrine\DBAL\Driver\SQLSrv\LastInsertId|null
|
||||
*/
|
||||
private $lastInsertId;
|
||||
|
||||
/**
|
||||
* Indicates whether the statement is in the state when fetching results is possible
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $result = false;
|
||||
|
||||
/**
|
||||
* 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 \Doctrine\DBAL\Driver\SQLSrv\LastInsertId|null $lastInsertId
|
||||
*/
|
||||
public function __construct($conn, $sql, LastInsertId $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)
|
||||
{
|
||||
if (!is_numeric($param)) {
|
||||
throw new SQLSrvException(
|
||||
'sqlsrv does not support named parameters to queries, use question mark (?) placeholders instead.'
|
||||
);
|
||||
}
|
||||
|
||||
$this->variables[$param] = $value;
|
||||
$this->types[$param] = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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.");
|
||||
}
|
||||
|
||||
$this->variables[$column] =& $variable;
|
||||
$this->types[$column] = $type;
|
||||
|
||||
// unset the statement resource if it exists as the new one will need to be bound to the new variable
|
||||
$this->stmt = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function closeCursor()
|
||||
{
|
||||
// not having the result means there's nothing to close
|
||||
if (!$this->result) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// emulate it by fetching and discarding rows, similarly to what PDO does in this case
|
||||
// @link http://php.net/manual/en/pdostatement.closecursor.php
|
||||
// @link https://github.com/php/php-src/blob/php-7.0.11/ext/pdo/pdo_stmt.c#L2075
|
||||
// deliberately do not consider multiple result sets, since doctrine/dbal doesn't support them
|
||||
while (sqlsrv_fetch($this->stmt));
|
||||
|
||||
$this->result = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $this->stmt) {
|
||||
$this->stmt = $this->prepare();
|
||||
}
|
||||
|
||||
if (!sqlsrv_execute($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));
|
||||
}
|
||||
|
||||
$this->result = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares SQL Server statement resource
|
||||
*
|
||||
* @return resource
|
||||
* @throws SQLSrvException
|
||||
*/
|
||||
private function prepare()
|
||||
{
|
||||
$params = array();
|
||||
|
||||
foreach ($this->variables as $column => &$variable) {
|
||||
if ($this->types[$column] === \PDO::PARAM_LOB) {
|
||||
$params[$column - 1] = array(
|
||||
&$variable,
|
||||
SQLSRV_PARAM_IN,
|
||||
SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY),
|
||||
SQLSRV_SQLTYPE_VARBINARY('max'),
|
||||
);
|
||||
} else {
|
||||
$params[$column - 1] =& $variable;
|
||||
}
|
||||
}
|
||||
|
||||
$stmt = sqlsrv_prepare($this->conn, $this->sql, $params);
|
||||
|
||||
if (!$stmt) {
|
||||
throw SQLSrvException::fromSqlSrvErrors();
|
||||
}
|
||||
|
||||
return $stmt;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null)
|
||||
{
|
||||
$this->defaultFetchMode = $fetchMode;
|
||||
$this->defaultFetchClass = $arg2 ?: $this->defaultFetchClass;
|
||||
$this->defaultFetchClassCtorArgs = $arg3 ? (array) $arg3 : $this->defaultFetchClassCtorArgs;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
$data = $this->fetchAll();
|
||||
|
||||
return new \ArrayIterator($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetch($fetchMode = null)
|
||||
{
|
||||
// do not try fetching from the statement if it's not expected to contain result
|
||||
// in order to prevent exceptional situation
|
||||
if (!$this->result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$args = func_get_args();
|
||||
$fetchMode = $fetchMode ?: $this->defaultFetchMode;
|
||||
|
||||
if (isset(self::$fetchMap[$fetchMode])) {
|
||||
return sqlsrv_fetch_array($this->stmt, self::$fetchMap[$fetchMode]) ?: false;
|
||||
}
|
||||
|
||||
if ($fetchMode == PDO::FETCH_OBJ || $fetchMode == PDO::FETCH_CLASS) {
|
||||
$className = $this->defaultFetchClass;
|
||||
$ctorArgs = $this->defaultFetchClassCtorArgs;
|
||||
|
||||
if (count($args) >= 2) {
|
||||
$className = $args[1];
|
||||
$ctorArgs = (isset($args[2])) ? $args[2] : array();
|
||||
}
|
||||
|
||||
return sqlsrv_fetch_object($this->stmt, $className, $ctorArgs) ?: false;
|
||||
}
|
||||
|
||||
throw new SQLSrvException("Fetch mode is not supported!");
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchAll($fetchMode = null)
|
||||
{
|
||||
$rows = array();
|
||||
|
||||
switch ($fetchMode) {
|
||||
case PDO::FETCH_CLASS:
|
||||
while ($row = call_user_func_array(array($this, 'fetch'), func_get_args())) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
break;
|
||||
case PDO::FETCH_COLUMN:
|
||||
while ($row = $this->fetchColumn()) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
while ($row = $this->fetch($fetchMode)) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fetchColumn($columnIndex = 0)
|
||||
{
|
||||
$row = $this->fetch(PDO::FETCH_NUM);
|
||||
|
||||
if (false === $row) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return isset($row[$columnIndex]) ? $row[$columnIndex] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rowCount()
|
||||
{
|
||||
return sqlsrv_rows_affected($this->stmt);
|
||||
}
|
||||
}
|
||||
44
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/ServerInfoAwareConnection.php
vendored
Normal file
44
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/ServerInfoAwareConnection.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;
|
||||
|
||||
/**
|
||||
* Contract for a connection that is able to provide information about the server it is connected to.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
interface ServerInfoAwareConnection
|
||||
{
|
||||
/**
|
||||
* Returns the version number of the database server connected to.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getServerVersion();
|
||||
|
||||
/**
|
||||
* Checks whether a query is required to retrieve the database server version.
|
||||
*
|
||||
* @return boolean True if a query is required to retrieve the database server version, false otherwise.
|
||||
*/
|
||||
public function requiresQueryForServerVersion();
|
||||
}
|
||||
128
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Statement.php
vendored
Normal file
128
vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Statement.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\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 (not supported by mysqli driver, see comment below) or positional
|
||||
* placeholder in the SQL statement that was used to prepare the statement.
|
||||
*
|
||||
* As mentioned above, the named parameters are not natively supported by the mysqli driver, use executeQuery(),
|
||||
* fetchAll(), fetchArray(), fetchColumn(), fetchAssoc() methods to have the named parameter emulated by doctrine.
|
||||
*
|
||||
* @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 (not supported by mysqli driver, see comment below) 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.
|
||||
*
|
||||
* As mentioned above, the named parameters are not natively supported by the mysqli driver, use executeQuery(),
|
||||
* fetchAll(), fetchArray(), fetchColumn(), fetchAssoc() methods to have the named parameter emulated by doctrine.
|
||||
*
|
||||
* 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();
|
||||
}
|
||||
424
vendor/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php
vendored
Normal file
424
vendor/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php
vendored
Normal file
|
|
@ -0,0 +1,424 @@
|
|||
<?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_sqlsrv' => 'Doctrine\DBAL\Driver\PDOSqlsrv\Driver',
|
||||
'mysqli' => 'Doctrine\DBAL\Driver\Mysqli\Driver',
|
||||
'drizzle_pdo_mysql' => 'Doctrine\DBAL\Driver\DrizzlePDOMySql\Driver',
|
||||
'sqlanywhere' => 'Doctrine\DBAL\Driver\SQLAnywhere\Driver',
|
||||
'sqlsrv' => 'Doctrine\DBAL\Driver\SQLSrv\Driver',
|
||||
);
|
||||
|
||||
/**
|
||||
* List of URL schemes from a database URL and their mappings to driver.
|
||||
*/
|
||||
private static $driverSchemeAliases = array(
|
||||
'db2' => 'ibm_db2',
|
||||
'mssql' => 'pdo_sqlsrv',
|
||||
'mysql' => 'pdo_mysql',
|
||||
'mysql2' => 'pdo_mysql', // Amazon RDS, for some weird reason
|
||||
'postgres' => 'pdo_pgsql',
|
||||
'postgresql' => 'pdo_pgsql',
|
||||
'pgsql' => 'pdo_pgsql',
|
||||
'sqlite' => 'pdo_sqlite',
|
||||
'sqlite3' => 'pdo_sqlite',
|
||||
);
|
||||
|
||||
/**
|
||||
* 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_sqlsrv
|
||||
* mysqli
|
||||
* sqlanywhere
|
||||
* 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();
|
||||
}
|
||||
|
||||
$params = self::parseDatabaseUrl($params);
|
||||
|
||||
// check for existing pdo object
|
||||
if (isset($params['pdo']) && ! $params['pdo'] instanceof \PDO) {
|
||||
throw DBALException::invalidPdoInstance();
|
||||
} elseif (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']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalizes the given connection URL path.
|
||||
*
|
||||
* @param string $urlPath
|
||||
*
|
||||
* @return string The normalized connection URL path
|
||||
*/
|
||||
private static function normalizeDatabaseUrlPath($urlPath)
|
||||
{
|
||||
// Trim leading slash from URL path.
|
||||
return substr($urlPath, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts parts from a database URL, if present, and returns an
|
||||
* updated list of parameters.
|
||||
*
|
||||
* @param array $params The list of parameters.
|
||||
*
|
||||
* @param array A modified list of parameters with info from a database
|
||||
* URL extracted into indidivual parameter parts.
|
||||
*
|
||||
*/
|
||||
private static function parseDatabaseUrl(array $params)
|
||||
{
|
||||
if (!isset($params['url'])) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
// (pdo_)?sqlite3?:///... => (pdo_)?sqlite3?://localhost/... or else the URL will be invalid
|
||||
$url = preg_replace('#^((?:pdo_)?sqlite3?):///#', '$1://localhost/', $params['url']);
|
||||
|
||||
// PHP < 5.4.8 doesn't parse schemeless urls properly.
|
||||
// See: https://php.net/parse-url#refsect1-function.parse-url-changelog
|
||||
if (PHP_VERSION_ID < 50408 && strpos($url, '//') === 0) {
|
||||
$url = parse_url('fake:' . $url);
|
||||
|
||||
unset($url['scheme']);
|
||||
} else {
|
||||
$url = parse_url($url);
|
||||
}
|
||||
|
||||
if ($url === false) {
|
||||
throw new DBALException('Malformed parameter "url".');
|
||||
}
|
||||
|
||||
// If we have a connection URL, we have to unset the default PDO instance connection parameter (if any)
|
||||
// as we cannot merge connection details from the URL into the PDO instance (URL takes precedence).
|
||||
unset($params['pdo']);
|
||||
|
||||
$params = self::parseDatabaseUrlScheme($url, $params);
|
||||
|
||||
if (isset($url['host'])) {
|
||||
$params['host'] = $url['host'];
|
||||
}
|
||||
if (isset($url['port'])) {
|
||||
$params['port'] = $url['port'];
|
||||
}
|
||||
if (isset($url['user'])) {
|
||||
$params['user'] = $url['user'];
|
||||
}
|
||||
if (isset($url['pass'])) {
|
||||
$params['password'] = $url['pass'];
|
||||
}
|
||||
|
||||
$params = self::parseDatabaseUrlPath($url, $params);
|
||||
$params = self::parseDatabaseUrlQuery($url, $params);
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the given connection URL and resolves the given connection parameters.
|
||||
*
|
||||
* Assumes that the connection URL scheme is already parsed and resolved into the given connection parameters
|
||||
* via {@link parseDatabaseUrlScheme}.
|
||||
*
|
||||
* @param array $url The URL parts to evaluate.
|
||||
* @param array $params The connection parameters to resolve.
|
||||
*
|
||||
* @return array The resolved connection parameters.
|
||||
*
|
||||
* @see parseDatabaseUrlScheme
|
||||
*/
|
||||
private static function parseDatabaseUrlPath(array $url, array $params)
|
||||
{
|
||||
if (! isset($url['path'])) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
$url['path'] = self::normalizeDatabaseUrlPath($url['path']);
|
||||
|
||||
// If we do not have a known DBAL driver, we do not know any connection URL path semantics to evaluate
|
||||
// and therefore treat the path as regular DBAL connection URL path.
|
||||
if (! isset($params['driver'])) {
|
||||
return self::parseRegularDatabaseUrlPath($url, $params);
|
||||
}
|
||||
|
||||
if (strpos($params['driver'], 'sqlite') !== false) {
|
||||
return self::parseSqliteDatabaseUrlPath($url, $params);
|
||||
}
|
||||
|
||||
return self::parseRegularDatabaseUrlPath($url, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the query part of the given connection URL and resolves the given connection parameters.
|
||||
*
|
||||
* @param array $url The connection URL parts to evaluate.
|
||||
* @param array $params The connection parameters to resolve.
|
||||
*
|
||||
* @return array The resolved connection parameters.
|
||||
*/
|
||||
private static function parseDatabaseUrlQuery(array $url, array $params)
|
||||
{
|
||||
if (! isset($url['query'])) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
$query = array();
|
||||
|
||||
parse_str($url['query'], $query); // simply ingest query as extra params, e.g. charset or sslmode
|
||||
|
||||
return array_merge($params, $query); // parse_str wipes existing array elements
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the given regular connection URL and resolves the given connection parameters.
|
||||
*
|
||||
* Assumes that the "path" URL part is already normalized via {@link normalizeDatabaseUrlPath}.
|
||||
*
|
||||
* @param array $url The regular connection URL parts to evaluate.
|
||||
* @param array $params The connection parameters to resolve.
|
||||
*
|
||||
* @return array The resolved connection parameters.
|
||||
*
|
||||
* @see normalizeDatabaseUrlPath
|
||||
*/
|
||||
private static function parseRegularDatabaseUrlPath(array $url, array $params)
|
||||
{
|
||||
$params['dbname'] = $url['path'];
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the given SQLite connection URL and resolves the given connection parameters.
|
||||
*
|
||||
* Assumes that the "path" URL part is already normalized via {@link normalizeDatabaseUrlPath}.
|
||||
*
|
||||
* @param array $url The SQLite connection URL parts to evaluate.
|
||||
* @param array $params The connection parameters to resolve.
|
||||
*
|
||||
* @return array The resolved connection parameters.
|
||||
*
|
||||
* @see normalizeDatabaseUrlPath
|
||||
*/
|
||||
private static function parseSqliteDatabaseUrlPath(array $url, array $params)
|
||||
{
|
||||
if ($url['path'] === ':memory:') {
|
||||
$params['memory'] = true;
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
$params['path'] = $url['path']; // pdo_sqlite driver uses 'path' instead of 'dbname' key
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the scheme part from given connection URL and resolves the given connection parameters.
|
||||
*
|
||||
* @param array $url The connection URL parts to evaluate.
|
||||
* @param array $params The connection parameters to resolve.
|
||||
*
|
||||
* @return array The resolved connection parameters.
|
||||
*
|
||||
* @throws DBALException if parsing failed or resolution is not possible.
|
||||
*/
|
||||
private static function parseDatabaseUrlScheme(array $url, array $params)
|
||||
{
|
||||
if (isset($url['scheme'])) {
|
||||
// The requested driver from the URL scheme takes precedence
|
||||
// over the default custom driver from the connection parameters (if any).
|
||||
unset($params['driverClass']);
|
||||
|
||||
// URL schemes must not contain underscores, but dashes are ok
|
||||
$driver = str_replace('-', '_', $url['scheme']);
|
||||
|
||||
// The requested driver from the URL scheme takes precedence
|
||||
// over the default driver from the connection parameters (if any).
|
||||
$params['driver'] = isset(self::$driverSchemeAliases[$driver])
|
||||
// use alias like "postgres", else we just let checkParams decide later
|
||||
// if the driver exists (for literal "pdo-pgsql" etc)
|
||||
? self::$driverSchemeAliases[$driver]
|
||||
: $driver;
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
||||
// If a schemeless connection URL is given, we require a default driver or default custom driver
|
||||
// as connection parameter.
|
||||
if (! isset($params['driverClass']) && ! isset($params['driver'])) {
|
||||
throw DBALException::driverRequired($params['url']);
|
||||
}
|
||||
|
||||
return $params;
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
90
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php
vendored
Normal file
90
vendor/doctrine/dbal/lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php
vendored
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
<?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) {
|
||||
if ($option === 'CURRENT_SCHEMA') {
|
||||
$vars[] = $option . " = " . $value;
|
||||
} else {
|
||||
$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('SchemaDropTableEventArgs 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';
|
||||
}
|
||||
31
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/ConnectionException.php
vendored
Normal file
31
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/ConnectionException.php
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?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\Exception;
|
||||
|
||||
/**
|
||||
* Base class for all connection related errors detected in the driver.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
class ConnectionException extends DriverException
|
||||
{
|
||||
}
|
||||
31
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/ConstraintViolationException.php
vendored
Normal file
31
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/ConstraintViolationException.php
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?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\Exception;
|
||||
|
||||
/**
|
||||
* Base class for all constraint violation related errors detected in the driver.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
class ConstraintViolationException extends ServerException
|
||||
{
|
||||
}
|
||||
35
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/DatabaseObjectExistsException.php
vendored
Normal file
35
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/DatabaseObjectExistsException.php
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?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\Exception;
|
||||
|
||||
/**
|
||||
* Base class for all already existing database object related errors detected in the driver.
|
||||
*
|
||||
* A database object is considered any asset that can be created in a database
|
||||
* such as schemas, tables, views, sequences, triggers, constraints, indexes,
|
||||
* functions, stored procedures etc.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
class DatabaseObjectExistsException extends ServerException
|
||||
{
|
||||
}
|
||||
35
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/DatabaseObjectNotFoundException.php
vendored
Normal file
35
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/DatabaseObjectNotFoundException.php
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?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\Exception;
|
||||
|
||||
/**
|
||||
* Base class for all unknown database object related errors detected in the driver.
|
||||
*
|
||||
* A database object is considered any asset that can be created in a database
|
||||
* such as schemas, tables, views, sequences, triggers, constraints, indexes,
|
||||
* functions, stored procedures etc.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
class DatabaseObjectNotFoundException extends ServerException
|
||||
{
|
||||
}
|
||||
82
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/DriverException.php
vendored
Normal file
82
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/DriverException.php
vendored
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
<?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\Exception;
|
||||
|
||||
use Doctrine\DBAL\DBALException;
|
||||
|
||||
/**
|
||||
* Base class for all errors detected in the driver.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
class DriverException extends DBALException
|
||||
{
|
||||
/**
|
||||
* The previous DBAL driver exception.
|
||||
*
|
||||
* @var \Doctrine\DBAL\Driver\DriverException
|
||||
*/
|
||||
private $driverException;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $message The exception message.
|
||||
* @param \Doctrine\DBAL\Driver\DriverException $driverException The DBAL driver exception to chain.
|
||||
*/
|
||||
public function __construct($message, \Doctrine\DBAL\Driver\DriverException $driverException)
|
||||
{
|
||||
$exception = null;
|
||||
|
||||
if ($driverException instanceof \Exception) {
|
||||
$exception = $driverException;
|
||||
}
|
||||
|
||||
parent::__construct($message, 0, $exception);
|
||||
|
||||
$this->driverException = $driverException;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the driver specific error code if given.
|
||||
*
|
||||
* Returns null if no error code was given by the driver.
|
||||
*
|
||||
* @return integer|string|null
|
||||
*/
|
||||
public function getErrorCode()
|
||||
{
|
||||
return $this->driverException->getErrorCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the SQLSTATE the driver was in at the time the error occurred, if given.
|
||||
*
|
||||
* Returns null if no SQLSTATE was given by the driver.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getSQLState()
|
||||
{
|
||||
return $this->driverException->getSQLState();
|
||||
}
|
||||
}
|
||||
32
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/ForeignKeyConstraintViolationException.php
vendored
Normal file
32
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/ForeignKeyConstraintViolationException.php
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?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\Exception;
|
||||
|
||||
/**
|
||||
* Exception for a foreign key constraint violation detected in the driver.
|
||||
*
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
class ForeignKeyConstraintViolationException extends ConstraintViolationException
|
||||
{
|
||||
}
|
||||
40
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/InvalidArgumentException.php
vendored
Normal file
40
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/InvalidArgumentException.php
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?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\Exception;
|
||||
|
||||
use Doctrine\DBAL\DBALException;
|
||||
|
||||
/**
|
||||
* Exception to be thrown when invalid arguments are passed to any DBAL API
|
||||
*
|
||||
* @author Marco Pivetta <ocramius@gmail.com>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
class InvalidArgumentException extends DBALException
|
||||
{
|
||||
/**
|
||||
* @return self
|
||||
*/
|
||||
public static function fromEmptyCriteria()
|
||||
{
|
||||
return new self('Empty criteria was used, expected non-empty criteria');
|
||||
}
|
||||
}
|
||||
31
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/InvalidFieldNameException.php
vendored
Normal file
31
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/InvalidFieldNameException.php
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?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\Exception;
|
||||
|
||||
/**
|
||||
* Exception for an invalid specified field name in a statement detected in the driver.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
class InvalidFieldNameException extends ServerException
|
||||
{
|
||||
}
|
||||
31
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/NonUniqueFieldNameException.php
vendored
Normal file
31
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/NonUniqueFieldNameException.php
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?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\Exception;
|
||||
|
||||
/**
|
||||
* Exception for a non-unique/ambiguous specified field name in a statement detected in the driver.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
class NonUniqueFieldNameException extends ServerException
|
||||
{
|
||||
}
|
||||
32
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/NotNullConstraintViolationException.php
vendored
Normal file
32
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/NotNullConstraintViolationException.php
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?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\Exception;
|
||||
|
||||
/**
|
||||
* Exception for a NOT NULL constraint violation detected in the driver.
|
||||
*
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
class NotNullConstraintViolationException extends ConstraintViolationException
|
||||
{
|
||||
}
|
||||
31
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/ReadOnlyException.php
vendored
Normal file
31
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/ReadOnlyException.php
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?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\Exception;
|
||||
|
||||
/**
|
||||
* Exception for a write operation attempt on a read-only database element detected in the driver.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
class ReadOnlyException extends ServerException
|
||||
{
|
||||
}
|
||||
31
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/ServerException.php
vendored
Normal file
31
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/ServerException.php
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?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\Exception;
|
||||
|
||||
/**
|
||||
* Base class for all server related errors detected in the driver.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
class ServerException extends DriverException
|
||||
{
|
||||
}
|
||||
31
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/SyntaxErrorException.php
vendored
Normal file
31
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/SyntaxErrorException.php
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?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\Exception;
|
||||
|
||||
/**
|
||||
* Exception for a syntax error in a statement detected in the driver.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
class SyntaxErrorException extends ServerException
|
||||
{
|
||||
}
|
||||
31
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/TableExistsException.php
vendored
Normal file
31
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/TableExistsException.php
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?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\Exception;
|
||||
|
||||
/**
|
||||
* Exception for an already existing table referenced in a statement detected in the driver.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
class TableExistsException extends DatabaseObjectExistsException
|
||||
{
|
||||
}
|
||||
31
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/TableNotFoundException.php
vendored
Normal file
31
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/TableNotFoundException.php
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?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\Exception;
|
||||
|
||||
/**
|
||||
* Exception for an unknown table referenced in a statement detected in the driver.
|
||||
*
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
class TableNotFoundException extends DatabaseObjectNotFoundException
|
||||
{
|
||||
}
|
||||
32
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/UniqueConstraintViolationException.php
vendored
Normal file
32
vendor/doctrine/dbal/lib/Doctrine/DBAL/Exception/UniqueConstraintViolationException.php
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?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\Exception;
|
||||
|
||||
/**
|
||||
* Exception for a unique constraint violation detected in the driver.
|
||||
*
|
||||
* @author Benjamin Eberlei <kontakt@beberlei.de>
|
||||
* @author Steve Müller <st.mueller@dzh-online.de>
|
||||
* @link www.doctrine-project.org
|
||||
* @since 2.5
|
||||
*/
|
||||
class UniqueConstraintViolationException extends ConstraintViolationException
|
||||
{
|
||||
}
|
||||
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();
|
||||
}
|
||||
3536
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
vendored
Normal file
3536
vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
vendored
Normal file
File diff suppressed because it is too large
Load diff
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue