This commit is contained in:
2026-07-07 02:06:57 +08:00
parent bcd75c84ac
commit abec2ffbff
+6 -3
View File
@@ -108,7 +108,6 @@ class SqlBuilder extends Component
*/
private function __updateBuilder(array $string): string|bool
{
var_dump('UPDATE ' . $this->getFromAlias() . ' ' . 'SET' . ' ' . implode(', ', $string) . ' ' . $this->make(), $string);
if (empty($string)) {
return Kiri::getLogger()->logCategory('None data update.');
}
@@ -125,7 +124,7 @@ class SqlBuilder extends Component
*/
public function insert(array $attributes, bool $isBatch = false): string
{
$update = 'INSERT INTO ' . $this->getFromAlias();
$update = 'INSERT INTO ' . $this->getFromAlias(true);
if ($isBatch === false) {
$attributes = [$attributes];
}
@@ -457,9 +456,13 @@ class SqlBuilder extends Component
* QueryTrait 对象有 $from 和 $alias 属性
* @return string
*/
private function getFromAlias(): string
private function getFromAlias(bool $insert = false): string
{
$from = $this->query->from;
if ($insert) {
return '';
}
if ($this->query->alias !== '' && $this->query->alias !== '0') {
$from .= ' AS ' . $this->query->alias;
}