Skip to content

Commit 4e6cc94

Browse files
authored
Drop Oracle 11g support (#964)
1 parent 5a0eb69 commit 4e6cc94

File tree

4 files changed

+17
-65
lines changed

4 files changed

+17
-65
lines changed

.github/workflows/test-unit.yml

+6-8
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ jobs:
111111
ACCEPT_EULA: Y
112112
SA_PASSWORD: atk4_pass
113113
oracle:
114-
image: ghcr.io/mvorisek/docker-oracle-xe-11g
114+
image: gvenzl/oracle-xe:18
115115
env:
116-
ORACLE_ALLOW_REMOTE: true
116+
ORACLE_PASSWORD: atk4_pass
117117
steps:
118118
- name: Checkout
119119
uses: actions/checkout@v2
@@ -218,23 +218,21 @@ jobs:
218218
env:
219219
DB_DSN: "pdo_oci:dbname=oracle/xe"
220220
DB_USER: system
221-
DB_PASSWORD: oracle
221+
DB_PASSWORD: atk4_pass
222222
NLS_LANG: AMERICAN_AMERICA.AL32UTF8
223223
run: |
224-
php -d opcache.enable_cli=1 vendor/bin/phpunit --exclude-group none $(if [ -n "$LOG_COVERAGE" ]; then echo --coverage-text; else echo --no-coverage; fi) -v \
225-
|| php -d opcache.enable_cli=1 vendor/bin/phpunit --exclude-group none $(if [ -n "$LOG_COVERAGE" ]; then echo --coverage-text; else echo --no-coverage; fi) -v
224+
php -d opcache.enable_cli=1 vendor/bin/phpunit --exclude-group none $(if [ -n "$LOG_COVERAGE" ]; then echo --coverage-text; else echo --no-coverage; fi) -v
226225
if [ -n "$LOG_COVERAGE" ]; then mv coverage/phpunit.cov coverage/phpunit-oracle-pdo.cov; fi
227226
228227
- name: "Run tests: Oracle - OCI8 (only for coverage or cron)"
229228
if: env.LOG_COVERAGE || github.event_name == 'schedule'
230229
env:
231230
DB_DSN: "oci8:dbname=oracle/xe"
232231
DB_USER: system
233-
DB_PASSWORD: oracle
232+
DB_PASSWORD: atk4_pass
234233
NLS_LANG: AMERICAN_AMERICA.AL32UTF8
235234
run: |
236-
php -d opcache.enable_cli=1 vendor/bin/phpunit --exclude-group none $(if [ -n "$LOG_COVERAGE" ]; then echo --coverage-text; else echo --no-coverage; fi) -v \
237-
|| php -d opcache.enable_cli=1 vendor/bin/phpunit --exclude-group none $(if [ -n "$LOG_COVERAGE" ]; then echo --coverage-text; else echo --no-coverage; fi) -v
235+
php -d opcache.enable_cli=1 vendor/bin/phpunit --exclude-group none $(if [ -n "$LOG_COVERAGE" ]; then echo --coverage-text; else echo --no-coverage; fi) -v
238236
if [ -n "$LOG_COVERAGE" ]; then mv coverage/phpunit.cov coverage/phpunit-oracle-oci8.cov; fi
239237
240238
- name: Upload coverage logs 1/2 (only for latest Phpunit)

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"require-release": {
4343
"php": ">=7.4 <8.2",
4444
"atk4/core": "~3.2.0",
45-
"doctrine/dbal": "^3.š",
45+
"doctrine/dbal": "^3.3",
4646
"mvorisek/atk4-hintable": "~1.7.1"
4747
},
4848
"require-dev": {

src/Persistence/Sql/Connection.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ public function connection()
316316
public function execute(Expression $expr): DbalResult
317317
{
318318
if ($this->connection === null) {
319-
throw new Exception('Queries cannot be executed through this connection');
319+
throw new Exception('DBAL connection is not set');
320320
}
321321

322322
return $expr->execute($this->connection);

src/Persistence/Sql/Oracle/Query.php

+9-55
Original file line numberDiff line numberDiff line change
@@ -97,70 +97,24 @@ protected function _sub_render_condition(array $row): string
9797
return parent::_sub_render_condition($row);
9898
}
9999

100-
public function groupConcat($field, string $delimiter = ',')
101-
{
102-
return $this->expr('listagg({field}, []) within group (order by {field})', ['field' => $field, $delimiter]);
103-
}
104-
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-
118-
public function _render_limit_start(): string
119-
{
120-
return (string) ($this->args['limit']['shift'] ?? 0);
121-
}
122-
123-
public function _render_and_limit_end(): ?string
100+
public function _render_limit(): ?string
124101
{
125-
if (!$this->args['limit']['cnt']) {
126-
return '';
102+
if (!isset($this->args['limit'])) {
103+
return null;
127104
}
128105

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']);
137-
138-
yield $row;
139-
}
140-
}
141-
142-
public function getRows(): array
143-
{
144-
return array_map(function ($row) {
145-
unset($row['__dsql_rownum']);
106+
$cnt = (int) $this->args['limit']['cnt'];
107+
$shift = (int) $this->args['limit']['shift'];
146108

147-
return $row;
148-
}, parent::getRows());
109+
return ($shift ? ' offset ' . $shift . ' rows' : '')
110+
. ($cnt ? ' fetch next ' . $cnt . ' rows only' : '');
149111
}
150112

151-
public function getRow(): ?array
113+
public function groupConcat($field, string $delimiter = ',')
152114
{
153-
$row = parent::getRow();
154-
155-
if ($row !== null) {
156-
unset($row['__dsql_rownum']);
157-
}
158-
159-
return $row;
115+
return $this->expr('listagg({field}, []) within group (order by {field})', ['field' => $field, $delimiter]);
160116
}
161117

162-
/// }}}
163-
164118
public function exists()
165119
{
166120
return $this->dsql()->mode('select')->field(

0 commit comments

Comments
 (0)