- Work done on Ulmus which were added within the Bottin de suppléance app
This commit is contained in:
1 parent
7fb591e1f5
commit
9ad2e94d12
9 files changed
+219
-127
No files matched your search
+11
-5
@@ -2,11 +2,13 @@
|
||||
|
||||
namespace Ulmus\Common;
|
||||
|
||||
use Ulmus\Query\WhereRawParameter;
|
||||
|
||||
abstract class Sql {
|
||||
|
||||
public static function function($name, ...$arguments)
|
||||
{
|
||||
return new class($name, ...$arguments) {
|
||||
return new class($name, ...$arguments) implements WhereRawParameter {
|
||||
|
||||
protected string $as = "";
|
||||
|
||||
@@ -20,19 +22,23 @@ abstract class Sql {
|
||||
$this->parseArguments();
|
||||
}
|
||||
|
||||
public function __toString() {
|
||||
public function __toString() : string
|
||||
{
|
||||
return implode(' ', array_filter([
|
||||
"{$this->name}(" . implode(", ", $this->arguments) . ")",
|
||||
$this->as ? "AS {$this->as}" : false,
|
||||
]));
|
||||
}
|
||||
|
||||
public function as($fieldName) {
|
||||
public function as($fieldName) : self
|
||||
{
|
||||
$this->as = $fieldName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function parseArguments() {
|
||||
protected function parseArguments() : void
|
||||
{
|
||||
foreach($this->arguments as &$item) {
|
||||
$item = Sql::escape($item);
|
||||
}
|
||||
@@ -42,7 +48,7 @@ abstract class Sql {
|
||||
|
||||
public static function identifier(string $identifier) : object
|
||||
{
|
||||
return new class($identifier) {
|
||||
return new class($identifier) implements WhereRawParameter {
|
||||
|
||||
protected string $identifier;
|
||||
|
||||
|
||||
Reference in new issue
Block a user