redis: show results in query tab
This commit is contained in:
parent
8f105183eb
commit
cc336366c9
26
db_redis.go
26
db_redis.go
@ -180,8 +180,30 @@ func (ld *redisLoadedDatabase) ExecQuery(query string, resultArea *vcl.TListView
|
||||
return
|
||||
}
|
||||
|
||||
// Put ret into the data field somehow
|
||||
fmt.Printf("result\n%#v\n", ret)
|
||||
resultArea.SetEnabled(false)
|
||||
resultArea.Clear()
|
||||
|
||||
resultArea.Columns().Clear()
|
||||
colVal := resultArea.Columns().Add()
|
||||
colVal.SetCaption("Result")
|
||||
|
||||
// The result is probably a single value or a string slice
|
||||
switch ret := ret.(type) {
|
||||
case []string:
|
||||
// Multiple values
|
||||
for _, single := range ret {
|
||||
cell := resultArea.Items().Add()
|
||||
cell.SetCaption(single) // formatUtf8
|
||||
}
|
||||
|
||||
default:
|
||||
// Single value
|
||||
dataEntry := resultArea.Items().Add()
|
||||
dataEntry.SetCaption(formatAny(ret)) // formatUtf8
|
||||
|
||||
}
|
||||
|
||||
resultArea.SetEnabled(true)
|
||||
}
|
||||
|
||||
func (ld *redisLoadedDatabase) Close() {
|
||||
|
Loading…
Reference in New Issue
Block a user