This project has moved and is read-only. For the latest updates, please go here.

[Possible Fix] TypeError: expected JET_TABLEID, got tuple


Possible fix:
--- D:\Projects\personal\ESENT Managed Interface\   Sat Nov 5 22:33:43 2016 UTC
+++ D:\Projects\personal\ESENT Managed Interface\   Wed Nov 9 22:51:13 2016 UTC
@@ -625,6 +625,8 @@
+        if isinstance(tableid, tuple):
+            tableid = tableid[1]
         keycolumnid = self._getColumnid(sesid, tableid, self._keycolumn)
         valuecolumnid = self._getColumnid(sesid, tableid, self._valuecolumn)
         cursor = EseDBCursor(self, sesid, tableid, lazyflush, keycolumnid, valuecolumnid)
I added the check in order to keep it "backwards compatible".
Tested on two systems - Windows 10 and Window 8.1 using version 1.9.4 (and also older versions up to 1.9.0) with IronPython

Alternately, line 621 could read:
(wrn, tableid) = Api.JetOpenTable(
Since the documentation to Api.JetOpenTable shows that it returns a JET_wrn and separately has an out parameter of the type JET_TABLEID. Did it previously return the table id directly?

Repro (essentially the example in the docstring/comments of the open function):
import esedb
db ='ese_test/local_wdbtest.db', 'n')
for i in range(10): db['%d'%i] = '%d'% (i*i)

ESENT Managed Interface>ipy
Traceback (most recent call last):
  File "", line 3, in <module>
  File "ESENT Managed Interface\", line 1585, in open
  File "ESENT Managed Interface\", line 464, in openCursor
  File "ESENT Managed Interface\", line 628, in _createCursor
  File "ESENT Managed Interface\", line 638, in _getColumnid
TypeError: expected JET_TABLEID, got tuple
Upon tracing tableid right after assignment in _createCursor:
JET_SESID(0x74a0980)/(Microsoft.Isam.Esent.Interop.JET_wrn.Success, <Microsoft.I
sam.Esent.Interop.JET_TABLEID object at 0x000000000000006C [JET_TABLEID(0xbfe120