Skip to content

Instantly share code, notes, and snippets.

@tom-lpsd
Created April 14, 2009 13:19
Show Gist options
  • Save tom-lpsd/95178 to your computer and use it in GitHub Desktop.
Save tom-lpsd/95178 to your computer and use it in GitHub Desktop.
import Database.TokyoCabinet.BDB
import qualified Database.TokyoCabinet.BDB.Cursor as C
main = do bdb <- new
setcmpfunc bdb CMPDECIMAL
-- setcmpfunc bdb CMPLEXICAL -- lexical order(default)
-- setcmpfunc bdb CMPINT32
-- setcmpfunc bdb CMPINT64
open bdb "foo.tcb" [OWRITER, OCREAT]
put bdb "1" "200"
put bdb "02" "300"
put bdb "003" "300"
cur <- C.new bdb
C.first cur
Just key <- C.key cur
putStrLn key
close bdb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment