public function addColumn($key,$args = null)
    {
        if ($key instanceof Column) {
            $args = $key->getColumnArray();
            $key = $key->name;
        }
        if (array_key_exists($key,$this->columns))
            trigger_error(sprintf(self::TEXT_ColumnExists,$key),E_USER_ERROR);
        $column = new Column($key, $this);
        if ($args)
            foreach ($args as $arg => $val)
                $column->{$arg} = $val;
        // skip default pkey field
        if (count($this->pkeys) == 1 && in_array($key,$this->pkeys))
            return $column;
        return $this->columns[$key] =& $column;
    }
public function addColumn($key,$args = null)
    {
        if ($key instanceof Column) {
            $args = $key->getColumnArray();
            $key = $key->name;
        }
        if (array_key_exists($key,$this->columns))
            trigger_error(sprintf(self::TEXT_ColumnExists,$key),E_USER_ERROR);
        $column = new Column($key, $this);
        if ($args)
            foreach ($args as $arg => $val)
                $column->{$arg} = $val;
        // skip default pkey field
        if (count($this->pkeys) == 1 && in_array($key,$this->pkeys))
            return $column;
        return $this->columns[$key] =& $column;
    }
public function addColumn ( $ key , $ args = null ) { if ( $ key instanceof Column ) { $ args = $ key -> getColumnArray ( ) ; $ key = $ key -> name ; } if ( array_key_exists ( $ key , $ this -> columns ) ) trigger_error ( sprintf ( self :: TEXT_ColumnExists , $ key ) , E_USER_ERROR ) ; $ column = new Column ( $ key , $ this ) ; if ( $ args ) foreach ( $ args as $ arg => $ val ) $ column -> { $ arg } = $ val ; // skip default pkey field if ( count ( $ this -> pkeys ) == 1 && in_array ( $ key , $ this -> pkeys ) ) return $ column ; return $ this -> columns [ $ key ] = & $ column ; }
add a new column to this table
@param string|Column $key column name or object
@param null|array $args optional config array
@return \DB\SQL\Column
add a new column to this table