Add foreign table information to SQL INFO query
This commit is contained in:
parent
ec8ece9878
commit
f5a0739985
1 changed files with 11 additions and 0 deletions
11
db/info.go
11
db/info.go
|
@ -153,6 +153,11 @@ func (e *executor) executeInfoTB(ctx context.Context, ast *sql.InfoStatement) (o
|
|||
return nil, err
|
||||
}
|
||||
|
||||
ft, err := e.dbo.AllFT(ast.NS, ast.DB, ast.What.TB)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res := data.New()
|
||||
|
||||
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()
|
||||
}
|
||||
|
||||
table := make(map[string]interface{})
|
||||
for _, v := range ft {
|
||||
table[v.Name.ID] = v.String()
|
||||
}
|
||||
|
||||
res.Set(event, "event")
|
||||
res.Set(field, "field")
|
||||
res.Set(index, "index")
|
||||
res.Set(lives, "lives")
|
||||
res.Set(table, "table")
|
||||
|
||||
return []interface{}{res.Data()}, nil
|
||||
|
||||
|
|
Loading…
Reference in a new issue