Namespace and ClassPath rewrites
This commit is contained in:
21
Core/Driver/SQL/Condition/Compare.class.php
Normal file
21
Core/Driver/SQL/Condition/Compare.class.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Driver\SQL\Condition;
|
||||
|
||||
class Compare extends Condition {
|
||||
|
||||
private string $operator;
|
||||
private string $column;
|
||||
private $value;
|
||||
|
||||
public function __construct(string $col, $val, string $operator = '=') {
|
||||
$this->operator = $operator;
|
||||
$this->column = $col;
|
||||
$this->value = $val;
|
||||
}
|
||||
|
||||
public function getColumn(): string { return $this->column; }
|
||||
public function getValue() { return $this->value; }
|
||||
public function getOperator(): string { return $this->operator; }
|
||||
|
||||
}
|
||||
14
Core/Driver/SQL/Condition/CondAnd.class.php
Normal file
14
Core/Driver/SQL/Condition/CondAnd.class.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Driver\SQL\Condition;
|
||||
|
||||
class CondAnd extends Condition {
|
||||
|
||||
private array $conditions;
|
||||
|
||||
public function __construct(...$conditions) {
|
||||
$this->conditions = $conditions;
|
||||
}
|
||||
|
||||
public function getConditions(): array { return $this->conditions; }
|
||||
}
|
||||
15
Core/Driver/SQL/Condition/CondBool.class.php
Normal file
15
Core/Driver/SQL/Condition/CondBool.class.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Driver\SQL\Condition;
|
||||
|
||||
class CondBool extends Condition {
|
||||
|
||||
private $value;
|
||||
|
||||
public function __construct($val) {
|
||||
$this->value = $val;
|
||||
}
|
||||
|
||||
public function getValue() { return $this->value; }
|
||||
|
||||
}
|
||||
17
Core/Driver/SQL/Condition/CondIn.class.php
Normal file
17
Core/Driver/SQL/Condition/CondIn.class.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Driver\SQL\Condition;
|
||||
|
||||
class CondIn extends Condition {
|
||||
|
||||
private $needle;
|
||||
private $haystack;
|
||||
|
||||
public function __construct($needle, $haystack) {
|
||||
$this->needle = $needle;
|
||||
$this->haystack = $haystack;
|
||||
}
|
||||
|
||||
public function getNeedle() { return $this->needle; }
|
||||
public function getHaystack() { return $this->haystack; }
|
||||
}
|
||||
20
Core/Driver/SQL/Condition/CondKeyword.class.php
Normal file
20
Core/Driver/SQL/Condition/CondKeyword.class.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Driver\SQL\Condition;
|
||||
|
||||
abstract class CondKeyword extends Condition {
|
||||
|
||||
private $leftExpression;
|
||||
private $rightExpression;
|
||||
private string $keyword;
|
||||
|
||||
public function __construct(string $keyword, $leftExpression, $rightExpression) {
|
||||
$this->leftExpression = $leftExpression;
|
||||
$this->rightExpression = $rightExpression;
|
||||
$this->keyword = $keyword;
|
||||
}
|
||||
|
||||
public function getLeftExp() { return $this->leftExpression; }
|
||||
public function getRightExp() { return $this->rightExpression; }
|
||||
public function getKeyword(): string { return $this->keyword; }
|
||||
}
|
||||
10
Core/Driver/SQL/Condition/CondLike.class.php
Normal file
10
Core/Driver/SQL/Condition/CondLike.class.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Driver\SQL\Condition;
|
||||
|
||||
class CondLike extends CondKeyword {
|
||||
|
||||
public function __construct($leftExpression, $rightExpression) {
|
||||
parent::__construct("LIKE", $leftExpression, $rightExpression);
|
||||
}
|
||||
}
|
||||
16
Core/Driver/SQL/Condition/CondNot.class.php
Normal file
16
Core/Driver/SQL/Condition/CondNot.class.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Driver\SQL\Condition;
|
||||
|
||||
class CondNot extends Condition {
|
||||
|
||||
private $expression; // string or condition
|
||||
|
||||
public function __construct($expression) {
|
||||
$this->expression = $expression;
|
||||
}
|
||||
|
||||
public function getExpression() {
|
||||
return $this->expression;
|
||||
}
|
||||
}
|
||||
14
Core/Driver/SQL/Condition/CondNull.class.php
Normal file
14
Core/Driver/SQL/Condition/CondNull.class.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Driver\SQL\Condition;
|
||||
|
||||
class CondNull extends Condition {
|
||||
|
||||
private string $column;
|
||||
|
||||
public function __construct(string $col) {
|
||||
$this->column = $col;
|
||||
}
|
||||
|
||||
public function getColumn(): string { return $this->column; }
|
||||
}
|
||||
14
Core/Driver/SQL/Condition/CondOr.class.php
Normal file
14
Core/Driver/SQL/Condition/CondOr.class.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Driver\SQL\Condition;
|
||||
|
||||
class CondOr extends Condition {
|
||||
|
||||
private array $conditions;
|
||||
|
||||
public function __construct(...$conditions) {
|
||||
$this->conditions = (!empty($conditions) && is_array($conditions[0])) ? $conditions[0] : $conditions;
|
||||
}
|
||||
|
||||
public function getConditions(): array { return $this->conditions; }
|
||||
}
|
||||
11
Core/Driver/SQL/Condition/CondRegex.class.php
Normal file
11
Core/Driver/SQL/Condition/CondRegex.class.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Driver\SQL\Condition;
|
||||
|
||||
class CondRegex extends CondKeyword {
|
||||
|
||||
public function __construct($leftExpression, $rightExpression) {
|
||||
parent::__construct("REGEXP", $leftExpression, $rightExpression);
|
||||
}
|
||||
|
||||
}
|
||||
9
Core/Driver/SQL/Condition/Condition.class.php
Normal file
9
Core/Driver/SQL/Condition/Condition.class.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Driver\SQL\Condition;
|
||||
|
||||
use Core\Driver\SQL\Expression\Expression;
|
||||
|
||||
abstract class Condition extends Expression {
|
||||
|
||||
}
|
||||
22
Core/Driver/SQL/Condition/Exists.class.php
Normal file
22
Core/Driver/SQL/Condition/Exists.class.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Core\Driver\SQL\Condition;
|
||||
|
||||
|
||||
use Core\Driver\SQL\Query\Select;
|
||||
|
||||
class Exists extends Condition
|
||||
{
|
||||
private Select $subQuery;
|
||||
|
||||
public function __construct(Select $subQuery)
|
||||
{
|
||||
$this->subQuery = $subQuery;
|
||||
}
|
||||
|
||||
public function getSubQuery(): Select
|
||||
{
|
||||
return $this->subQuery;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user