Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | /** |
| 3 | * This file is part of the sshilko/php-sql-mydb package. |
| 4 | * |
| 5 | * (c) Sergei Shilko <contact@sshilko.com> |
| 6 | * |
| 7 | * MIT License |
| 8 | * |
| 9 | * For the full copyright and license information, please view the LICENSE |
| 10 | * file that was distributed with this source code. |
| 11 | * @license https://opensource.org/licenses/mit-license.php MIT |
| 12 | */ |
| 13 | |
| 14 | declare(strict_types = 1); |
| 15 | |
| 16 | namespace sql; |
| 17 | |
| 18 | /** |
| 19 | * @author Sergei Shilko <contact@sshilko.com> |
| 20 | * @license https://opensource.org/licenses/mit-license.php MIT |
| 21 | * @see https://github.com/sshilko/php-sql-mydb |
| 22 | */ |
| 23 | interface MydbQueryBuilderInterface |
| 24 | { |
| 25 | public const SQL_INSERT = 'INSERT'; |
| 26 | public const SQL_REPLACE = 'REPLACE'; |
| 27 | |
| 28 | public function showColumnsLike(string $table, string $column): string; |
| 29 | |
| 30 | public function showKeys(string $table): string; |
| 31 | |
| 32 | /** |
| 33 | * @param array<string, (float|int|\sql\MydbExpressionInterface|string|null)> $data |
| 34 | * @psalm-return string |
| 35 | */ |
| 36 | public function insertOne(array $data, string $table, string $type): string; |
| 37 | |
| 38 | /** |
| 39 | * @param array $columnSetWhere ['col1' => [ ['current1', 'new1'], ['current2', 'new2']] |
| 40 | * @param array $where ['col2' => 'value2', 'col3' => ['v3', 'v4']] |
| 41 | * @param string $table 'mytable' |
| 42 | */ |
| 43 | public function buildUpdateWhereMany(array $columnSetWhere, array $where, string $table): string; |
| 44 | |
| 45 | /** |
| 46 | * @throws \sql\MydbException\QueryBuilderException |
| 47 | * @param array<string, (float|int|string|\sql\MydbExpressionInterface|null)> $update |
| 48 | */ |
| 49 | public function buildUpdateWhere( |
| 50 | array $update, |
| 51 | array $whereFields, |
| 52 | string $table, |
| 53 | array $whereNotFields = [], |
| 54 | ): ?string; |
| 55 | |
| 56 | public function buildDeleteWhere(string $table, array $fields = [], array $negativeFields = []): ?string; |
| 57 | |
| 58 | /** |
| 59 | * @throws \sql\MydbException\QueryBuilderException |
| 60 | */ |
| 61 | public function buildWhere(array $fields, array $negativeFields = [], array $likeFields = []): string; |
| 62 | |
| 63 | /** |
| 64 | * @param array<string> $cols |
| 65 | */ |
| 66 | public function buildInsertMany(array $data, array $cols, string $table, bool $ignore, string $onDuplicate): string; |
| 67 | |
| 68 | /** |
| 69 | * @param float|int|string|\sql\MydbExpressionInterface|null $unescaped |
| 70 | * @throws \sql\MydbException\QueryBuilderException |
| 71 | */ |
| 72 | public function escape($unescaped, string $quote = "'"): string; |
| 73 | } |