Skip to content

Commit ac7b5f8

Browse files
authored
Add FOR clause for query (#354)
1 parent d1b4a15 commit ac7b5f8

File tree

3 files changed

+57
-173
lines changed

3 files changed

+57
-173
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
- Enh #347: Remove `getCacheKey()` and `getCacheTag()` methods from `Schema` class (@Tigrov)
3737
- Enh #350, #351: Use `DbArrayHelper::arrange()` instead of `DbArrayHelper::index()` method (@Tigrov)
3838
- New #348: Realize `Schema::loadResultColumn()` method (@Tigrov)
39+
- New #354: Add `FOR` clause to query (@vjik)
3940

4041
## 1.2.0 March 21, 2024
4142

src/DQLQueryBuilder.php

+11
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Yiisoft\Db\Sqlite;
66

7+
use Yiisoft\Db\Exception\NotSupportedException;
78
use Yiisoft\Db\Expression\ExpressionInterface;
89
use Yiisoft\Db\Query\Query;
910
use Yiisoft\Db\Query\QueryInterface;
@@ -38,6 +39,7 @@ public function build(QueryInterface $query, array $params = []): array
3839
$this->buildWhere($query->getWhere(), $params),
3940
$this->buildGroupBy($query->getGroupBy()),
4041
$this->buildHaving($query->getHaving(), $params),
42+
$this->buildFor($query->getFor()),
4143
];
4244

4345
$orderBy = $query->getOrderBy();
@@ -77,6 +79,15 @@ public function build(QueryInterface $query, array $params = []): array
7779
return [$sql, $params];
7880
}
7981

82+
public function buildFor(array $values): string
83+
{
84+
if (empty($values)) {
85+
return '';
86+
}
87+
88+
throw new NotSupportedException('SQLite don\'t supports FOR clause.');
89+
}
90+
8091
public function buildLimit(ExpressionInterface|int|null $limit, ExpressionInterface|int|null $offset): string
8192
{
8293
$sql = '';

0 commit comments

Comments
 (0)