simplification du code

This commit is contained in:
Gregory Letellier
2023-10-27 15:20:52 +02:00
parent 9e760fe6e5
commit 5c09234cf5

View File

@@ -226,31 +226,16 @@ class QueryBuilder
private function getClause(string $word, array $data): string
{
$ret = "";
if (count($data) > 0) {
$ret = " $word ";
$iClause = 0;
foreach ($data as $clause) {
if ($iClause > 0) {
$ret .= ",";
if (!empty($data)) {
return " $word " . implode(",", $data);
}
$ret .= $clause;
$iClause++;
}
}
return $ret;
return "";
}
private function getLimit(): string
{
if ($this->take !== null || $this->offset !== null) {
$ret = "";
if ($this->take !== null) {
$ret = " LIMIT " . $this->take;
}
if ($this->offset !== null) {
$ret .= " OFFSET " . $this->offset;
}
$ret = ($this->take !== null ? " LIMIT " . $this->take : "") . ($this->offset !== null ? " OFFSET " . $this->offset : "");
return $ret;
} else {
return "";