- First draft of current WIP

This commit is contained in:
mcndave committed 2019-08-21 16:13:00 -04:00
commit b73d046e0a
47 files changed
+2797

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
<?php
namespace Ulmus\Query;
class Select extends Fragment {
public int $order = -100;
public bool $distinct = false;
public bool $union = false;
public bool $top = false;
protected $fields = [];
public function set($fields) : self
{
$this->fields = is_array($fields) ? $fields : [ $fields ];
return $this;
}
public function add($fields) : self
{
if ( is_array($fields) ) {
$this->fields = array_merge($this->fields, $fields);
}
else {
$this->fields[] = $fields;
}
return $this;
}
public function render() : string
{
return $this->renderSegments([
( $this->union ? 'UNION' : false ),
'SELECT',
( $this->top ? 'TOP' : false ),
implode(', ', $this->fields)
]);
}
}