Postgres::createSequence PHP Method

createSequence() public method

Creates a new sequence
public createSequence ( $sequence, $increment, $minvalue, $maxvalue, $startvalue, $cachevalue, $cycledvalue )
$sequence Sequence name
$increment The increment
$minvalue The min value
$maxvalue The max value
$startvalue The starting value
$cachevalue The cache value
$cycledvalue True if cycled, false otherwise
    function createSequence($sequence, $increment, $minvalue, $maxvalue, $startvalue, $cachevalue, $cycledvalue)
    {
        $f_schema = $this->_schema;
        $this->fieldClean($f_schema);
        $this->fieldClean($sequence);
        $this->clean($increment);
        $this->clean($minvalue);
        $this->clean($maxvalue);
        $this->clean($startvalue);
        $this->clean($cachevalue);
        $sql = "CREATE SEQUENCE \"{$f_schema}\".\"{$sequence}\"";
        if ($increment != '') {
            $sql .= " INCREMENT {$increment}";
        }
        if ($minvalue != '') {
            $sql .= " MINVALUE {$minvalue}";
        }
        if ($maxvalue != '') {
            $sql .= " MAXVALUE {$maxvalue}";
        }
        if ($startvalue != '') {
            $sql .= " START {$startvalue}";
        }
        if ($cachevalue != '') {
            $sql .= " CACHE {$cachevalue}";
        }
        if ($cycledvalue) {
            $sql .= " CYCLE";
        }
        return $this->execute($sql);
    }
Postgres