index/src/Data/NullDb/NullDbResult.php

70 lines
1.4 KiB
PHP
Raw Permalink Normal View History

2022-09-13 13:13:11 +00:00
<?php
// NullDbResult.php
// Created: 2021-05-02
2024-02-06 21:39:36 +00:00
// Updated: 2024-02-06
2022-09-13 13:13:11 +00:00
namespace Index\Data\NullDb;
use Index\Data\IDbResult;
2024-02-06 21:39:36 +00:00
use Index\Data\DbResultIterator;
2022-09-13 13:13:11 +00:00
use Index\IO\Stream;
/**
* Represents a dummy database result.
*/
class NullDbResult implements IDbResult {
public function next(): bool {
return false;
}
public function isNull(int|string $index): bool {
return true;
}
public function getValue(int|string $index): mixed {
return null;
}
public function getString(int|string $index): string {
return '';
}
2023-11-09 13:52:12 +00:00
public function getStringOrNull(int|string $index): ?string {
return null;
}
2022-09-13 13:13:11 +00:00
public function getInteger(int|string $index): int {
return 0;
}
2023-11-09 13:52:12 +00:00
public function getIntegerOrNull(int|string $index): ?int {
return null;
}
2022-09-13 13:13:11 +00:00
public function getFloat(int|string $index): float {
return 0.0;
}
2023-11-09 13:52:12 +00:00
public function getFloatOrNull(int|string $index): ?float {
return null;
}
2023-11-09 14:04:39 +00:00
public function getBoolean(int|string $index): bool {
return false;
}
public function getBooleanOrNull(int|string $index): ?bool {
return null;
}
2022-09-13 13:13:11 +00:00
public function getStream(int|string $index): ?Stream {
return null;
}
2024-02-06 21:39:36 +00:00
public function getIterator(callable $construct): DbResultIterator {
return new DbResultIterator($this, $construct);
}
2022-09-13 13:13:11 +00:00
public function close(): void {}
}