Skip to content

Commit aa81689

Browse files
committed
Drop Oracle 11g support
1 parent 411c875 commit aa81689

File tree

1 file changed

+7
-48
lines changed

1 file changed

+7
-48
lines changed

src/Persistence/Sql/Oracle/Query.php

+7-48
Original file line numberDiff line numberDiff line change
@@ -102,65 +102,24 @@ public function groupConcat($field, string $delimiter = ',')
102102
return $this->expr('listagg({field}, []) within group (order by {field})', ['field' => $field, $delimiter]);
103103
}
104104

105-
// {{{ for Oracle 11 and lower to support LIMIT with OFFSET
106-
107-
protected $template_select = '[with]select[option] [field] [from] [table][join][where][group][having][order]';
108-
/** @var string */
109-
protected $template_select_limit = 'select * from (select "__t".*, rownum "__dsql_rownum" [from] ([with]select[option] [field] [from] [table][join][where][group][having][order]) "__t") where "__dsql_rownum" > [limit_start][and_limit_end]';
110-
111-
public function limit($cnt, $shift = null)
112-
{
113-
$this->template_select = $this->template_select_limit;
114-
115-
return parent::limit($cnt, $shift);
116-
}
117-
118105
public function _render_limit_start(): string
119106
{
120107
return (string) ($this->args['limit']['shift'] ?? 0);
121108
}
122109

123-
public function _render_and_limit_end(): ?string
110+
public function _render_limit(): ?string
124111
{
125-
if (!$this->args['limit']['cnt']) {
126-
return '';
112+
if (!isset($this->args['limit'])) {
113+
return null;
127114
}
128115

129-
return ' and "__dsql_rownum" <= '
130-
. max((int) ($this->args['limit']['cnt'] + $this->args['limit']['shift']), (int) $this->args['limit']['cnt']);
131-
}
132-
133-
public function getRowsIterator(): \Traversable
134-
{
135-
foreach (parent::getRowsIterator() as $row) {
136-
unset($row['__dsql_rownum']);
116+
$cnt = (int) $this->args['limit']['cnt'];
117+
$shift = (int) $this->args['limit']['shift'];
137118

138-
yield $row;
139-
}
119+
return ($shift ? ' offset ' . $shift . ' rows' : '')
120+
. ($cnt ? ' fetch next ' . $cnt . ' rows only' : '');
140121
}
141122

142-
public function getRows(): array
143-
{
144-
return array_map(function ($row) {
145-
unset($row['__dsql_rownum']);
146-
147-
return $row;
148-
}, parent::getRows());
149-
}
150-
151-
public function getRow(): ?array
152-
{
153-
$row = parent::getRow();
154-
155-
if ($row !== null) {
156-
unset($row['__dsql_rownum']);
157-
}
158-
159-
return $row;
160-
}
161-
162-
/// }}}
163-
164123
public function exists()
165124
{
166125
return $this->dsql()->mode('select')->field(

0 commit comments

Comments
 (0)