simplification du code
This commit is contained in:
@@ -226,31 +226,16 @@ class QueryBuilder
|
|||||||
|
|
||||||
private function getClause(string $word, array $data): string
|
private function getClause(string $word, array $data): string
|
||||||
{
|
{
|
||||||
$ret = "";
|
if (!empty($data)) {
|
||||||
if (count($data) > 0) {
|
return " $word " . implode(",", $data);
|
||||||
$ret = " $word ";
|
|
||||||
$iClause = 0;
|
|
||||||
foreach ($data as $clause) {
|
|
||||||
if ($iClause > 0) {
|
|
||||||
$ret .= ",";
|
|
||||||
}
|
}
|
||||||
$ret .= $clause;
|
return "";
|
||||||
$iClause++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getLimit(): string
|
private function getLimit(): string
|
||||||
{
|
{
|
||||||
if ($this->take !== null || $this->offset !== null) {
|
if ($this->take !== null || $this->offset !== null) {
|
||||||
$ret = "";
|
$ret = ($this->take !== null ? " LIMIT " . $this->take : "") . ($this->offset !== null ? " OFFSET " . $this->offset : "");
|
||||||
if ($this->take !== null) {
|
|
||||||
$ret = " LIMIT " . $this->take;
|
|
||||||
}
|
|
||||||
if ($this->offset !== null) {
|
|
||||||
$ret .= " OFFSET " . $this->offset;
|
|
||||||
}
|
|
||||||
return $ret;
|
return $ret;
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
Reference in New Issue
Block a user