diff options
author | Susan LoVerso <sue@wiredtiger.com> | 2014-03-27 16:19:17 -0400 |
---|---|---|
committer | Susan LoVerso <sue@wiredtiger.com> | 2014-03-27 16:19:17 -0400 |
commit | 3c802c3ac55348deb60143e2e0d32c70270a241c (patch) | |
tree | 875e48d2d1fff256788ea6ae277f148be7ba19da /lang | |
parent | 0c319ecb91282600bccd47b2f042e747cc340398 (diff) | |
download | mongo-3c802c3ac55348deb60143e2e0d32c70270a241c.tar.gz |
Add some python support
Diffstat (limited to 'lang')
-rw-r--r-- | lang/python/wiredtiger.i | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lang/python/wiredtiger.i b/lang/python/wiredtiger.i index e5f49fe2c63..ebd29116285 100644 --- a/lang/python/wiredtiger.i +++ b/lang/python/wiredtiger.i @@ -52,6 +52,9 @@ from packing import pack, unpack %typemap(in, numinputs=0) WT_SESSION ** (WT_SESSION *temp = NULL) { $1 = &temp; } +%typemap(in, numinputs=0) WT_ASYNC_OP ** (WT_ASYNC_OP *temp = NULL) { + $1 = &temp; +} %typemap(in, numinputs=0) WT_CURSOR ** (WT_CURSOR *temp = NULL) { $1 = &temp; } @@ -80,6 +83,28 @@ from packing import pack, unpack } } } +%typemap(argout) WT_ASYNC_OP ** { + $result = SWIG_NewPointerObj(SWIG_as_voidptr(*$1), + SWIGTYPE_p___wt_async_op, 0); + if (*$1 != NULL) { + PY_CALLBACK *pcb; + + PyObject_SetAttrString($result, "is_column", + PyBool_FromLong(strcmp((*$1)->key_format, "r") == 0)); + PyObject_SetAttrString($result, "key_format", + PyString_InternFromString((*$1)->key_format)); + PyObject_SetAttrString($result, "value_format", + PyString_InternFromString((*$1)->value_format)); + + if (__wt_calloc_def((WT_ASYNC_OP_IMPL *)(*$1), 1, &pcb) != 0) + SWIG_exception_fail(SWIG_MemoryError, "WT calloc failed"); + else { + Py_XINCREF($result); + pcb->pyobj = $result; + ((WT_ASYNC_OP_IMPL *)(*$1))->lang_private = pcb; + } + } +} %typemap(argout) WT_CURSOR ** { $result = SWIG_NewPointerObj(SWIG_as_voidptr(*$1), |