Add foreign table information to SQL INFO query

This commit is contained in:
Tobie Morgan Hitchcock 2018-04-28 22:08:34 +01:00
parent ec8ece9878
commit f5a0739985

View file

@ -153,6 +153,11 @@ func (e *executor) executeInfoTB(ctx context.Context, ast *sql.InfoStatement) (o
return nil, err return nil, err
} }
ft, err := e.dbo.AllFT(ast.NS, ast.DB, ast.What.TB)
if err != nil {
return nil, err
}
res := data.New() res := data.New()
event := make(map[string]interface{}) event := make(map[string]interface{})
@ -175,10 +180,16 @@ func (e *executor) executeInfoTB(ctx context.Context, ast *sql.InfoStatement) (o
lives[v.ID] = v.String() lives[v.ID] = v.String()
} }
table := make(map[string]interface{})
for _, v := range ft {
table[v.Name.ID] = v.String()
}
res.Set(event, "event") res.Set(event, "event")
res.Set(field, "field") res.Set(field, "field")
res.Set(index, "index") res.Set(index, "index")
res.Set(lives, "lives") res.Set(lives, "lives")
res.Set(table, "table")
return []interface{}{res.Data()}, nil return []interface{}{res.Data()}, nil