Use nsv_xxx set of commands 

Am 12. März 2020 22:07:26 MEZ schrieb "D.Fox" <uns...@crystalforest.tf>:
>Hiya, 
>
>I've been messing about with a small database based off a page of the
>tcler's wiki. 
>https://blog.tcl.tk/1598 
>
>However I am running in to issues that an array variable are not being
>kept and are lost when the connection closes. 
>If I run the following proc via command line (tclsh) it works
>correctly. When I use naviserver, I lose the array each session 
>
>proc getFormValue {formName} { 
>set rawData [ns_getform] 
>set formData [ns_set get $ rawData $formName] 
>} ;#end procedure 
>
>proc storageUpdate {} { 
>#Get details from HTML form served via naviServer 
>set Owner [getFormValue Owner] ;# getFormValue = ns_getform 
>set Name [getFormValue Name] 
>set dbToken [getFormValue dbToken] 
>set dbRecord getFormValue dbRecord] 
>
>puts "$Owner :: $ Name :: $dbToken :: $dbRecord" 
>#Confirms this is collecting the results from the form 
>
>#Lets database 
>set db(lastid) 0 
>set id [incr db(lastid)] 
>set db($id,petOwner) "$petOwner" 
>set db($id,petName) "$petName" 
>set db($id,isa) pet 
>
>#Output variables available 
>puts "Vars available:: [info vars]" 
>puts "Output :: [db'get db $dbRecord petName]" 
>} ;#end procedure 
>
>How can I keep the variables within Navi after the connection has
>closed? 
>Would this be because each connection is spawned in to a interpreter? 
>I can save the entries to file but don't want to reload the database
>file each session. And i'd rather not use a third-party database
>software like MySQL, sqlite etc.. 
>
>Thanks, 
>Fox 



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

Reply via email to