More ITS#7793 Check key->mv_size with MDB_CURRENT.

Since non-NULL key must be provided now.
Document DBI issues, extend MDB_BAD_VALSIZE.
ITS#7771 mdb_cursor_put doc: Cursor moves on error
ITS#7861 Re-fix MDB_db.md_entries.

mdb_cursor_del(): Fix md_entries with MDB_NODUPDATA.
mdb_cursor_put(): Check in xcursor whether an item got inserted. Count
data instead of keys after 13d6d59c512065db3741c20c65b4d9928b986968.
ITS#7834 Fix MDB_MULTIPLE writing multiple keys.

Update the state before looping, so the key is not duplicated.
Broke in 4c8f57615c5ca7b014c038e59c1045182e74f5ad (mostly).
Simplify MDB_MULTIPLE
Factor out MDB_TXN_ERROR
More for big MDB_MAXKEYSIZE with MDB_DUPSORT.

With mdb_cursor_put(new key, data item big enough to need a sub-DB):
- Track cursors as when adding other nodes.  The "!do_sub" is now
  unneeded.  Before ITS#7861 it distinguished inserting key from data.
- Set MDB_TXN_ERROR if an empty sub-DB was created.  I.e. adding
  key:subDB succeeded, but inserting the data item failed.
Factor out mdb_cmp_clong()
Comment ~MDB_APPEND, from earlier commit message.
Fix possible crash in DLL_THREAD_DETACH (explodes in .Net Framework)