- Added the HAVING and TRUNCATE keyword
- Fixed GroupBy which was not implemented yet - Added a new SQL raw() function - From statement now accepts subqueries
This commit is contained in:
1 parent
538af38769
commit
139504f8dd
17 files changed
+566
-251
No files matched your search
@@ -4,6 +4,8 @@ namespace Ulmus\Query;
|
||||
|
||||
class Select extends Fragment {
|
||||
|
||||
const FIELD_AS = "%s as %s";
|
||||
|
||||
public int $order = -100;
|
||||
|
||||
public bool $distinct = false;
|
||||
@@ -36,6 +38,13 @@ class Select extends Fragment {
|
||||
|
||||
public function render() : string
|
||||
{
|
||||
foreach($this->fields as $key => &$value) {
|
||||
if ( ! is_numeric($key) ) {
|
||||
$value = sprintf(static::FIELD_AS, $value, $key);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this->renderSegments([
|
||||
( $this->union ? 'UNION' : false ),
|
||||
static::SQL_TOKEN,
|
||||
|
||||
Reference in new issue
Block a user