Postgres::saveAutovacuum PHP Method

saveAutovacuum() public method

Returns all available autovacuum per table information.
public saveAutovacuum ( $table, $vacenabled, $vacthreshold, $vacscalefactor, $anathresold, $anascalefactor, $vaccostdelay, $vaccostlimit ) : A
return A recordset
    function saveAutovacuum($table, $vacenabled, $vacthreshold, $vacscalefactor, $anathresold, $anascalefactor, $vaccostdelay, $vaccostlimit)
    {
        $f_schema = $this->_schema;
        $this->fieldClean($f_schema);
        $this->fieldClean($table);
        $sql = "ALTER TABLE \"{$f_schema}\".\"{$table}\" SET (";
        if (!empty($vacenabled)) {
            $this->clean($vacenabled);
            $params[] = "autovacuum_enabled='{$vacenabled}'";
        }
        if (!empty($vacthreshold)) {
            $this->clean($vacthreshold);
            $params[] = "autovacuum_vacuum_threshold='{$vacthreshold}'";
        }
        if (!empty($vacscalefactor)) {
            $this->clean($vacscalefactor);
            $params[] = "autovacuum_vacuum_scale_factor='{$vacscalefactor}'";
        }
        if (!empty($anathresold)) {
            $this->clean($anathresold);
            $params[] = "autovacuum_analyze_threshold='{$anathresold}'";
        }
        if (!empty($anascalefactor)) {
            $this->clean($anascalefactor);
            $params[] = "autovacuum_analyze_scale_factor='{$anascalefactor}'";
        }
        if (!empty($vaccostdelay)) {
            $this->clean($vaccostdelay);
            $params[] = "autovacuum_vacuum_cost_delay='{$vaccostdelay}'";
        }
        if (!empty($vaccostlimit)) {
            $this->clean($vaccostlimit);
            $params[] = "autovacuum_vacuum_cost_limit='{$vaccostlimit}'";
        }
        $sql = $sql . implode(',', $params) . ');';
        return $this->execute($sql);
    }
Postgres