diff options
Diffstat (limited to 'vendor/doctrine/dbal/src/Driver/Mysqli/Exception')
8 files changed, 226 insertions, 0 deletions
diff --git a/vendor/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionError.php b/vendor/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionError.php new file mode 100644 index 0000000..d2477fd --- /dev/null +++ b/vendor/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionError.php | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\DBAL\Driver\Mysqli\Exception; | ||
| 6 | |||
| 7 | use Doctrine\DBAL\Driver\AbstractException; | ||
| 8 | use mysqli; | ||
| 9 | use mysqli_sql_exception; | ||
| 10 | use ReflectionProperty; | ||
| 11 | |||
| 12 | /** | ||
| 13 | * @internal | ||
| 14 | * | ||
| 15 | * @psalm-immutable | ||
| 16 | */ | ||
| 17 | final class ConnectionError extends AbstractException | ||
| 18 | { | ||
| 19 | public static function new(mysqli $connection): self | ||
| 20 | { | ||
| 21 | return new self($connection->error, $connection->sqlstate, $connection->errno); | ||
| 22 | } | ||
| 23 | |||
| 24 | public static function upcast(mysqli_sql_exception $exception): self | ||
| 25 | { | ||
| 26 | $p = new ReflectionProperty(mysqli_sql_exception::class, 'sqlstate'); | ||
| 27 | |||
| 28 | return new self($exception->getMessage(), $p->getValue($exception), $exception->getCode(), $exception); | ||
| 29 | } | ||
| 30 | } | ||
diff --git a/vendor/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionFailed.php b/vendor/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionFailed.php new file mode 100644 index 0000000..cb3bc64 --- /dev/null +++ b/vendor/doctrine/dbal/src/Driver/Mysqli/Exception/ConnectionFailed.php | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\DBAL\Driver\Mysqli\Exception; | ||
| 6 | |||
| 7 | use Doctrine\DBAL\Driver\AbstractException; | ||
| 8 | use mysqli; | ||
| 9 | use mysqli_sql_exception; | ||
| 10 | use ReflectionProperty; | ||
| 11 | |||
| 12 | use function assert; | ||
| 13 | |||
| 14 | /** | ||
| 15 | * @internal | ||
| 16 | * | ||
| 17 | * @psalm-immutable | ||
| 18 | */ | ||
| 19 | final class ConnectionFailed extends AbstractException | ||
| 20 | { | ||
| 21 | public static function new(mysqli $connection): self | ||
| 22 | { | ||
| 23 | $error = $connection->connect_error; | ||
| 24 | assert($error !== null); | ||
| 25 | |||
| 26 | return new self($error, 'HY000', $connection->connect_errno); | ||
| 27 | } | ||
| 28 | |||
| 29 | public static function upcast(mysqli_sql_exception $exception): self | ||
| 30 | { | ||
| 31 | $p = new ReflectionProperty(mysqli_sql_exception::class, 'sqlstate'); | ||
| 32 | |||
| 33 | return new self($exception->getMessage(), $p->getValue($exception), $exception->getCode(), $exception); | ||
| 34 | } | ||
| 35 | } | ||
diff --git a/vendor/doctrine/dbal/src/Driver/Mysqli/Exception/FailedReadingStreamOffset.php b/vendor/doctrine/dbal/src/Driver/Mysqli/Exception/FailedReadingStreamOffset.php new file mode 100644 index 0000000..6f26dbe --- /dev/null +++ b/vendor/doctrine/dbal/src/Driver/Mysqli/Exception/FailedReadingStreamOffset.php | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\DBAL\Driver\Mysqli\Exception; | ||
| 6 | |||
| 7 | use Doctrine\DBAL\Driver\AbstractException; | ||
| 8 | |||
| 9 | use function sprintf; | ||
| 10 | |||
| 11 | /** | ||
| 12 | * @internal | ||
| 13 | * | ||
| 14 | * @psalm-immutable | ||
| 15 | */ | ||
| 16 | final class FailedReadingStreamOffset extends AbstractException | ||
| 17 | { | ||
| 18 | public static function new(int $parameter): self | ||
| 19 | { | ||
| 20 | return new self(sprintf('Failed reading the stream resource for parameter #%d.', $parameter)); | ||
| 21 | } | ||
| 22 | } | ||
diff --git a/vendor/doctrine/dbal/src/Driver/Mysqli/Exception/HostRequired.php b/vendor/doctrine/dbal/src/Driver/Mysqli/Exception/HostRequired.php new file mode 100644 index 0000000..d3359fc --- /dev/null +++ b/vendor/doctrine/dbal/src/Driver/Mysqli/Exception/HostRequired.php | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\DBAL\Driver\Mysqli\Exception; | ||
| 6 | |||
| 7 | use Doctrine\DBAL\Driver\AbstractException; | ||
| 8 | |||
| 9 | /** | ||
| 10 | * @internal | ||
| 11 | * | ||
| 12 | * @psalm-immutable | ||
| 13 | */ | ||
| 14 | final class HostRequired extends AbstractException | ||
| 15 | { | ||
| 16 | public static function forPersistentConnection(): self | ||
| 17 | { | ||
| 18 | return new self('The "host" parameter is required for a persistent connection'); | ||
| 19 | } | ||
| 20 | } | ||
diff --git a/vendor/doctrine/dbal/src/Driver/Mysqli/Exception/InvalidCharset.php b/vendor/doctrine/dbal/src/Driver/Mysqli/Exception/InvalidCharset.php new file mode 100644 index 0000000..778ea64 --- /dev/null +++ b/vendor/doctrine/dbal/src/Driver/Mysqli/Exception/InvalidCharset.php | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\DBAL\Driver\Mysqli\Exception; | ||
| 6 | |||
| 7 | use Doctrine\DBAL\Driver\AbstractException; | ||
| 8 | use mysqli; | ||
| 9 | use mysqli_sql_exception; | ||
| 10 | use ReflectionProperty; | ||
| 11 | |||
| 12 | use function sprintf; | ||
| 13 | |||
| 14 | /** | ||
| 15 | * @internal | ||
| 16 | * | ||
| 17 | * @psalm-immutable | ||
| 18 | */ | ||
| 19 | final class InvalidCharset extends AbstractException | ||
| 20 | { | ||
| 21 | public static function fromCharset(mysqli $connection, string $charset): self | ||
| 22 | { | ||
| 23 | return new self( | ||
| 24 | sprintf('Failed to set charset "%s": %s', $charset, $connection->error), | ||
| 25 | $connection->sqlstate, | ||
| 26 | $connection->errno, | ||
| 27 | ); | ||
| 28 | } | ||
| 29 | |||
| 30 | public static function upcast(mysqli_sql_exception $exception, string $charset): self | ||
| 31 | { | ||
| 32 | $p = new ReflectionProperty(mysqli_sql_exception::class, 'sqlstate'); | ||
| 33 | |||
| 34 | return new self( | ||
| 35 | sprintf('Failed to set charset "%s": %s', $charset, $exception->getMessage()), | ||
| 36 | $p->getValue($exception), | ||
| 37 | $exception->getCode(), | ||
| 38 | $exception, | ||
| 39 | ); | ||
| 40 | } | ||
| 41 | } | ||
diff --git a/vendor/doctrine/dbal/src/Driver/Mysqli/Exception/InvalidOption.php b/vendor/doctrine/dbal/src/Driver/Mysqli/Exception/InvalidOption.php new file mode 100644 index 0000000..654bb87 --- /dev/null +++ b/vendor/doctrine/dbal/src/Driver/Mysqli/Exception/InvalidOption.php | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\DBAL\Driver\Mysqli\Exception; | ||
| 6 | |||
| 7 | use Doctrine\DBAL\Driver\AbstractException; | ||
| 8 | |||
| 9 | use function sprintf; | ||
| 10 | |||
| 11 | /** | ||
| 12 | * @internal | ||
| 13 | * | ||
| 14 | * @psalm-immutable | ||
| 15 | */ | ||
| 16 | final class InvalidOption extends AbstractException | ||
| 17 | { | ||
| 18 | public static function fromOption(int $option, mixed $value): self | ||
| 19 | { | ||
| 20 | return new self( | ||
| 21 | sprintf('Failed to set option %d with value "%s"', $option, $value), | ||
| 22 | ); | ||
| 23 | } | ||
| 24 | } | ||
diff --git a/vendor/doctrine/dbal/src/Driver/Mysqli/Exception/NonStreamResourceUsedAsLargeObject.php b/vendor/doctrine/dbal/src/Driver/Mysqli/Exception/NonStreamResourceUsedAsLargeObject.php new file mode 100644 index 0000000..566d636 --- /dev/null +++ b/vendor/doctrine/dbal/src/Driver/Mysqli/Exception/NonStreamResourceUsedAsLargeObject.php | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\DBAL\Driver\Mysqli\Exception; | ||
| 6 | |||
| 7 | use Doctrine\DBAL\Driver\AbstractException; | ||
| 8 | |||
| 9 | use function sprintf; | ||
| 10 | |||
| 11 | /** | ||
| 12 | * @internal | ||
| 13 | * | ||
| 14 | * @psalm-immutable | ||
| 15 | */ | ||
| 16 | final class NonStreamResourceUsedAsLargeObject extends AbstractException | ||
| 17 | { | ||
| 18 | public static function new(int $parameter): self | ||
| 19 | { | ||
| 20 | return new self( | ||
| 21 | sprintf('The resource passed as a LARGE_OBJECT parameter #%d must be of type "stream"', $parameter), | ||
| 22 | ); | ||
| 23 | } | ||
| 24 | } | ||
diff --git a/vendor/doctrine/dbal/src/Driver/Mysqli/Exception/StatementError.php b/vendor/doctrine/dbal/src/Driver/Mysqli/Exception/StatementError.php new file mode 100644 index 0000000..991384c --- /dev/null +++ b/vendor/doctrine/dbal/src/Driver/Mysqli/Exception/StatementError.php | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\DBAL\Driver\Mysqli\Exception; | ||
| 6 | |||
| 7 | use Doctrine\DBAL\Driver\AbstractException; | ||
| 8 | use mysqli_sql_exception; | ||
| 9 | use mysqli_stmt; | ||
| 10 | use ReflectionProperty; | ||
| 11 | |||
| 12 | /** | ||
| 13 | * @internal | ||
| 14 | * | ||
| 15 | * @psalm-immutable | ||
| 16 | */ | ||
| 17 | final class StatementError extends AbstractException | ||
| 18 | { | ||
| 19 | public static function new(mysqli_stmt $statement): self | ||
| 20 | { | ||
| 21 | return new self($statement->error, $statement->sqlstate, $statement->errno); | ||
| 22 | } | ||
| 23 | |||
| 24 | public static function upcast(mysqli_sql_exception $exception): self | ||
| 25 | { | ||
| 26 | $p = new ReflectionProperty(mysqli_sql_exception::class, 'sqlstate'); | ||
| 27 | |||
| 28 | return new self($exception->getMessage(), $p->getValue($exception), $exception->getCode(), $exception); | ||
| 29 | } | ||
| 30 | } | ||
