Namespace and ClassPath rewrites

This commit is contained in:
2022-11-18 18:06:46 +01:00
parent c277aababc
commit 951ff14c5f
217 changed files with 1017 additions and 936 deletions

View File

@@ -0,0 +1,14 @@
<?php
namespace Core\Driver\SQL\Expression;
use Core\Driver\SQL\Condition\Compare;
# TODO: change confusing class inheritance here
class Add extends Compare {
public function __construct(string $col, $val) {
parent::__construct($col, $val, "+");
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace Core\Driver\SQL\Expression;
use Core\Driver\SQL\Condition\Condition;
class CaseWhen extends Expression {
private Condition $condition;
private $trueCase;
private $falseCase;
public function __construct(Condition $condition, $trueCase, $falseCase) {
$this->condition = $condition;
$this->trueCase = $trueCase;
$this->falseCase = $falseCase;
}
public function getCondition(): Condition { return $this->condition; }
public function getTrueCase() { return $this->trueCase; }
public function getFalseCase() { return $this->falseCase; }
}

View File

@@ -0,0 +1,7 @@
<?php
namespace Core\Driver\SQL\Expression;
class CurrentTimeStamp extends Expression {
}

View File

@@ -0,0 +1,23 @@
<?php
namespace Core\Driver\SQL\Expression;
use Core\Driver\SQL\SQL;
class DateAdd extends Expression {
private Expression $lhs;
private Expression $rhs;
private string $unit;
public function __construct(Expression $lhs, Expression $rhs, string $unit) {
$this->lhs = $lhs;
$this->rhs = $rhs;
$this->unit = $unit;
}
public function getLHS(): Expression { return $this->lhs; }
public function getRHS(): Expression { return $this->rhs; }
public function getUnit(): string { return $this->unit; }
}

View File

@@ -0,0 +1,23 @@
<?php
namespace Core\Driver\SQL\Expression;
use Core\Driver\SQL\SQL;
class DateSub extends Expression {
private Expression $lhs;
private Expression $rhs;
private string $unit;
public function __construct(Expression $lhs, Expression $rhs, string $unit) {
$this->lhs = $lhs;
$this->rhs = $rhs;
$this->unit = $unit;
}
public function getLHS(): Expression { return $this->lhs; }
public function getRHS(): Expression { return $this->rhs; }
public function getUnit(): string { return $this->unit; }
}

View File

@@ -0,0 +1,9 @@
<?php
namespace Core\Driver\SQL\Expression;
use Core\Driver\SQL\SQL;
abstract class Expression {
}

View File

@@ -0,0 +1,18 @@
<?php
namespace Core\Driver\SQL\Expression;
class JsonArrayAgg extends Expression {
private $value;
private string $alias;
public function __construct($value, string $alias) {
$this->value = $value;
$this->alias = $alias;
}
public function getValue() { return $this->value; }
public function getAlias(): string { return $this->alias; }
}

View File

@@ -0,0 +1,18 @@
<?php
namespace Core\Driver\SQL\Expression;
class Sum extends Expression {
private $value;
private string $alias;
public function __construct($value, string $alias) {
$this->value = $value;
$this->alias = $alias;
}
public function getValue() { return $this->value; }
public function getAlias(): string { return $this->alias; }
}