summaryrefslogtreecommitdiff
path: root/vendor/doctrine/dbal/src/Driver/Mysqli/Connection.php
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2026-10-18 00:08:23 +0200
committerpolo <ordipolo@gmx.fr>2026-10-18 00:10:03 +0200
commit05e38eadbeb3de19e5b26003c2b401e00bb71df4 (patch)
treecf48350b69cfce92de6f3a0e03eb0876931c7077 /vendor/doctrine/dbal/src/Driver/Mysqli/Connection.php
parent32843e50aa981f190bdb4fbc9adbeacc06fdf775 (diff)
downloadAppliGestionPHP-05e38eadbeb3de19e5b26003c2b401e00bb71df4.tar.gz
AppliGestionPHP-05e38eadbeb3de19e5b26003c2b401e00bb71df4.tar.bz2
AppliGestionPHP-05e38eadbeb3de19e5b26003c2b401e00bb71df4.zip
sortie de vendor du dépôt, oubli dans config-template.ini
Diffstat (limited to 'vendor/doctrine/dbal/src/Driver/Mysqli/Connection.php')
-rw-r--r--vendor/doctrine/dbal/src/Driver/Mysqli/Connection.php112
1 files changed, 0 insertions, 112 deletions
diff --git a/vendor/doctrine/dbal/src/Driver/Mysqli/Connection.php b/vendor/doctrine/dbal/src/Driver/Mysqli/Connection.php
deleted file mode 100644
index cc00fb6..0000000
--- a/vendor/doctrine/dbal/src/Driver/Mysqli/Connection.php
+++ /dev/null
@@ -1,112 +0,0 @@
1<?php
2
3declare(strict_types=1);
4
5namespace Doctrine\DBAL\Driver\Mysqli;
6
7use Doctrine\DBAL\Driver\Connection as ConnectionInterface;
8use Doctrine\DBAL\Driver\Exception;
9use Doctrine\DBAL\Driver\Mysqli\Exception\ConnectionError;
10use mysqli;
11use mysqli_sql_exception;
12
13final class Connection implements ConnectionInterface
14{
15 /**
16 * Name of the option to set connection flags
17 */
18 public const OPTION_FLAGS = 'flags';
19
20 /** @internal The connection can be only instantiated by its driver. */
21 public function __construct(private readonly mysqli $connection)
22 {
23 }
24
25 public function getServerVersion(): string
26 {
27 return $this->connection->get_server_info();
28 }
29
30 public function prepare(string $sql): Statement
31 {
32 try {
33 $stmt = $this->connection->prepare($sql);
34 } catch (mysqli_sql_exception $e) {
35 throw ConnectionError::upcast($e);
36 }
37
38 if ($stmt === false) {
39 throw ConnectionError::new($this->connection);
40 }
41
42 return new Statement($stmt);
43 }
44
45 public function query(string $sql): Result
46 {
47 return $this->prepare($sql)->execute();
48 }
49
50 public function quote(string $value): string
51 {
52 return "'" . $this->connection->escape_string($value) . "'";
53 }
54
55 public function exec(string $sql): int|string
56 {
57 try {
58 $result = $this->connection->query($sql);
59 } catch (mysqli_sql_exception $e) {
60 throw ConnectionError::upcast($e);
61 }
62
63 if ($result === false) {
64 throw ConnectionError::new($this->connection);
65 }
66
67 return $this->connection->affected_rows;
68 }
69
70 public function lastInsertId(): int|string
71 {
72 $lastInsertId = $this->connection->insert_id;
73
74 if ($lastInsertId === 0) {
75 throw Exception\NoIdentityValue::new();
76 }
77
78 return $this->connection->insert_id;
79 }
80
81 public function beginTransaction(): void
82 {
83 $this->connection->begin_transaction();
84 }
85
86 public function commit(): void
87 {
88 try {
89 if (! $this->connection->commit()) {
90 throw ConnectionError::new($this->connection);
91 }
92 } catch (mysqli_sql_exception $e) {
93 throw ConnectionError::upcast($e);
94 }
95 }
96
97 public function rollBack(): void
98 {
99 try {
100 if (! $this->connection->rollback()) {
101 throw ConnectionError::new($this->connection);
102 }
103 } catch (mysqli_sql_exception $e) {
104 throw ConnectionError::upcast($e);
105 }
106 }
107
108 public function getNativeConnection(): mysqli
109 {
110 return $this->connection;
111 }
112}