Posted to tcl by aspect at Wed Apr 08 22:00:32 GMT 2015view pretty

# I feel like a rubyist!
# this will work after http://core.tcl.tk/tcl/tktview/0f42ff78717
oo::class create tdbconn2 {
    method primarykeys {o table} {
        set res [next $o $table]
        set key [string range $o 1 end]
        set schema [my configure -database]
        lmap d $res {
            if {[dict get $d ${key}Schema] ne $schema} continue
            set d
        }
    }
    method foreignkeys {o table} {
        set res [next $o $table]
        set key [string range $o 1 end]
        set schema [my configure -database]
        lmap d $res {
            if {[dict get $d ${key}Schema] ne $schema} continue
            set d
        }
    }
}
oo::define tdbc::mysql::connection mixin tdbconn2