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
|
|
|
|
2023-01-05 22:47:17 +01:00
|
|
|
use Core\Driver\SQL\SQL;
|
|
|
|
|
2020-06-26 14:58:17 +02:00
|
|
|
class CondNot extends Condition {
|
|
|
|
|
2023-01-05 22:47:17 +01:00
|
|
|
private mixed $expression; // string or condition
|
2020-06-26 14:58:17 +02:00
|
|
|
|
2023-01-05 22:47:17 +01:00
|
|
|
public function __construct(mixed $expression) {
|
2020-06-26 14:58:17 +02:00
|
|
|
$this->expression = $expression;
|
|
|
|
}
|
|
|
|
|
2023-01-05 22:47:17 +01:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|