-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed broken doctrine/dbal broken dependency (#34, NOJIRA)
- Loading branch information
Showing
33 changed files
with
5,698 additions
and
25 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
app/vendor/doctrine/dbal/src/Driver/API/SQLite/UserDefinedFunctions.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace Doctrine\DBAL\Driver\API\SQLite; | ||
|
||
use function strpos; | ||
|
||
/** | ||
* User-defined SQLite functions. | ||
* | ||
* @internal | ||
*/ | ||
final class UserDefinedFunctions | ||
{ | ||
/** | ||
* User-defined function that implements MOD(). | ||
* | ||
* @param int $a | ||
* @param int $b | ||
*/ | ||
public static function mod($a, $b): int | ||
{ | ||
return $a % $b; | ||
} | ||
|
||
/** | ||
* User-defined function that implements LOCATE(). | ||
* | ||
* @param string $str | ||
* @param string $substr | ||
* @param int $offset | ||
*/ | ||
public static function locate($str, $substr, $offset = 0): int | ||
{ | ||
// SQL's LOCATE function works on 1-based positions, while PHP's strpos works on 0-based positions. | ||
// So we have to make them compatible if an offset is given. | ||
if ($offset > 0) { | ||
$offset -= 1; | ||
} | ||
|
||
$pos = strpos($str, $substr, $offset); | ||
|
||
if ($pos !== false) { | ||
return $pos + 1; | ||
} | ||
|
||
return 0; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
app/vendor/doctrine/dbal/src/Driver/IBMDB2/Exception/Factory.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\DBAL\Driver\IBMDB2\Exception; | ||
|
||
use Doctrine\DBAL\Driver\AbstractException; | ||
|
||
use function preg_match; | ||
|
||
/** | ||
* @internal | ||
* | ||
* @psalm-immutable | ||
*/ | ||
final class Factory | ||
{ | ||
/** | ||
* @param callable(int): T $constructor | ||
* | ||
* @return T | ||
* | ||
* @template T of AbstractException | ||
*/ | ||
public static function create(string $message, callable $constructor): AbstractException | ||
{ | ||
$code = 0; | ||
|
||
if (preg_match('/ SQL(\d+)N /', $message, $matches) === 1) { | ||
$code = -(int) $matches[1]; | ||
} | ||
|
||
return $constructor($code); | ||
} | ||
} |
116 changes: 116 additions & 0 deletions
116
app/vendor/doctrine/dbal/src/Driver/Middleware/AbstractConnectionMiddleware.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
<?php | ||
|
||
namespace Doctrine\DBAL\Driver\Middleware; | ||
|
||
use Doctrine\DBAL\Driver\Connection; | ||
use Doctrine\DBAL\Driver\Result; | ||
use Doctrine\DBAL\Driver\ServerInfoAwareConnection; | ||
use Doctrine\DBAL\Driver\Statement; | ||
use Doctrine\DBAL\ParameterType; | ||
use Doctrine\Deprecations\Deprecation; | ||
use LogicException; | ||
|
||
use function get_class; | ||
use function method_exists; | ||
use function sprintf; | ||
|
||
abstract class AbstractConnectionMiddleware implements ServerInfoAwareConnection | ||
{ | ||
/** @var Connection */ | ||
private $wrappedConnection; | ||
|
||
public function __construct(Connection $wrappedConnection) | ||
{ | ||
$this->wrappedConnection = $wrappedConnection; | ||
} | ||
|
||
public function prepare(string $sql): Statement | ||
{ | ||
return $this->wrappedConnection->prepare($sql); | ||
} | ||
|
||
public function query(string $sql): Result | ||
{ | ||
return $this->wrappedConnection->query($sql); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function quote($value, $type = ParameterType::STRING) | ||
{ | ||
return $this->wrappedConnection->quote($value, $type); | ||
} | ||
|
||
public function exec(string $sql): int | ||
{ | ||
return $this->wrappedConnection->exec($sql); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function lastInsertId($name = null) | ||
{ | ||
if ($name !== null) { | ||
Deprecation::triggerIfCalledFromOutside( | ||
'doctrine/dbal', | ||
'https://github.com/doctrine/dbal/issues/4687', | ||
'The usage of Connection::lastInsertId() with a sequence name is deprecated.' | ||
); | ||
} | ||
|
||
return $this->wrappedConnection->lastInsertId($name); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function beginTransaction() | ||
{ | ||
return $this->wrappedConnection->beginTransaction(); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function commit() | ||
{ | ||
return $this->wrappedConnection->commit(); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function rollBack() | ||
{ | ||
return $this->wrappedConnection->rollBack(); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getServerVersion() | ||
{ | ||
if (! $this->wrappedConnection instanceof ServerInfoAwareConnection) { | ||
throw new LogicException('The underlying connection is not a ServerInfoAwareConnection'); | ||
} | ||
|
||
return $this->wrappedConnection->getServerVersion(); | ||
} | ||
|
||
/** | ||
* @return resource|object | ||
*/ | ||
public function getNativeConnection() | ||
{ | ||
if (! method_exists($this->wrappedConnection, 'getNativeConnection')) { | ||
throw new LogicException(sprintf( | ||
'The driver connection %s does not support accessing the native connection.', | ||
get_class($this->wrappedConnection) | ||
)); | ||
} | ||
|
||
return $this->wrappedConnection->getNativeConnection(); | ||
} | ||
} |
Oops, something went wrong.