~ehmry/nim-tkrzw

efd87edb7b063182c1a1fa018006a87b515d589b — Emery Hemingway 2 years ago a78e1ce 20220922
Do check if the database was actually opened
1 files changed, 2 insertions(+), 2 deletions(-)

M src/tkrzw.nim
M src/tkrzw.nim => src/tkrzw.nim +2 -2
@@ 90,7 90,7 @@ proc GetValue(iter: Iterator): CppString {.importcpp: "#->GetValue()".}

template importDBM(T: untyped): untyped =
  proc `=destroy`(obj: var `T Obj`) {.importcpp: "#.~" & $T & "()".}
  proc Open(dbm: T; path: cstring; writeable: bool; options: int32) {.
  proc Open(dbm: T; path: cstring; writeable: bool; options: int32): Status {.
      importcpp: "#->Open(@)".}
  proc Close(dbm: T) {.importcpp: "#->Close()".}
  proc Get(dbm: T; key: StringView; value: ptr CppString): Status {.


@@ 126,7 126,7 @@ proc newDbm*[T: DBM](path: string; rw: RW; options: set[OpenOption] = {}): T =
  var opts: int32
  for o in options.items: opts.inc o.int32
  result = construct[T]()
  result.Open(path, rw == writeable, opts)
  check result.Open(path, rw == writeable, opts)

proc newDbm*[T: MemoryDBM](): T =
  construct[T]()