Cerys Lewis 5 months ago
parent
commit
b1055d3148
  1. 12
      src/QueryBuilder/QueryBuilders/GrantQueryBuilder.php
  2. 2
      src/QueryBuilder/QueryBuilders/InsertQueryBuilder.php
  3. 4
      src/QueryBuilder/QueryBuilders/PutQueryBuilder.php
  4. 6
      src/QueryBuilder/QueryBuilders/SelectQueryBuilder.php

12
src/QueryBuilder/QueryBuilders/GrantQueryBuilder.php

@ -27,6 +27,7 @@ final class GrantQueryBuilder implements QueryBuilderInterface
public function Build(): GrantQuery public function Build(): GrantQuery
{ {
$builder = "GRANT "; $builder = "GRANT ";
if(sizeof($this->PermissionTypes)) $builder .= implode(separator: ",", array: $this->PermissionTypes); if(sizeof($this->PermissionTypes)) $builder .= implode(separator: ",", array: $this->PermissionTypes);
if($this->GrantOn != "") $builder .= " ON $this->GrantOn"; if($this->GrantOn != "") $builder .= " ON $this->GrantOn";
if($this->GrantWhere != "") $builder .= " WHERE $this->GrantWhere"; if($this->GrantWhere != "") $builder .= " WHERE $this->GrantWhere";
@ -64,4 +65,15 @@ final class GrantQueryBuilder implements QueryBuilderInterface
$this->GrantWhere = "$target $operator->value $value"; $this->GrantWhere = "$target $operator->value $value";
return $this; return $this;
} }
public function IsDelegatable(): GrantQueryBuilder
{
$this->GrantDelegatable = true;
return $this;
}
public function NotDelegatable(): GrantQueryBuilder
{
$this->GrantDelegatable = false;
return $this;
}
} }

2
src/QueryBuilder/QueryBuilders/InsertQueryBuilder.php

@ -36,7 +36,7 @@ final class InsertQueryBuilder implements QueryBuilderInterface
if(sizeof($this->Keys) > 0) $builder .= "KEYS " . implode(separator: ", ", array: $this->Keys); if(sizeof($this->Keys) > 0) $builder .= "KEYS " . implode(separator: ", ", array: $this->Keys);
if(sizeof($this->Schemas) > 0) $builder .= "SCHEMAS " . implode(separator: ", ", array: $this->Schemas); if(sizeof($this->Schemas) > 0) $builder .= "SCHEMAS " . implode(separator: ", ", array: $this->Schemas);
if($this->Values != "") $builder .= "VALUES $this->Values"; if($this->Values != "") $builder .= "VALUES " . $this->Values;
if($this->Duplicate) $builder .= "DUPLICATE"; if($this->Duplicate) $builder .= "DUPLICATE";
if($this->Replace) $builder .= "REPLACE"; if($this->Replace) $builder .= "REPLACE";

4
src/QueryBuilder/QueryBuilders/PutQueryBuilder.php

@ -27,8 +27,8 @@ final class PutQueryBuilder implements QueryBuilderInterface
$builder = "PUT $this->PutWhat"; $builder = "PUT $this->PutWhat";
if($this->PutData != "") $builder .= " \"$this->PutData\" "; if($this->PutData != "") $builder .= " \"$this->PutData\" ";
if($this->PutAt != "") $builder .= "AT $this->PutAt"; if($this->PutAt != "") $builder .= "AT " . $this->PutAt;
elseif($this->PutInto != "") $builder .= "INTO $this->PutInto"; elseif($this->PutInto != "") $builder .= "INTO " . $this->PutInto;
else throw new QueryBuilderRequiredFieldIsNotSetException(); else throw new QueryBuilderRequiredFieldIsNotSetException();
if($this->Safe) $builder .= " SAFE"; if($this->Safe) $builder .= " SAFE";

6
src/QueryBuilder/QueryBuilders/SelectQueryBuilder.php

@ -35,9 +35,9 @@ final class SelectQueryBuilder implements QueryBuilderInterface
{ {
$builder = "SELECT "; $builder = "SELECT ";
if(sizeof($this->RelativePaths)) $builder .= " " . implode(separator: ", ", array: $this->RelativePaths); if(sizeof($this->RelativePaths)) $builder .= " " . implode(separator: ", ", array: $this->RelativePaths);
if($this->From != "") $builder .= " FROM $this->From"; if($this->From != "") $builder .= " FROM " . $this->From;
if($this->Where != "") $builder .= " WHERE $this->Where"; if($this->Where != "") $builder .= " WHERE " . $this->Where;
if($this->InstanceOf != "") $builder .= " INSTANCEOF $this->InstanceOf"; if($this->InstanceOf != "") $builder .= " INSTANCEOF " . $this->InstanceOf;
return new SelectQuery(queryString: $builder); return new SelectQuery(queryString: $builder);
} }

Loading…
Cancel
Save