Ruckusing_Adapter_PgSQL_Base::change_column_null PHP Method

change_column_null() private method

Change column null
private change_column_null ( string $table_name, string $column_name, string $null, string $default = null ) : boolean
$table_name string the table name
$column_name string the column name
$null string
$default string
return boolean
    private function change_column_null($table_name, $column_name, $null, $default = null)
    {
        if ($null === false || $default !== null) {
            $sql = sprintf("UPDATE %s SET %s=%s WHERE %s IS NULL", $this->quote_table_name($table_name), $this->quote_column_name($column_name), $this->quote($default), $this->quote_column_name($column_name));
            $this->query($sql);
        }
        $sql = sprintf("ALTER TABLE %s ALTER %s %s NOT NULL", $this->quote_table_name($table_name), $this->quote_column_name($column_name), $null ? 'DROP' : 'SET');
        $this->query($sql);
    }