Add a prototype of the sqlite3_kv_reset() interface.

FossilOrigin-Name: 088c590379f844c1443b0ccdf8695f1506584451
diff --git a/manifest b/manifest
index 3afc7ce..193e12e 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Begin\sfleshing\sout\sthe\skey/value\saccessor\simplementation.\s\sThis\sis\san\nincremental\scheck-in.
-D 2017-01-18T19:54:07.280
+C Add\sa\sprototype\sof\sthe\ssqlite3_kv_reset()\sinterface.
+D 2017-01-19T12:07:08.814
 F Makefile.in 78688a52015911e4b841b265c5fef09fbf81e655
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc 836dde6df991bd855e93db1721f9347678cb9cda
@@ -353,7 +353,7 @@
 F src/hwtime.h 747c1bbe9df21a92e9c50f3bbec1de841dc5e5da
 F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
 F src/insert.c 05e47e2de7b712a3a4148cd469e5f60873f5ef13
-F src/kvapi.c d6d96b6b379824c59752c8f010a0c2451b09726b
+F src/kvapi.c 3b20d8f7d7e69f17f81e7917e0f3a5ceca559d20
 F src/legacy.c 75d3023be8f0d2b99d60f905090341a03358c58e
 F src/loadext.c 5d6642d141c07d366e43d359e94ec9de47add41d
 F src/main.c e207b81542d13b9f13d61e78ca441f9781f055b0
@@ -393,7 +393,7 @@
 F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac
 F src/select.c 3856db523b942062bca8722ba03b61c324ff94d6
 F src/shell.c 6095531aa900decdaa765e0f3993fba7153c92c1
-F src/sqlite.h.in 746b620b79d80b806bfaa5352b72e3e290947bcd
+F src/sqlite.h.in ff59423b65e5573b3abdf65c8a437ceaef93eb69
 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
 F src/sqlite3ext.h 8648034aa702469afb553231677306cc6492a1ae
 F src/sqliteInt.h ce3e07c720b0cebc8887ea86b3b128da0913c5d3
@@ -1548,7 +1548,7 @@
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P a435841e71deecb374c7b667f8d52e82603177ae
-R 7566de8f7ffe2c31b7ee390fe331ce1f
+P 02d60e196fe2a07ef90a5cfad0daa46020bfd06e
+R a9d74517ea3f75ec81817c95ce60d493
 U drh
-Z 5e43af2e63c3c36926d3940913a94ce6
+Z 706252d4c96233de5edfe4f55ad55c0d
diff --git a/manifest.uuid b/manifest.uuid
index 2458d79..5e13462 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-02d60e196fe2a07ef90a5cfad0daa46020bfd06e
\ No newline at end of file
+088c590379f844c1443b0ccdf8695f1506584451
\ No newline at end of file
diff --git a/src/kvapi.c b/src/kvapi.c
index 9d719b0..5fde106 100644
--- a/src/kvapi.c
+++ b/src/kvapi.c
@@ -27,8 +27,10 @@
 */
 struct sqlite3_kv {
   sqlite3 *db;            /* The database holding the table to be accessed */
-  u8 iDb;                 /* Database containing the table to access */
   u32 iRoot;              /* Root page of the table */
+  int iGen;               /* Schema generation number */
+  int iCookie;            /* Schema cookie number from the database file */
+  Schema *pSchema;        /* Schema holding the table */
   sqlite3_int64 iRowid;   /* Current rowid */
 };
 
@@ -88,6 +90,10 @@
     goto kv_open_done;
   }
   pKv->db = db;
+  pKv->iGen = pTab->pSchema->iGeneration;
+  pKv->iCookie = pTab->pSchema->schema_cookie;
+  pKv->pSchema = pTab->pSchema;
+  pKv->iRoot = pTab->tnum;
   rc = SQLITE_OK;
 
 kv_open_done:
@@ -107,6 +113,9 @@
 int sqlite3_kv_seek(sqlite3_kv *pKv, sqlite3_int64 rowid){
   return SQLITE_MISUSE;
 }
+int sqlite3_kv_reset(sqlite3_kv *pKv){
+  return SQLITE_MISUSE;
+}
 int sqlite3_kv_bytes(sqlite3_kv *pKv){
   return -1;
 }
diff --git a/src/sqlite.h.in b/src/sqlite.h.in
index 89d163a..1f8b962 100644
--- a/src/sqlite.h.in
+++ b/src/sqlite.h.in
@@ -8505,10 +8505,24 @@
 ** record the accessor is left pointing to is less than or greater than I,
 ** respectively.  If the table is empty, sqlite3_kv_seek(P,I) returns
 ** SQLITE_EMPTY.
+**
+** A successful sqlite3_kv_seek(P,I) call leave the key/value accessor
+** P holding a read transaction open on the database.  Use sqlite3_kv_reset(P)
+** or sqlite3_kv_close(P) to release this transaction.
 */
 int sqlite3_kv_seek(sqlite3_kv*, sqlite3_int64 rowid);
 
 /*
+** CAPI3REF: Reset a key/value accessor object
+** METHOD: sqlite3_kv
+** EXPERIMENTAL
+**
+** The sqlite3_kv_reset(P) interface restores the key/value accessor P
+** back to its original state, releasing any transactions held.
+*/
+int sqlite3_kv_reset(sqlite3_kv*);
+
+/*
 ** CAPI3REF: Find the size of the value for a key/value pair
 ** METHOD: sqlite3_kv
 ** EXPERIMENTAL