- More work done on Update, Insert and Delete clause
- Added TOP property to select and delete to fit MSSQL limit's term. - Added a new interface allowing object's manipulation on save() and load() queries
This commit is contained in:
1 parent
3dc82b1f0d
commit
2f43fb4559
13 files changed
+169
-58
No files matched your search
@@ -10,12 +10,15 @@ class Delete extends Fragment {
|
||||
|
||||
public bool $ignore = false;
|
||||
|
||||
public ? int $top = null;
|
||||
|
||||
public string $priority;
|
||||
|
||||
public function render() : string
|
||||
{
|
||||
return $this->renderSegments([
|
||||
'DELETE',
|
||||
( $this->top ? sprintf('TOP (%s)', $this->top) : false ),
|
||||
( $this->priority ?? false ),
|
||||
( $this->quick ? 'QUICK' : false ),
|
||||
( $this->ignore ? 'IGNORE' : false ),
|
||||
|
||||
+5
-2
@@ -6,18 +6,21 @@ class Limit extends Fragment {
|
||||
|
||||
public int $order = 80;
|
||||
|
||||
protected int $limit = 0;
|
||||
public int $limit = 0;
|
||||
|
||||
public string $keyword = "LIMIT %d";
|
||||
|
||||
public function set($limit) : self
|
||||
{
|
||||
$this->limit = $limit;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function render() : string
|
||||
{
|
||||
return $this->renderSegments([
|
||||
'LIMIT', $this->limit,
|
||||
sprintf($this->keyword, $this->limit)
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -10,9 +10,9 @@ class Select extends Fragment {
|
||||
|
||||
public bool $union = false;
|
||||
|
||||
public bool $top = false;
|
||||
public ? int $top = null;
|
||||
|
||||
protected $fields = [];
|
||||
protected array $fields = [];
|
||||
|
||||
public function set($fields) : self
|
||||
{
|
||||
@@ -37,7 +37,7 @@ class Select extends Fragment {
|
||||
return $this->renderSegments([
|
||||
( $this->union ? 'UNION' : false ),
|
||||
'SELECT',
|
||||
( $this->top ? 'TOP' : false ),
|
||||
( $this->top ? sprintf('TOP (%s)', $this->top) : false ),
|
||||
implode(', ', $this->fields)
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user