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

18
src/QueryBuilder/QueryBuilders/GrantQueryBuilder.php

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

10
src/QueryBuilder/QueryBuilders/InsertQueryBuilder.php

@ -34,11 +34,11 @@ final class InsertQueryBuilder implements QueryBuilderInterface
$builder = "INSERT INTO $this->RelativePath";
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($this->Values != "") $builder .= "VALUES $this->Values";
if($this->Duplicate) $builder .= "DUPLICATE";
if($this->Replace) $builder .= "REPLACE";
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($this->Values != "") $builder .= "VALUES " . $this->Values;
if($this->Duplicate) $builder .= "DUPLICATE";
if($this->Replace) $builder .= "REPLACE";
return new InsertQuery($builder);
}

8
src/QueryBuilder/QueryBuilders/PutQueryBuilder.php

@ -25,13 +25,13 @@ final class PutQueryBuilder implements QueryBuilderInterface
public function Build(): PutQuery
{
$builder = "PUT $this->PutWhat";
if($this->PutData != "") $builder .= " \"$this->PutData\" ";
if($this->PutData != "") $builder .= " \"$this->PutData\" ";
if($this->PutAt != "") $builder .= "AT $this->PutAt";
elseif($this->PutInto != "") $builder .= "INTO $this->PutInto";
if($this->PutAt != "") $builder .= "AT " . $this->PutAt;
elseif($this->PutInto != "") $builder .= "INTO " . $this->PutInto;
else throw new QueryBuilderRequiredFieldIsNotSetException();
if($this->Safe) $builder .= " SAFE";
if($this->Safe) $builder .= " SAFE";
return new PutQuery($builder);
}

8
src/QueryBuilder/QueryBuilders/SelectQueryBuilder.php

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

Loading…
Cancel
Save