|
| 1 | +<?php namespace Leven\DBA\Common; |
| 2 | + |
| 3 | +use Leven\DBA\Common\Exception\{ArgumentValidationException, Driver\DriverException, EmptyResultException}; |
| 4 | + |
| 5 | +interface DatabaseAdapterInterface { |
| 6 | + |
| 7 | + public function escapeValue(string $string); |
| 8 | + public function escapeName(string $string); |
| 9 | + |
| 10 | + /** |
| 11 | + * @throws DriverException |
| 12 | + */ |
| 13 | + public function schema(string $table): array; |
| 14 | + |
| 15 | + /** |
| 16 | + * @throws DriverException |
| 17 | + */ |
| 18 | + public function count(string $table): int; |
| 19 | + |
| 20 | + /** |
| 21 | + * @throws ArgumentValidationException |
| 22 | + * @throws DriverException |
| 23 | + * @throws EmptyResultException |
| 24 | + */ |
| 25 | + public function get(string $table, array|string $columns, array $conditions, array $options): DatabaseAdapterResponse; |
| 26 | + |
| 27 | + /** |
| 28 | + * @throws ArgumentValidationException |
| 29 | + * @throws DriverException |
| 30 | + */ |
| 31 | + public function insert(string $table, array $data): DatabaseAdapterResponse; |
| 32 | + |
| 33 | + /** |
| 34 | + * @throws ArgumentValidationException |
| 35 | + * @throws DriverException |
| 36 | + */ |
| 37 | + public function update(string $table, array $data, array $conditions, array $options): DatabaseAdapterResponse; |
| 38 | + |
| 39 | + /** |
| 40 | + * @throws ArgumentValidationException |
| 41 | + * @throws DriverException |
| 42 | + */ |
| 43 | + public function delete(string $table, array $conditions, array $options): DatabaseAdapterResponse; |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + /** |
| 48 | + * @throws DriverException |
| 49 | + */ |
| 50 | + public function txnBegin(); |
| 51 | + |
| 52 | + /** |
| 53 | + * @throws DriverException |
| 54 | + */ |
| 55 | + public function txnCommit(); |
| 56 | + |
| 57 | + /** |
| 58 | + * @throws DriverException |
| 59 | + */ |
| 60 | + public function txnRollback(); |
| 61 | + |
| 62 | +} |
0 commit comments