/[webpac]/trunk/openisis/tcl/addmsgkey.tcl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/openisis/tcl/addmsgkey.tcl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 237 - (hide annotations)
Mon Mar 8 17:43:12 2004 UTC (20 years, 1 month ago) by dpavlin
Original Path: openisis/current/tcl/addmsgkey.tcl
File MIME type: application/x-tcl
File size: 1315 byte(s)
initial import of openisis 0.9.0 vendor drop

1 dpavlin 237 #!./bin/isish
2     # adds a key -> msgID mapping to the key index
3     package require openIsis 0.8
4    
5     proc usage {} {
6     puts "usage: ./addmsgkey {msgid} {key}"
7     exit
8     }
9    
10     # check for args
11     if { 2 != $argc } usage
12     set key [lindex $argv 1 ]
13     set mfn [lindex $argv 0 ]
14     incr mfn 1
15    
16     set stb [ openIsis ]
17     $stb add \
18     syspath /opt/openisis/db
19    
20     set kdb "[ $stb get syspath ]/msg/key"
21    
22     $stb req type open db $kdb
23     openIsis::prnres "open result: " $stb
24     set db [$stb .res get db ]
25    
26    
27     $stb req type query key $key mode 1
28     set size [$stb .res get size]
29     if { $size } {
30     puts "removing all $key -> xxx mappings"
31    
32     set mfns [$stb .res get {rowid {}}]
33     puts "mfns: $mfns"
34     set i $size
35     while { $i } {
36     set m [lindex $mfns [expr $i-1]]
37     puts "removing mfn $m"
38     set idx [ $stb .req .idx ]
39     $idx add -1 "del"
40     $idx add -1 "mfn\t$m"
41     $idx add -1 "fields"
42     $idx add 42 $key
43    
44     $stb .req wrap -tag 926 $idx
45     $stb req type delete
46     incr i -1
47     }
48    
49     }
50    
51     puts "try to add $key -> $mfn"
52    
53     set idx [ $stb .req .idx ]
54     $idx add -1 "add"
55     $idx add -1 "mfn\t$mfn"
56     $idx add -1 "fields"
57     $idx add 42 $key
58    
59     $stb .req wrap -tag 926 $idx
60     $stb req type insert
61    
62     openIsis::prnres "result: " $stb
63    
64     puts "now try to get $key"
65    
66     $stb req type query key $key mode 1
67    
68     set size [$stb .res get size]
69     if { 1 == $size } {
70     puts "ok."
71     } else {
72     puts "err. please inspect $kdb.oxi"
73     }

Properties

Name Value
svn:executable

  ViewVC Help
Powered by ViewVC 1.1.26