YaK:: Quick berkdb Tcl example (Db_tcl berkeleydb db4) [Changes]   [Calendar]   [Search]   [Index]   [PhotoTags]   
[mega_changes]
[photos]

Quick berkdb Tcl example (Db_tcl berkeleydb db4)

load /usr/lib/libdb_tcl.so
package require Db_tcl
# installed Ubuntu package: libdb4.8 libdb4.8-tcl

puts [lsort [info comm]]
puts [namespace children ::]
puts [berkdb version]

set d [berkdb open -btree -create -- /tmp/tmpdb]
puts d=$d

puts [$d stat]=stat

puts [$d count color]=#color
puts [$d count size]=#size

puts [catch {$d get color} what; set what]=color
puts [catch {$d get size} what; set what]=size

$d put color blue
$d put size L
$d put width 1024
$d put flavor choc

$d sync

set c [$d cursor]
puts first=[$c get -first]
puts nextdup=[$c get -nextdup]
puts next=[$c get -next]
puts nextdup=[$c get -nextdup]
puts next=[$c get -next]
puts next=[$c get -next]
puts next=[$c get -next]
puts next=[$c get -next]

puts last=[$c get -last]
puts nextdup=[$c get -nextdup]
puts prev=[$c get -prev]
puts nextdup=[$c get -nextdup]
puts prev=[$c get -prev]
puts prev=[$c get -prev]
puts prev=[$c get -prev]
puts prev=[$c get -prev]

$d close
(unless otherwise marked) Copyright 2002-2014 YakPeople. All rights reserved.
(last modified 2011-10-29)       [Login]
(No back references.)