summaryrefslogtreecommitdiff
path: root/classes/Db.php
diff options
context:
space:
mode:
authorwn_ <invalid@email.com>2025-05-17 19:08:12 +0000
committerwn_ <invalid@email.com>2025-05-17 19:08:15 +0000
commitc472f00445a91331e396511229f469de70302588 (patch)
tree612fbc72b3d3708984c6e9b5cfa11bc69bb76e7e /classes/Db.php
parent868c1cadad9a370d05f3ff72710bd488689bafdf (diff)
Get rid of 'Db::past_comparison_qpart()'.
With MySQL support dropped this function is just an unnecessary layer of abstraction.
Diffstat (limited to 'classes/Db.php')
-rw-r--r--classes/Db.php20
1 files changed, 0 insertions, 20 deletions
diff --git a/classes/Db.php b/classes/Db.php
index 872c6b351..0017fdf03 100644
--- a/classes/Db.php
+++ b/classes/Db.php
@@ -75,24 +75,4 @@ class Db {
public static function sql_random_function(): string {
return "RANDOM()";
}
-
- /**
- * Helper to build a query part comparing a field against a past datetime (determined by "$now - $some_interval")
- *
- * The example below could be read as "last_digest_sent is older than 1 day ago".
- * ```php
- * Db::past_comparison_qpart('last_digest_sent', '<', 1, 'day');
- * ```
- *
- * @todo validate value of $unit and fail if invalid (or massage if practical)?
- * @link https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-INTERVAL-INPUT
- * @param string $field the table field being checked
- * @param '<'|'>'|'<='|'>='|'=' $operator the comparison operator
- * @param positive-int $quantity the amount of $unit
- * @param 'year'|'month'|'week'|'day'|'hour'|'minute'|'second' $unit the unit of time for $quantity (see links for more info)
- * @return string the query part string
- */
- static function past_comparison_qpart(string $field, string $operator, int $quantity, string $unit): string {
- return "$field $operator NOW() - INTERVAL '$quantity $unit' ";
- }
}