~aleteoryx/tclircc

ref: 59555e2c6591b0f33ae0aa5e91c63a02f797e8e6 tclircc/src/db/networks.tcl -rw-r--r-- 375 bytes
59555e2cAleteoryx ui work, prepping for network add ui 11 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
namespace eval db::networks {}

proc db::networks::ls {db} {
  set ret {}
  $db eval {SELECT rowid as id, * FROM networks;} network {
    set ndict {}
    foreach k $network(*) {
      dict set ndict $k [set network($k)]
    }
    lappend ret $ndict
  }
  return $ret
}

proc db::networks::add {db name servers} {
  $db eval {INSERT INTO networks VALUES ($name $servers);}
}