Namespace and ClassPath rewrites
This commit is contained in:
11
Core/Driver/SQL/Column/BigIntColumn.class.php
Normal file
11
Core/Driver/SQL/Column/BigIntColumn.class.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Driver\SQL\Column;
|
||||
|
||||
class BigIntColumn extends IntColumn {
|
||||
|
||||
public function __construct(string $name, bool $nullable, $defaultValue, bool $unsigned) {
|
||||
parent::__construct($name, $nullable, $defaultValue, $unsigned);
|
||||
$this->type = "BIGINT";
|
||||
}
|
||||
}
|
||||
11
Core/Driver/SQL/Column/BoolColumn.class.php
Normal file
11
Core/Driver/SQL/Column/BoolColumn.class.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Driver\SQL\Column;
|
||||
|
||||
class BoolColumn extends Column {
|
||||
|
||||
public function __construct(string $name, bool $defaultValue = false) {
|
||||
parent::__construct($name, false, $defaultValue);
|
||||
}
|
||||
|
||||
}
|
||||
23
Core/Driver/SQL/Column/Column.class.php
Normal file
23
Core/Driver/SQL/Column/Column.class.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Driver\SQL\Column;
|
||||
|
||||
use Core\Driver\SQL\Expression\Expression;
|
||||
|
||||
class Column extends Expression {
|
||||
|
||||
private string $name;
|
||||
private bool $nullable;
|
||||
private $defaultValue;
|
||||
|
||||
public function __construct(string $name, bool $nullable = false, $defaultValue = NULL) {
|
||||
$this->name = $name;
|
||||
$this->nullable = $nullable;
|
||||
$this->defaultValue = $defaultValue;
|
||||
}
|
||||
|
||||
public function getName(): string { return $this->name; }
|
||||
public function notNull(): bool { return !$this->nullable; }
|
||||
public function getDefaultValue() { return $this->defaultValue; }
|
||||
|
||||
}
|
||||
10
Core/Driver/SQL/Column/DateTimeColumn.class.php
Normal file
10
Core/Driver/SQL/Column/DateTimeColumn.class.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Driver\SQL\Column;
|
||||
|
||||
class DateTimeColumn extends Column {
|
||||
|
||||
public function __construct(string $name, bool $nullable = false, $defaultValue = NULL) {
|
||||
parent::__construct($name, $nullable, $defaultValue);
|
||||
}
|
||||
}
|
||||
10
Core/Driver/SQL/Column/DoubleColumn.class.php
Normal file
10
Core/Driver/SQL/Column/DoubleColumn.class.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Driver\SQL\Column;
|
||||
|
||||
class DoubleColumn extends NumericColumn {
|
||||
public function __construct(string $name, bool $nullable, $defaultValue = NULL, ?int $totalDigits = null, ?int $decimalDigits = null) {
|
||||
parent::__construct($name, $nullable, $defaultValue, $totalDigits, $decimalDigits);
|
||||
$this->type = "DOUBLE";
|
||||
}
|
||||
}
|
||||
19
Core/Driver/SQL/Column/EnumColumn.class.php
Normal file
19
Core/Driver/SQL/Column/EnumColumn.class.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Driver\SQL\Column;
|
||||
|
||||
class EnumColumn extends Column {
|
||||
|
||||
private array $values;
|
||||
|
||||
public function __construct(string $name, array $values, bool $nullable = false, $defaultValue = NULL) {
|
||||
parent::__construct($name, $nullable, $defaultValue);
|
||||
$this->values = $values;
|
||||
}
|
||||
|
||||
public function addValue(string $value) {
|
||||
$this->values[] = $value;
|
||||
}
|
||||
|
||||
public function getValues(): array { return $this->values; }
|
||||
}
|
||||
10
Core/Driver/SQL/Column/FloatColumn.class.php
Normal file
10
Core/Driver/SQL/Column/FloatColumn.class.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Driver\SQL\Column;
|
||||
|
||||
class FloatColumn extends NumericColumn {
|
||||
public function __construct(string $name, bool $nullable, $defaultValue = NULL, ?int $totalDigits = null, ?int $decimalDigits = null) {
|
||||
parent::__construct($name, $nullable, $defaultValue, $totalDigits, $decimalDigits);
|
||||
$this->type = "FLOAT";
|
||||
}
|
||||
}
|
||||
23
Core/Driver/SQL/Column/IntColumn.class.php
Normal file
23
Core/Driver/SQL/Column/IntColumn.class.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Driver\SQL\Column;
|
||||
|
||||
class IntColumn extends Column {
|
||||
|
||||
protected string $type;
|
||||
private bool $unsigned;
|
||||
|
||||
public function __construct(string $name, bool $nullable = false, $defaultValue = NULL, bool $unsigned = false) {
|
||||
parent::__construct($name, $nullable, $defaultValue);
|
||||
$this->type = "INTEGER";
|
||||
$this->unsigned = $unsigned;
|
||||
}
|
||||
|
||||
public function isUnsigned(): bool {
|
||||
return $this->unsigned;
|
||||
}
|
||||
|
||||
public function getType(): string {
|
||||
return $this->type;
|
||||
}
|
||||
}
|
||||
11
Core/Driver/SQL/Column/JsonColumn.class.php
Normal file
11
Core/Driver/SQL/Column/JsonColumn.class.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Driver\SQL\Column;
|
||||
|
||||
class JsonColumn extends Column {
|
||||
|
||||
public function __construct(string $name, bool $nullable = false, $defaultValue = null) {
|
||||
parent::__construct($name, $nullable, $defaultValue);
|
||||
}
|
||||
|
||||
}
|
||||
31
Core/Driver/SQL/Column/NumericColumn.class.php
Normal file
31
Core/Driver/SQL/Column/NumericColumn.class.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Driver\SQL\Column;
|
||||
|
||||
use Core\Driver\SQL\Column\Column;
|
||||
|
||||
class NumericColumn extends Column {
|
||||
|
||||
protected string $type;
|
||||
private ?int $totalDigits;
|
||||
private ?int $decimalDigits;
|
||||
|
||||
public function __construct(string $name, bool $nullable, $defaultValue = NULL, ?int $totalDigits = null, ?int $decimalDigits = null) {
|
||||
parent::__construct($name, $nullable, $defaultValue);
|
||||
$this->totalDigits = $totalDigits;
|
||||
$this->decimalDigits = $decimalDigits;
|
||||
$this->type = "NUMERIC";
|
||||
}
|
||||
|
||||
public function getDecimalDigits(): ?int {
|
||||
return $this->decimalDigits;
|
||||
}
|
||||
|
||||
public function getTotalDigits(): ?int {
|
||||
return $this->totalDigits;
|
||||
}
|
||||
|
||||
public function getTypeName(): string {
|
||||
return $this->type;
|
||||
}
|
||||
}
|
||||
11
Core/Driver/SQL/Column/SerialColumn.class.php
Normal file
11
Core/Driver/SQL/Column/SerialColumn.class.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Driver\SQL\Column;
|
||||
|
||||
class SerialColumn extends Column {
|
||||
|
||||
public function __construct(string $name, $defaultValue = NULL) {
|
||||
parent::__construct($name, false, $defaultValue); # not nullable
|
||||
}
|
||||
|
||||
}
|
||||
15
Core/Driver/SQL/Column/StringColumn.class.php
Normal file
15
Core/Driver/SQL/Column/StringColumn.class.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Driver\SQL\Column;
|
||||
|
||||
class StringColumn extends Column {
|
||||
|
||||
private ?int $maxSize;
|
||||
|
||||
public function __construct(string $name, ?int $maxSize = null, bool $nullable = false, $defaultValue = null) {
|
||||
parent::__construct($name, $nullable, $defaultValue);
|
||||
$this->maxSize = $maxSize;
|
||||
}
|
||||
|
||||
public function getMaxSize(): ?int { return $this->maxSize; }
|
||||
}
|
||||
Reference in New Issue
Block a user