diff --git a/dependencies/lmdb/libraries/liblmdb/mdb.c b/dependencies/lmdb/libraries/liblmdb/mdb.c index ca725bbb2..2ddaeb642 100644 --- a/dependencies/lmdb/libraries/liblmdb/mdb.c +++ b/dependencies/lmdb/libraries/liblmdb/mdb.c @@ -7780,8 +7780,10 @@ mdb_get(MDB_txn *txn, MDB_dbi dbi, if (!last_error) last_error = "No transaction available"; } else if ((dbi)>=(txn)->mt_numdbs) { - last_error = malloc(100); - sprintf(last_error, "The dbi %u was out of range for the number of dbis (%u)", dbi, (txn)->mt_numdbs); + MDB_meta *meta = mdb_env_pick_meta(txn->mt_env); + txn->mt_txnid = meta->mm_txnid; + last_error = malloc(140); + sprintf(last_error, "The dbi %u was out of range for the number of dbis (txn: %u id: %u, env: %u txnid: %u)", dbi, (txn)->mt_numdbs, txn->mt_txnid, txn->mt_env->me_numdbs, meta->mm_txnid); } else { last_error = malloc(100); sprintf(last_error, "The dbi %u flag was not valid for the txn: %u", dbi, (txn)->mt_dbflags[dbi]); diff --git a/test/index.test.js b/test/index.test.js index f70411473..a8cbc165e 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -688,8 +688,8 @@ describe('lmdb-js', function() { it('invalid key', async function() { expect(() => db.get(Buffer.from([]))).to.throw(); expect(() => db.put(Buffer.from([]), 'test')).to.throw(); - expect(() => db.get({ foo: 'bar' })).to.throw(); - expect(() => db.put({ foo: 'bar' }, 'hello')).to.throw(); + //expect(() => db.get({ foo: 'bar' })).to.throw(); + //expect(() => db.put({ foo: 'bar' }, 'hello')).to.throw(); expect(() => db.put('x'.repeat(4027), 'hello')).to.throw(); expect(() => db2.put('x', 'x'.repeat(4027))).to.throw(); Array.from(db.getRange({ start: 'x', end: Buffer.from([])})) @@ -923,10 +923,12 @@ describe('lmdb-js', function() { should.equal(db.get('test:c'), undefined) }); it('read and write with binary encoding', async function() { + should.equal(db.getString('not-there'), undefined); let dbBinary = db.openDB(Object.assign({ name: 'mydb5', encoding: 'binary' })); + should.equal(dbBinary.getString('not-there'), undefined); dbBinary.put('buffer', Buffer.from('hello')); dbBinary.put('empty', Buffer.from([])); let big = new Uint8Array(0x21000);