Posted to tcl by hypnotoad at Fri Jun 07 01:59:47 GMT 2019view raw

  1. # Code Snippet
  2. while {[gets $fin line]>=0} {
  3. set record(uuid) {}
  4. set llist [csv::split $line]
  5. set idx -1
  6. foreach item $cols {
  7. set record($item) [lindex $llist [incr idx]]
  8. puts [list ${item} $record($item)]
  9. }
  10. puts [array get record]
  11. puts [list lookup uuid $record(uuid)]
  12. if {$record(value) eq {}} continue
  13. puts "INSERT"
  14. db eval {insert into main.lookup(uuid,class,subclass,designation,comment,english_display,local_display)
  15. VALUES
  16. (:record(uuid),:record(class),:record(subclass),:record(designation),:record(comment),:record(english_display),:record(local_display));
  17. }
  18. }
  19.  
  20. ###
  21. # Output
  22. ###
  23. basra:build-macos seandeelywoods$ ./wishkit ../data/dcii_isolation.sqlite
  24. uuid 22a17e6d-784b-4ba3-8aa8-451293077ba3
  25. class eqpt_system
  26. subclass {}
  27. designation 60Hz
  28. english Electrical
  29. local Electrical
  30. comment {}
  31. subclass {} ├┐uuid 22a17e6d-784b-4ba3-8aa8-451293077ba3 designation 60Hz english Electrical class eqpt_system uuid {} comment {} local Electrical
  32. lookup UUID {}
  33. can't read "record(value)": no such element in array