* [story#59810,1h] add sql format.

This commit is contained in:
qixinzhi
2024-09-04 16:10:43 +08:00
committed by 代婷婷
parent 4f5b50193b
commit 7ff357aff2
4 changed files with 4 additions and 4 deletions
@@ -235,6 +235,6 @@ class Condition extends Component
return implode(' ', $component);
}
return $component->expr;
return $component->expr . PHP_EOL;
}
}
@@ -488,6 +488,6 @@ class Expression extends Component
$ret .= ' AS ' . Context::escape($component->alias);
}
return $ret;
return $ret . PHP_EOL;
}
}
@@ -209,7 +209,7 @@ class JoinKeyword extends Component
{
$ret = [];
foreach ($component as $c) {
$ret[] = array_search($c->type, static::$JOINS) . ' ' . $c->expr
$ret[] = PHP_EOL . array_search($c->type, static::$JOINS) . ' ' . trim((string)$c->expr, PHP_EOL)
. (! empty($c->on)
? ' ON ' . Condition::build($c->on) : '')
. (! empty($c->using)
@@ -190,7 +190,7 @@ abstract class Statement implements Stringable
// Checking if the name of the clause should be added.
if ($type & 2) {
$query = trim($query) . ' ' . $name;
$query = trim($query) . ' ' . PHP_EOL . $name;
}
// Checking if the result of the builder should be added.