summaryrefslogtreecommitdiff
path: root/vendor/doctrine/dbal/src/Driver/Connection.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/doctrine/dbal/src/Driver/Connection.php')
-rw-r--r--vendor/doctrine/dbal/src/Driver/Connection.php93
1 files changed, 93 insertions, 0 deletions
diff --git a/vendor/doctrine/dbal/src/Driver/Connection.php b/vendor/doctrine/dbal/src/Driver/Connection.php
new file mode 100644
index 0000000..68852e9
--- /dev/null
+++ b/vendor/doctrine/dbal/src/Driver/Connection.php
@@ -0,0 +1,93 @@
1<?php
2
3declare(strict_types=1);
4
5namespace Doctrine\DBAL\Driver;
6
7use Doctrine\DBAL\ServerVersionProvider;
8
9/**
10 * Connection interface.
11 * Driver connections must implement this interface.
12 */
13interface Connection extends ServerVersionProvider
14{
15 /**
16 * Prepares a statement for execution and returns a Statement object.
17 *
18 * @throws Exception
19 */
20 public function prepare(string $sql): Statement;
21
22 /**
23 * Executes an SQL statement, returning a result set as a Statement object.
24 *
25 * @throws Exception
26 */
27 public function query(string $sql): Result;
28
29 /**
30 * Quotes a string for use in a query.
31 *
32 * The usage of this method is discouraged. Use prepared statements
33 * or {@see AbstractPlatform::quoteStringLiteral()} instead.
34 */
35 public function quote(string $value): string;
36
37 /**
38 * Executes an SQL statement and return the number of affected rows.
39 * If the number of affected rows is greater than the maximum int value (PHP_INT_MAX),
40 * the number of affected rows may be returned as a string.
41 *
42 * @return int|numeric-string
43 *
44 * @throws Exception
45 */
46 public function exec(string $sql): int|string;
47
48 /**
49 * Returns the ID of the last inserted row.
50 *
51 * This method returns an integer or a string representing the value of the auto-increment column
52 * from the last row inserted into the database, if any, or throws an exception if a value cannot be returned,
53 * in particular when:
54 *
55 * - the driver does not support identity columns;
56 * - the last statement dit not return an identity (caution: see note below).
57 *
58 * Note: if the last statement was not an INSERT to an autoincrement column, this method MAY return an ID from a
59 * previous statement. DO NOT RELY ON THIS BEHAVIOR which is driver-dependent: always call this method right after
60 * executing an INSERT statement.
61 *
62 * @throws Exception
63 */
64 public function lastInsertId(): int|string;
65
66 /**
67 * Initiates a transaction.
68 *
69 * @throws Exception
70 */
71 public function beginTransaction(): void;
72
73 /**
74 * Commits a transaction.
75 *
76 * @throws Exception
77 */
78 public function commit(): void;
79
80 /**
81 * Rolls back the current transaction, as initiated by beginTransaction().
82 *
83 * @throws Exception
84 */
85 public function rollBack(): void;
86
87 /**
88 * Provides access to the native database connection.
89 *
90 * @return resource|object
91 */
92 public function getNativeConnection();
93}