Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
tbkr committed Jun 11, 2024
2 parents 8cad039 + b004bd5 commit ab8ebf1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions pyfdb/processed_fdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ struct fdb_request_t;
typedef struct fdb_request_t fdb_request_t;
int fdb_new_request(fdb_request_t** req);
int fdb_request_add(fdb_request_t* req, const char* param, const char* values[], int numValues);
int fdb_expand_request(fdb_request_t* req);
int fdb_delete_request(fdb_request_t* req);

struct fdb_split_key_t;
Expand Down
20 changes: 14 additions & 6 deletions pyfdb/pyfdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

__version__ = "0.0.4"

__fdb_version__ = "5.6.0"
__fdb_version__ = "5.11.0"

ffi = cffi.FFI()

Expand Down Expand Up @@ -156,6 +156,9 @@ def value(self, name, values):
len(values),
)

def expand(self):
lib.fdb_expand_request(self.__request)

@property
def ctype(self):
return self.__request
Expand All @@ -165,10 +168,13 @@ class ListIterator:
__iterator = None
__key = False

def __init__(self, fdb, request, duplicates, key=False):
def __init__(self, fdb, request, duplicates, key=False, expand=True):
iterator = ffi.new("fdb_listiterator_t**")
if request:
lib.fdb_list(fdb.ctype, Request(request).ctype, iterator, duplicates)
req = Request(request)
if expand:
req.expand()
lib.fdb_list(fdb.ctype, req.ctype, iterator, duplicates)
else:
lib.fdb_list(fdb.ctype, ffi.NULL, iterator, duplicates)

Expand Down Expand Up @@ -212,12 +218,14 @@ class DataRetriever:
__dataread = None
__opened = False

def __init__(self, fdb, request):
def __init__(self, fdb, request, expand=True):
dataread = ffi.new("fdb_datareader_t **")
lib.fdb_new_datareader(dataread)
self.__dataread = ffi.gc(dataread[0], lib.fdb_delete_datareader)

lib.fdb_retrieve(fdb.ctype, Request(request).ctype, self.__dataread)
req = Request(request)
if expand:
req.expand()
lib.fdb_retrieve(fdb.ctype, req.ctype, self.__dataread)

mode = "rb"

Expand Down

0 comments on commit ab8ebf1

Please sign in to comment.