Skip to content

Commit

Permalink
Fix types of ExtendedQueryBuilder
Browse files Browse the repository at this point in the history
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
  • Loading branch information
CarlSchwan committed Jun 20, 2022
1 parent a9b8a95 commit 46770f9
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions lib/Tools/Db/ExtendedQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
use OCA\FilesLock\Tools\Traits\TArrayTools;
use OCP\DB\QueryBuilder\ICompositeExpression;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\DB\QueryBuilder\IQueryFunction;
use OCP\IDBConnection;
use OCP\ILogger;
use Psr\Log\LoggerInterface;
Expand Down Expand Up @@ -271,7 +272,7 @@ public function exprFieldWithinJsonFormat(
$func->concat($fieldRight, $qb->createNamedParameter('"%'))
);

return $expr->iLike($alias . '.' . $field, $concat);
return (string)$expr->iLike($alias . '.' . $field, $concat);
}


Expand Down Expand Up @@ -303,7 +304,7 @@ public function exprValueWithinJsonFormat(
$comp = 'notLike';
}

return $expr->$comp($field, $qb->createNamedParameter('%"' . $value . '"%'));
return (string)$expr->$comp($field, $qb->createNamedParameter('%"' . $value . '"%'));
}


Expand Down Expand Up @@ -428,9 +429,9 @@ public function exprLike(string $field, string $value, string $alias = '', bool

$expr = $this->expr();
if ($cs) {
return $expr->like($field, $this->createNamedParameter($value));
return (string)$expr->like($field, $this->createNamedParameter($value));
} else {
return $expr->iLike($field, $this->createNamedParameter($value));
return (string)$expr->iLike($field, $this->createNamedParameter($value));
}
}

Expand All @@ -450,11 +451,11 @@ public function exprLimit(string $field, string $value, string $alias = '', bool

$expr = $this->expr();
if ($cs) {
return $expr->eq($field, $this->createNamedParameter($value));
return (string)$expr->eq($field, $this->createNamedParameter($value));
} else {
$func = $this->func();

return $expr->eq($func->lower($field), $func->lower($this->createNamedParameter($value)));
return (string)$expr->eq($func->lower($field), $func->lower($this->createNamedParameter($value)));
}
}

Expand All @@ -473,7 +474,7 @@ public function exprLimitInt(string $field, int $value, string $alias = ''): str

$expr = $this->expr();

return $expr->eq($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT));
return (string)$expr->eq($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT));
}


Expand Down Expand Up @@ -592,7 +593,7 @@ public function exprLimitInArray(string $field, array $values, string $alias = '

$expr = $this->expr();

return $expr->in($field, $this->createNamedParameter($values, IQueryBuilder::PARAM_STR_ARRAY));
return (string)$expr->in($field, $this->createNamedParameter($values, IQueryBuilder::PARAM_STR_ARRAY));
}


Expand All @@ -610,7 +611,7 @@ public function exprLimitBitwise(string $field, int $flag, string $alias = ''):

$expr = $this->expr();

return $expr->gt(
return (string)$expr->gt(
$expr->bitwiseAnd($field, $flag),
$this->createNamedParameter(0, IQueryBuilder::PARAM_INT)
);
Expand All @@ -633,9 +634,9 @@ public function exprLt(string $field, int $value, bool $lte = false, string $ali
$expr = $this->expr();

if ($lte) {
return $expr->lte($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT));
return (string)$expr->lte($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT));
} else {
return $expr->lt($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT));
return (string)$expr->lt($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT));
}
}

Expand All @@ -655,9 +656,9 @@ public function exprGt(string $field, int $value, bool $gte = false, string $ali
$expr = $this->expr();

if ($gte) {
return $expr->gte($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT));
return (string)$expr->gte($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT));
} else {
return $expr->gt($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT));
return (string)$expr->gt($field, $this->createNamedParameter($value, IQueryBuilder::PARAM_INT));
}
}

Expand Down Expand Up @@ -763,11 +764,11 @@ public function exprUnlike(string $field, string $value, string $alias = '', boo

$expr = $this->expr();
if ($cs) {
return $expr->notLike($field, $this->createNamedParameter($value));
return (string)$expr->notLike($field, $this->createNamedParameter($value));
} else {
$func = $this->func();

return $expr->notLike($func->lower($field), $func->lower($this->createNamedParameter($value)));
return (string)$expr->notLike($func->lower($field), $func->lower($this->createNamedParameter($value)));
}
}

Expand Down

0 comments on commit 46770f9

Please sign in to comment.