|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Doctrine\DBAL; |
| 4 | + |
| 5 | +use Doctrine\DBAL\Cache\CacheException; |
| 6 | +use Doctrine\DBAL\Cache\QueryCacheProfile; |
| 7 | +use Doctrine\DBAL\Types\Type; |
| 8 | + |
| 9 | +class Connection |
| 10 | +{ |
| 11 | + /** |
| 12 | + * Executes an SQL statement with the given parameters and returns the number of affected rows. |
| 13 | + * |
| 14 | + * Could be used for: |
| 15 | + * - DML statements: INSERT, UPDATE, DELETE, etc. |
| 16 | + * - DDL statements: CREATE, DROP, ALTER, etc. |
| 17 | + * - DCL statements: GRANT, REVOKE, etc. |
| 18 | + * - Session control statements: ALTER SESSION, SET, DECLARE, etc. |
| 19 | + * - Other statements that don't yield a row set. |
| 20 | + * |
| 21 | + * This method supports PDO binding types as well as DBAL mapping types. |
| 22 | + * |
| 23 | + * @param literal-string $sql SQL statement |
| 24 | + * @param list<mixed>|array<string, mixed> $params Statement parameters |
| 25 | + * @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types Parameter types |
| 26 | + * |
| 27 | + * @return int|string The number of affected rows. |
| 28 | + * |
| 29 | + * @throws Exception |
| 30 | + */ |
| 31 | + public function executeStatement($sql, array $params = [], array $types = []); |
| 32 | + |
| 33 | + /** |
| 34 | + * Executes an, optionally parameterized, SQL query. |
| 35 | + * |
| 36 | + * If the query is parametrized, a prepared statement is used. |
| 37 | + * If an SQLLogger is configured, the execution is logged. |
| 38 | + * |
| 39 | + * @param literal-string $sql SQL query |
| 40 | + * @param list<mixed>|array<string, mixed> $params Query parameters |
| 41 | + * @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types Parameter types |
| 42 | + * |
| 43 | + * @throws Exception |
| 44 | + */ |
| 45 | + public function executeQuery( |
| 46 | + string $sql, |
| 47 | + array $params = [], |
| 48 | + $types = [], |
| 49 | + ?QueryCacheProfile $qcp = null |
| 50 | + ): Result; |
| 51 | + |
| 52 | + /** |
| 53 | + * Executes a caching query. |
| 54 | + * |
| 55 | + * @param literal-string $sql SQL query |
| 56 | + * @param list<mixed>|array<string, mixed> $params Query parameters |
| 57 | + * @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types Parameter types |
| 58 | + * |
| 59 | + * @throws CacheException |
| 60 | + * @throws Exception |
| 61 | + */ |
| 62 | + public function executeCacheQuery($sql, $params, $types, QueryCacheProfile $qcp): Result; |
| 63 | + |
| 64 | +} |
0 commit comments