Postgres::reindex PHP Method

reindex() public method

Rebuild indexes
public reindex ( $type, $name, $force = false )
$type 'DATABASE' or 'TABLE' or 'INDEX'
$name The name of the specific database, table, or index to be reindexed
$force If true, recreates indexes forcedly in PostgreSQL 7.0-7.1, forces rebuild of system indexes in 7.2-7.3, ignored in >=7.4
    function reindex($type, $name, $force = false)
    {
        $f_schema = $this->_schema;
        $this->fieldClean($f_schema);
        $this->fieldClean($name);
        switch ($type) {
            case 'DATABASE':
                $sql = "REINDEX {$type} \"{$name}\"";
                if ($force) {
                    $sql .= ' FORCE';
                }
                break;
            case 'TABLE':
            case 'INDEX':
                $sql = "REINDEX {$type} \"{$f_schema}\".\"{$name}\"";
                if ($force) {
                    $sql .= ' FORCE';
                }
                break;
            default:
                return -1;
        }
        return $this->execute($sql);
    }
Postgres