web-base/Core/Driver/SQL/Condition/CondNot.class.php

22 lines
509 B
PHP
Raw Permalink Normal View History

2020-06-26 14:58:17 +02:00
<?php
2022-11-18 18:06:46 +01:00
namespace Core\Driver\SQL\Condition;
2020-06-26 14:58:17 +02:00
use Core\Driver\SQL\SQL;
2020-06-26 14:58:17 +02:00
class CondNot extends Condition {
private mixed $expression; // string or condition
2020-06-26 14:58:17 +02:00
public function __construct(mixed $expression) {
2020-06-26 14:58:17 +02:00
$this->expression = $expression;
}
public function getExpression(SQL $sql, array &$params): string {
if (is_string($this->expression)) {
return "NOT " . $sql->columnName($this->expression);
} else {
return "NOT " . $sql->addValue($this->expression, $params);
}
2020-06-26 14:58:17 +02:00
}
}