~aleteoryx/tclircc

ref: d9dba48bb3776c131cd883aaac358a3c26d24381 tclircc/src/db/networks.tcl -rw-r--r-- 375 bytes
d9dba48bAleteoryx forms! 9 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);}
}