Postgres::addDomainCheckConstraint PHP Method

addDomainCheckConstraint() public method

Adds a check constraint to a domain
public addDomainCheckConstraint ( $domain, $definition, $name = '' )
$domain The domain to which to add the check
$definition The definition of the check
$name (optional) The name to give the check, otherwise default name is assigned
    function addDomainCheckConstraint($domain, $definition, $name = '')
    {
        $f_schema = $this->_schema;
        $this->fieldClean($f_schema);
        $this->fieldClean($domain);
        $this->fieldClean($name);
        $sql = "ALTER DOMAIN \"{$f_schema}\".\"{$domain}\" ADD ";
        if ($name != '') {
            $sql .= "CONSTRAINT \"{$name}\" ";
        }
        $sql .= "CHECK ({$definition})";
        return $this->execute($sql);
    }
Postgres