This project has moved. For the latest updates, please go here.
1
Vote

[Possible Fix] TypeError: expected JET_TABLEID, got tuple

description

Possible fix:
--- D:\Projects\personal\ESENT Managed Interface\esedb.py   Sat Nov 5 22:33:43 2016 UTC
+++ D:\Projects\personal\ESENT Managed Interface\esedb.patched.py   Wed Nov 9 22:51:13 2016 UTC
@@ -625,6 +625,8 @@
             None,
             0,
             OpenTableGrbit.None)
+        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 2.7.6.3.

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 = esedb.open('ese_test/local_wdbtest.db', 'n')
for i in range(10): db['%d'%i] = '%d'% (i*i)

ESENT Managed Interface>ipy esedb_local_test.py
Traceback (most recent call last):
  File "esedb_local_test.py", line 3, in <module>
  File "ESENT Managed Interface\esedb.py", line 1585, in open
  File "ESENT Managed Interface\esedb.py", line 464, in openCursor
  File "ESENT Managed Interface\esedb.py", line 628, in _createCursor
  File "ESENT Managed Interface\esedb.py", 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
0)]>)/key/None

comments