diff --git a/src/Query/MsSQL/Offset.php b/src/Query/MsSQL/Offset.php index dfb5770..3f9432c 100644 --- a/src/Query/MsSQL/Offset.php +++ b/src/Query/MsSQL/Offset.php @@ -8,7 +8,7 @@ class Offset extends \Ulmus\Query\Fragment { public int $order = 95; - public int $offset; + public int $offset = 0; public int $limit; diff --git a/src/Repository.php b/src/Repository.php index 11433fa..f1a619e 100644 --- a/src/Repository.php +++ b/src/Repository.php @@ -399,7 +399,7 @@ class Repository public function update(string $table, string $alias, ? string $schema) : self { - $this->queryBuilder->update($this->escapeTable($table), $this->escapeIdentifier($alias), $this->escapedDatabase(), $schema); + $this->queryBuilder->update($this->escapeTable($table), $alias ? $this->escapeIdentifier($alias) : null, $this->escapedDatabase(), $schema); return $this; } @@ -423,13 +423,14 @@ class Repository public function from(string $table, ? string $alias, ? string $schema) : self { - $this->queryBuilder->from($this->escapeTable($table), $this->escapeIdentifier($alias), $this->escapedDatabase(), $schema ? $this->escapeSchema($schema) : null); + $this->queryBuilder->from($this->escapeTable($table), $alias ? $this->escapeIdentifier($alias) : null, $this->escapedDatabase(), $schema ? $this->escapeSchema($schema) : null); + return $this; } public function join(string $type, $table, $field, $value, ? string $alias = null, ? callable $callback = null) : self { - $join = $this->queryBuilder->withJoin($type, $this->escapeTable($table), $field, $value, false, $this->escapeIdentifier($alias)); + $join = $this->queryBuilder->withJoin($type, $this->escapeTable($table), $field, $value, false, $alias ? $this->escapeIdentifier($alias) : null); if ( $callback ) { $callback($join); @@ -440,7 +441,7 @@ class Repository public function outerJoin(string $type, $table, $field, $value, ? string $alias = null, ? callable $callback = null) : self { - $join = $this->queryBuilder->withJoin($type, $this->escapeTable($table), $field, $value, true, $this->escapeIdentifier($alias)); + $join = $this->queryBuilder->withJoin($type, $this->escapeTable($table), $field, $value, true, $alias ? $this->escapeIdentifier($alias) : null); if ( $callback ) { $callback($join);