Test: csvdump now scans all DBs.
This commit is contained in:
parent
a5a06a8ecd
commit
175707e550
@ -262,46 +262,50 @@ proc formatCommand {args} {
|
|||||||
|
|
||||||
proc csvdump r {
|
proc csvdump r {
|
||||||
set o {}
|
set o {}
|
||||||
foreach k [lsort [{*}$r keys *]] {
|
for {set db 0} {$db < 16} {incr db} {
|
||||||
set type [{*}$r type $k]
|
{*}$r select $db
|
||||||
append o [csvstring $k] , [csvstring $type] ,
|
foreach k [lsort [{*}$r keys *]] {
|
||||||
switch $type {
|
set type [{*}$r type $k]
|
||||||
string {
|
append o [csvstring $db] , [csvstring $k] , [csvstring $type] ,
|
||||||
append o [csvstring [{*}$r get $k]] "\n"
|
switch $type {
|
||||||
}
|
string {
|
||||||
list {
|
append o [csvstring [{*}$r get $k]] "\n"
|
||||||
foreach e [{*}$r lrange $k 0 -1] {
|
|
||||||
append o [csvstring $e] ,
|
|
||||||
}
|
}
|
||||||
append o "\n"
|
list {
|
||||||
}
|
foreach e [{*}$r lrange $k 0 -1] {
|
||||||
set {
|
append o [csvstring $e] ,
|
||||||
foreach e [lsort [{*}$r smembers $k]] {
|
}
|
||||||
append o [csvstring $e] ,
|
append o "\n"
|
||||||
}
|
}
|
||||||
append o "\n"
|
set {
|
||||||
}
|
foreach e [lsort [{*}$r smembers $k]] {
|
||||||
zset {
|
append o [csvstring $e] ,
|
||||||
foreach e [{*}$r zrange $k 0 -1 withscores] {
|
}
|
||||||
append o [csvstring $e] ,
|
append o "\n"
|
||||||
}
|
}
|
||||||
append o "\n"
|
zset {
|
||||||
}
|
foreach e [{*}$r zrange $k 0 -1 withscores] {
|
||||||
hash {
|
append o [csvstring $e] ,
|
||||||
set fields [{*}$r hgetall $k]
|
}
|
||||||
set newfields {}
|
append o "\n"
|
||||||
foreach {k v} $fields {
|
|
||||||
lappend newfields [list $k $v]
|
|
||||||
}
|
}
|
||||||
set fields [lsort -index 0 $newfields]
|
hash {
|
||||||
foreach kv $fields {
|
set fields [{*}$r hgetall $k]
|
||||||
append o [csvstring [lindex $kv 0]] ,
|
set newfields {}
|
||||||
append o [csvstring [lindex $kv 1]] ,
|
foreach {k v} $fields {
|
||||||
|
lappend newfields [list $k $v]
|
||||||
|
}
|
||||||
|
set fields [lsort -index 0 $newfields]
|
||||||
|
foreach kv $fields {
|
||||||
|
append o [csvstring [lindex $kv 0]] ,
|
||||||
|
append o [csvstring [lindex $kv 1]] ,
|
||||||
|
}
|
||||||
|
append o "\n"
|
||||||
}
|
}
|
||||||
append o "\n"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
{*}$r select 9
|
||||||
return $o
|
return $o
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user