Function: DB-OPEN

Documentation

creates and opens a new Database params: env = Environment the database shall be opened in txn = Transaction db = Database in File (optional) mode = file mode, use create-umask or 0 for default type = :db-btree :db-hash :db-recno or :db-queue flags... see BDB documentation or db.h

Source

(defun db-open (file &key
		env txn db (mode 0) (type :db-btree)
		;;flags
		auto-commit create exclusive no-mmap
		read-only threaded truncate
		;;db-set-flags flags:
		checksum encrypt dup dup-sort
		recnum revsplitoff inorder
		renumber snapshot)
  "creates and opens a new Database
   params: env = Environment the database shall be opened in
           txn = Transaction
           db = Database in File (optional)
           mode = file mode, use create-umask or 0 for default
           type = :db-btree :db-hash :db-recno or :db-queue
           flags... see BDB documentation or db.h"
  (let ((dbp (bdb-create (when env
			   (slot-value env 'db-env-handle)) 0)))
    (%db-set-flags dbp
		  :checksum checksum
		  :encrypt encrypt
		  :dup dup :dup-sort dup-sort
		  :recnum recnum :revsplitoff revsplitoff
		  :inorder inorder :renumber renumber
		  :snapshot snapshot)
    (%db-open dbp
	      (when (and txn (slot-value txn 'txn-handle))
		(slot-value txn 'txn-handle))
	      file db (flag-value type)
	      mode
	      :auto-commit auto-commit
	      :create create
	      :exclusive exclusive
	      :no-mmap no-mmap
	      :read-only read-only
	      :threaded threaded
	      :truncate truncate)
    (initialize-db-instance env dbp txn)))
Source Context