Sorry, I mis-explained, what I mean I wish to append to value 4 to index 2
nsv_dict append "MyDictonary" "Store" "Set" "Block" "Key" "Field" "2" "Value 4" 

Set {Block {Key {Field {1 {Value 1} 2 {Value 2 Value 4} 3 {Value 3}}}}} 

-----Original Message-----
From: Not <uns...@crystalforest.tf>
To: naviserver-devel <naviserver-devel@lists.sourceforge.net>
Date: Wednesday, 15 January 2025 7:46 PM GMT
Subject: [naviserver-devel] Appending to an multi-element dictonary


 
Good evening, 
  
This may be more a coding issue but I'm not sure if this is by design, limited 
or programmed to, or that if you shouldn't be able to. 
However I've started heavily using dictionaries within as a in-house data-store 
and taken it out of context of the standard dictionary key-value design.  
On count, I am currently creating an dictionary of seven elements. 
  
    nsv_dict set "MyDictonary" "Store" "Set" "Block" "Key" "Field" "1" "Value 
1" 
    nsv_dict set "MyDictonary" "Store" "Set" "Block" "Key" "Field" "2" "Value 
2" 
    nsv_dict set "MyDictonary" "Store" "Set" "Block" "Key" "Field" "3" "Value 
3" 
  nsv_dict get "MyDictonary" "Store" "Set" "Block" "Key" "Field" "2"
 
  
    Result: Value 2 
  
and full store: 
nsv_dict get "MyDictonary" "Store" 
    Set {Block {Key {Field {1 {Value 1} 2 {Value 2} 3 {Value 3}}}}} 
  
but if I was to append a forth value to this: 
   nsv_dict append "MyDictonary" "Store" "Set" "Block" "Key" "Field" "4" "Value 
4" 
  
this sets up the next result as: 
Set {Block {Key {Field {1 {Value 1} 2 {Value 2} 3 {Value 
3}}}}BlockKeyField4Value 4} 
  
And that then anything afterwards throws the following error: 

[15/Jan/2025:19:12:11][17646.3ae1efc15100][-conn:default:default:1:1-] Error: 
GET /dictTest.ix, PeerAddress: 10.2.1.77
:    dict element in braces followed by "BlockKeyField4Value" instead of space 
  
My workaround which is of obtaining the result and than appending the new data 
to that and then setting the appended string as the new value to the same 
dictionary but it feels klunky. 
I'm not sure how to combat this apart from above.  
  
Should appending suppose to work? 
  
 
P.S: however as just testing after writing this email, It appears to occur in 
TCL too. 
  % dict set MyDictonary store set block key field 1 "hello"
store {set {block {key {field {1 hello}}}}}
  % dict set MyDictonary store set block key field 2 "hello"
store {set {block {key {field {1 hello 2 hello}}}}}
  % dict append MyDictonary store set block key field 3 "hello"
store {set {block {key {field {1 hello 2 hello}}}}setblockkeyfield3hello}  
  
Many Thanks, 
David F 
 
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel


_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to