public function table($table = UNDEFINED, $alias = UNDEFINED)
    {
        if ($table === UNDEFINED) {
            return $this->main_table;
        }

        if (is_array($table)) {
            foreach ($table as $alias => $t) {
                if (is_numeric($alias)) {
                    $alias = UNDEFINED;
                }
                $this->table($t, $alias);
            }

            return $this;
        }

        // main_table tracking allows us to
        if ($this->main_table === null) {
            $this->main_table = $alias === UNDEFINED || !$alias ? $table : $alias;
        } elseif ($this->main_table) {
            $this->main_table = false;   // query from multiple tables
        }

        // if $table is DSQL, then alias is mandatory
        if ($table instanceof DB_dsql && ($alias === UNDEFINED || !$alias)) {
            throw $this->exception('If table is passed as DSQL, then table alias is mandatory!');
        }
        
        $this->args['table'][] = array($table, $alias);

        return $this;
    }