/ Changes On Branch sqlite3_kv
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch sqlite3_kv Excluding Merge-Ins

This is equivalent to a diff from 681d96eb82 to 088c590379

2017-01-19
12:07
Add a prototype of the sqlite3_kv_reset() interface. (Leaf check-in: 088c590379 user: drh tags: sqlite3_kv)
2017-01-18
22:16
Fix handling of initial hidden and/or system files in the opendir() implementation for Windows. No changes to non-test code. (check-in: 26dd42b462 user: mistachkin tags: trunk)
20:14
Add temporary code to record and report on the set of b-tree pages read and written by the current transaction. This is likely still buggy. (check-in: 2a8f6c890c user: dan tags: transaction-pages)
19:54
Begin fleshing out the key/value accessor implementation. This is an incremental check-in. (check-in: 02d60e196f user: drh tags: sqlite3_kv)
17:20
Baseline interface definition for the experimental sqlite3_kv accessor object. (check-in: a435841e71 user: drh tags: sqlite3_kv)
2017-01-17
10:41
Fix a problem that could cause a spurious SQLITE_NOMEM error when attempting to resume an RBU operation if the previous client failed right after completing the incremental checkpoint. Also a "cannot vacuum wal db" error that could occur when resuming an RBU vacuum if an error (OOM or IO error) occurs during the incremental checkpoint. (check-in: 681d96eb82 user: dan tags: trunk)
00:10
Disable intrinsic functions for Windows using Clang, due to reports of linkage errors. This causes a 0.6% performance reduction. We will want to revisit this change in the future. (check-in: 7fd560c6d2 user: drh tags: trunk)

Changes to Makefile.in.

170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
         expr.lo fault.lo fkey.lo \
         fts3.lo fts3_aux.lo fts3_expr.lo fts3_hash.lo fts3_icu.lo \
         fts3_porter.lo fts3_snippet.lo fts3_tokenizer.lo fts3_tokenizer1.lo \
         fts3_tokenize_vtab.lo \
         fts3_unicode.lo fts3_unicode2.lo fts3_write.lo \
	 fts5.lo \
         func.lo global.lo hash.lo \
         icu.lo insert.lo json1.lo legacy.lo loadext.lo \
         main.lo malloc.lo mem0.lo mem1.lo mem2.lo mem3.lo mem5.lo \
         memjournal.lo \
         mutex.lo mutex_noop.lo mutex_unix.lo mutex_w32.lo \
         notify.lo opcodes.lo os.lo os_unix.lo os_win.lo \
         pager.lo parse.lo pcache.lo pcache1.lo pragma.lo prepare.lo printf.lo \
         random.lo resolve.lo rowset.lo rtree.lo \
         sqlite3session.lo select.lo sqlite3rbu.lo status.lo \







|







170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
         expr.lo fault.lo fkey.lo \
         fts3.lo fts3_aux.lo fts3_expr.lo fts3_hash.lo fts3_icu.lo \
         fts3_porter.lo fts3_snippet.lo fts3_tokenizer.lo fts3_tokenizer1.lo \
         fts3_tokenize_vtab.lo \
         fts3_unicode.lo fts3_unicode2.lo fts3_write.lo \
	 fts5.lo \
         func.lo global.lo hash.lo \
         icu.lo insert.lo json1.lo kvapi.o legacy.lo loadext.lo \
         main.lo malloc.lo mem0.lo mem1.lo mem2.lo mem3.lo mem5.lo \
         memjournal.lo \
         mutex.lo mutex_noop.lo mutex_unix.lo mutex_w32.lo \
         notify.lo opcodes.lo os.lo os_unix.lo os_win.lo \
         pager.lo parse.lo pcache.lo pcache1.lo pragma.lo prepare.lo printf.lo \
         random.lo resolve.lo rowset.lo rtree.lo \
         sqlite3session.lo select.lo sqlite3rbu.lo status.lo \
222
223
224
225
226
227
228

229
230
231
232
233
234
235
  $(TOP)/src/fkey.c \
  $(TOP)/src/func.c \
  $(TOP)/src/global.c \
  $(TOP)/src/hash.c \
  $(TOP)/src/hash.h \
  $(TOP)/src/hwtime.h \
  $(TOP)/src/insert.c \

  $(TOP)/src/legacy.c \
  $(TOP)/src/loadext.c \
  $(TOP)/src/main.c \
  $(TOP)/src/malloc.c \
  $(TOP)/src/mem0.c \
  $(TOP)/src/mem1.c \
  $(TOP)/src/mem2.c \







>







222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
  $(TOP)/src/fkey.c \
  $(TOP)/src/func.c \
  $(TOP)/src/global.c \
  $(TOP)/src/hash.c \
  $(TOP)/src/hash.h \
  $(TOP)/src/hwtime.h \
  $(TOP)/src/insert.c \
  $(TOP)/src/kvapi.c \
  $(TOP)/src/legacy.c \
  $(TOP)/src/loadext.c \
  $(TOP)/src/main.c \
  $(TOP)/src/malloc.c \
  $(TOP)/src/mem0.c \
  $(TOP)/src/mem1.c \
  $(TOP)/src/mem2.c \
763
764
765
766
767
768
769



770
771
772
773
774
775
776

hash.lo:	$(TOP)/src/hash.c $(HDR)
	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/hash.c

insert.lo:	$(TOP)/src/insert.c $(HDR)
	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/insert.c




legacy.lo:	$(TOP)/src/legacy.c $(HDR)
	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/legacy.c

loadext.lo:	$(TOP)/src/loadext.c $(HDR)
	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/loadext.c

main.lo:	$(TOP)/src/main.c $(HDR)







>
>
>







764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780

hash.lo:	$(TOP)/src/hash.c $(HDR)
	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/hash.c

insert.lo:	$(TOP)/src/insert.c $(HDR)
	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/insert.c

kvapi.lo:	$(TOP)/src/kvapi.c $(HDR)
	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/kvapi.c

legacy.lo:	$(TOP)/src/legacy.c $(HDR)
	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/legacy.c

loadext.lo:	$(TOP)/src/loadext.c $(HDR)
	$(LTCOMPILE) $(TEMP_STORE) -c $(TOP)/src/loadext.c

main.lo:	$(TOP)/src/main.c $(HDR)

Changes to Makefile.msc.

1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
         callback.lo complete.lo ctime.lo date.lo dbstat.lo delete.lo \
         expr.lo fault.lo fkey.lo \
         fts3.lo fts3_aux.lo fts3_expr.lo fts3_hash.lo fts3_icu.lo \
         fts3_porter.lo fts3_snippet.lo fts3_tokenizer.lo fts3_tokenizer1.lo \
         fts3_tokenize_vtab.lo fts3_unicode.lo fts3_unicode2.lo fts3_write.lo \
         fts5.lo \
         func.lo global.lo hash.lo \
         icu.lo insert.lo legacy.lo loadext.lo \
         main.lo malloc.lo mem0.lo mem1.lo mem2.lo mem3.lo mem5.lo \
         memjournal.lo \
         mutex.lo mutex_noop.lo mutex_unix.lo mutex_w32.lo \
         notify.lo opcodes.lo os.lo os_unix.lo os_win.lo \
         pager.lo pcache.lo pcache1.lo pragma.lo prepare.lo printf.lo \
         random.lo resolve.lo rowset.lo rtree.lo \
         sqlite3session.lo select.lo sqlite3rbu.lo status.lo \







|







1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
         callback.lo complete.lo ctime.lo date.lo dbstat.lo delete.lo \
         expr.lo fault.lo fkey.lo \
         fts3.lo fts3_aux.lo fts3_expr.lo fts3_hash.lo fts3_icu.lo \
         fts3_porter.lo fts3_snippet.lo fts3_tokenizer.lo fts3_tokenizer1.lo \
         fts3_tokenize_vtab.lo fts3_unicode.lo fts3_unicode2.lo fts3_write.lo \
         fts5.lo \
         func.lo global.lo hash.lo \
         icu.lo insert.lo kvapi.lo legacy.lo loadext.lo \
         main.lo malloc.lo mem0.lo mem1.lo mem2.lo mem3.lo mem5.lo \
         memjournal.lo \
         mutex.lo mutex_noop.lo mutex_unix.lo mutex_w32.lo \
         notify.lo opcodes.lo os.lo os_unix.lo os_win.lo \
         pager.lo pcache.lo pcache1.lo pragma.lo prepare.lo printf.lo \
         random.lo resolve.lo rowset.lo rtree.lo \
         sqlite3session.lo select.lo sqlite3rbu.lo status.lo \
1142
1143
1144
1145
1146
1147
1148

1149
1150
1151
1152
1153
1154
1155
  $(TOP)\src\expr.c \
  $(TOP)\src\fault.c \
  $(TOP)\src\fkey.c \
  $(TOP)\src\func.c \
  $(TOP)\src\global.c \
  $(TOP)\src\hash.c \
  $(TOP)\src\insert.c \

  $(TOP)\src\legacy.c \
  $(TOP)\src\loadext.c \
  $(TOP)\src\main.c \
  $(TOP)\src\malloc.c \
  $(TOP)\src\mem0.c \
  $(TOP)\src\mem1.c \
  $(TOP)\src\mem2.c \







>







1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
  $(TOP)\src\expr.c \
  $(TOP)\src\fault.c \
  $(TOP)\src\fkey.c \
  $(TOP)\src\func.c \
  $(TOP)\src\global.c \
  $(TOP)\src\hash.c \
  $(TOP)\src\insert.c \
  $(TOP)\src\kvapi.c \
  $(TOP)\src\legacy.c \
  $(TOP)\src\loadext.c \
  $(TOP)\src\main.c \
  $(TOP)\src\malloc.c \
  $(TOP)\src\mem0.c \
  $(TOP)\src\mem1.c \
  $(TOP)\src\mem2.c \
1737
1738
1739
1740
1741
1742
1743



1744
1745
1746
1747
1748
1749
1750

hash.lo:	$(TOP)\src\hash.c $(HDR)
	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\hash.c

insert.lo:	$(TOP)\src\insert.c $(HDR)
	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\insert.c




legacy.lo:	$(TOP)\src\legacy.c $(HDR)
	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\legacy.c

loadext.lo:	$(TOP)\src\loadext.c $(HDR)
	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\loadext.c

main.lo:	$(TOP)\src\main.c $(HDR)







>
>
>







1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754

hash.lo:	$(TOP)\src\hash.c $(HDR)
	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\hash.c

insert.lo:	$(TOP)\src\insert.c $(HDR)
	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\insert.c

kvapi.lo:	$(TOP)\src\kvapi.c $(HDR)
	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\kvapi.c

legacy.lo:	$(TOP)\src\legacy.c $(HDR)
	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\legacy.c

loadext.lo:	$(TOP)\src\loadext.c $(HDR)
	$(LTCOMPILE) $(CORE_COMPILE_OPTS) -c $(TOP)\src\loadext.c

main.lo:	$(TOP)\src\main.c $(HDR)

Changes to main.mk.

58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
         callback.o complete.o ctime.o date.o dbstat.o delete.o expr.o \
	 fault.o fkey.o \
         fts3.o fts3_aux.o fts3_expr.o fts3_hash.o fts3_icu.o fts3_porter.o \
         fts3_snippet.o fts3_tokenizer.o fts3_tokenizer1.o \
         fts3_tokenize_vtab.o \
	 fts3_unicode.o fts3_unicode2.o \
         fts3_write.o fts5.o func.o global.o hash.o \
         icu.o insert.o json1.o legacy.o loadext.o \
         main.o malloc.o mem0.o mem1.o mem2.o mem3.o mem5.o \
         memjournal.o \
         mutex.o mutex_noop.o mutex_unix.o mutex_w32.o \
         notify.o opcodes.o os.o os_unix.o os_win.o \
         pager.o pcache.o pcache1.o pragma.o prepare.o printf.o \
         random.o resolve.o rowset.o rtree.o select.o sqlite3rbu.o status.o \
         table.o threads.o tokenize.o treeview.o trigger.o \







|







58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
         callback.o complete.o ctime.o date.o dbstat.o delete.o expr.o \
	 fault.o fkey.o \
         fts3.o fts3_aux.o fts3_expr.o fts3_hash.o fts3_icu.o fts3_porter.o \
         fts3_snippet.o fts3_tokenizer.o fts3_tokenizer1.o \
         fts3_tokenize_vtab.o \
	 fts3_unicode.o fts3_unicode2.o \
         fts3_write.o fts5.o func.o global.o hash.o \
         icu.o insert.o json1.o kvapi.o legacy.o loadext.o \
         main.o malloc.o mem0.o mem1.o mem2.o mem3.o mem5.o \
         memjournal.o \
         mutex.o mutex_noop.o mutex_unix.o mutex_w32.o \
         notify.o opcodes.o os.o os_unix.o os_win.o \
         pager.o pcache.o pcache1.o pragma.o prepare.o printf.o \
         random.o resolve.o rowset.o rtree.o select.o sqlite3rbu.o status.o \
         table.o threads.o tokenize.o treeview.o trigger.o \
102
103
104
105
106
107
108

109
110
111
112
113
114
115
  $(TOP)/src/fkey.c \
  $(TOP)/src/func.c \
  $(TOP)/src/global.c \
  $(TOP)/src/hash.c \
  $(TOP)/src/hash.h \
  $(TOP)/src/hwtime.h \
  $(TOP)/src/insert.c \

  $(TOP)/src/legacy.c \
  $(TOP)/src/loadext.c \
  $(TOP)/src/main.c \
  $(TOP)/src/malloc.c \
  $(TOP)/src/mem0.c \
  $(TOP)/src/mem1.c \
  $(TOP)/src/mem2.c \







>







102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
  $(TOP)/src/fkey.c \
  $(TOP)/src/func.c \
  $(TOP)/src/global.c \
  $(TOP)/src/hash.c \
  $(TOP)/src/hash.h \
  $(TOP)/src/hwtime.h \
  $(TOP)/src/insert.c \
  $(TOP)/src/kvapi.c \
  $(TOP)/src/legacy.c \
  $(TOP)/src/loadext.c \
  $(TOP)/src/main.c \
  $(TOP)/src/malloc.c \
  $(TOP)/src/mem0.c \
  $(TOP)/src/mem1.c \
  $(TOP)/src/mem2.c \

Added src/kvapi.c.



































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
** 2017-01-18
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
**
** This file contains code used to implement key/value access interface.
*/

#include "sqliteInt.h"

#ifndef SQLITE_OMIT_KEYVALUE_ACCESSOR

/*
** An sqlite3_kv object is an accessor for key/value pairs.
**
** This is an opaque object.  The public interface sees pointers to this
** object, but not the internals.  So the internal composition of this
** object is free to change from one release to the next without breaking
** compatibility.
*/
struct sqlite3_kv {
  sqlite3 *db;            /* The database holding the table to be accessed */
  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 */
};

/*
** Create a new sqlite3_kv object open on zDb.zTable and return
** a pointer to that object.
*/
int sqlite3_kv_open(
  sqlite3 *db,          /* The database connection */
  const char *zDb,      /* Schema containing zTable.  NULL for "main" */
  const char *zTable,   /* Name of table the key/value table */
  unsigned int flags,   /* Must be zero.  Reserved for future expansion. */
  sqlite3_kv **ppKvOut  /* Store the new sqlite3_kv object here */
){
  sqlite3_kv *pKv;
  Table *pTab;
  int rc = SQLITE_ERROR;

#ifdef SQLITE_ENABLE_API_ARMOR
  if( ppKvOut==0 ){
    return SQLITE_MISUSE_BKPT;
  }
#endif
  *ppKvOut = 0;
#ifdef SQLITE_ENABLE_API_ARMOR
  if( !sqlite3SafetyCheckOk(db) || zTable==0 ){
    return SQLITE_MISUSE_BKPT;
  }
#endif
  sqlite3_mutex_enter(db->mutex);
  sqlite3BtreeEnterAll(db);

  pTab = sqlite3FindTable(db, zTable, zDb);
  if( pTab==0 ){
    goto kv_open_done;
  }
  if( !((pTab->nCol==1 && pTab->iPKey<0)
        || (pTab->nCol==2 && pTab->iPKey==0)) 
  ){
    /* Must be an single-column table without an INTEGER PRIMARY KEY,
    ** or a two-column table where the first column is the INTEGER PRIMARY KEY
    */
    goto kv_open_done;
  }
  if( pTab->pIndex!=0 || pTab->pFKey!=0 || pTab->pCheck!=0 ){
    /* Do not allow secondary indexes, foreign keys, or CHECK constraints */
    goto kv_open_done;
  }
  if( pTab->tabFlags & (TF_Autoincrement|TF_Virtual|TF_WithoutRowid) ){
    /* Must not have autoincrement.  Must not be a virtual table or a
    ** without rowid table */
    goto kv_open_done;
  }
  *ppKvOut = pKv = sqlite3_malloc(sizeof(*pKv));
  if( pKv==0 ){
    rc = SQLITE_NOMEM;
    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:
  sqlite3BtreeLeaveAll(db);
  sqlite3_mutex_leave(db->mutex);
  return rc;
}

/*
** Free the key/value accessor at pKv
*/
int sqlite3_kv_close(sqlite3_kv *pKv){
  sqlite3_free(pKv);
  return SQLITE_OK;
}

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;
}
int sqlite3_kv_read(sqlite3_kv *pKv, void *pBuf, int amt, int offset){
  return SQLITE_MISUSE;
}
int sqlite3_kv_insert(sqlite3_kv *pKv, sqlite3_int64 rid, int sz, void *pBuf){
  return SQLITE_MISUSE;
}

#endif /* #ifndef SQLITE_OMIT_KEYVALU_ACCESSOR */

Changes to src/sqlite.h.in.

493
494
495
496
497
498
499


500
501
502
503
504
505
506
#define SQLITE_IOERR_GETTEMPPATH       (SQLITE_IOERR | (25<<8))
#define SQLITE_IOERR_CONVPATH          (SQLITE_IOERR | (26<<8))
#define SQLITE_IOERR_VNODE             (SQLITE_IOERR | (27<<8))
#define SQLITE_IOERR_AUTH              (SQLITE_IOERR | (28<<8))
#define SQLITE_LOCKED_SHAREDCACHE      (SQLITE_LOCKED |  (1<<8))
#define SQLITE_BUSY_RECOVERY           (SQLITE_BUSY   |  (1<<8))
#define SQLITE_BUSY_SNAPSHOT           (SQLITE_BUSY   |  (2<<8))


#define SQLITE_CANTOPEN_NOTEMPDIR      (SQLITE_CANTOPEN | (1<<8))
#define SQLITE_CANTOPEN_ISDIR          (SQLITE_CANTOPEN | (2<<8))
#define SQLITE_CANTOPEN_FULLPATH       (SQLITE_CANTOPEN | (3<<8))
#define SQLITE_CANTOPEN_CONVPATH       (SQLITE_CANTOPEN | (4<<8))
#define SQLITE_CORRUPT_VTAB            (SQLITE_CORRUPT | (1<<8))
#define SQLITE_READONLY_RECOVERY       (SQLITE_READONLY | (1<<8))
#define SQLITE_READONLY_CANTLOCK       (SQLITE_READONLY | (2<<8))







>
>







493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
#define SQLITE_IOERR_GETTEMPPATH       (SQLITE_IOERR | (25<<8))
#define SQLITE_IOERR_CONVPATH          (SQLITE_IOERR | (26<<8))
#define SQLITE_IOERR_VNODE             (SQLITE_IOERR | (27<<8))
#define SQLITE_IOERR_AUTH              (SQLITE_IOERR | (28<<8))
#define SQLITE_LOCKED_SHAREDCACHE      (SQLITE_LOCKED |  (1<<8))
#define SQLITE_BUSY_RECOVERY           (SQLITE_BUSY   |  (1<<8))
#define SQLITE_BUSY_SNAPSHOT           (SQLITE_BUSY   |  (2<<8))
#define SQLITE_KV_BEFORE               (SQLITE_NOTFOUND | (1<<8))
#define SQLITE_KV_AFTER                (SQLITE_NOTFOUND | (2<<8))
#define SQLITE_CANTOPEN_NOTEMPDIR      (SQLITE_CANTOPEN | (1<<8))
#define SQLITE_CANTOPEN_ISDIR          (SQLITE_CANTOPEN | (2<<8))
#define SQLITE_CANTOPEN_FULLPATH       (SQLITE_CANTOPEN | (3<<8))
#define SQLITE_CANTOPEN_CONVPATH       (SQLITE_CANTOPEN | (4<<8))
#define SQLITE_CORRUPT_VTAB            (SQLITE_CORRUPT | (1<<8))
#define SQLITE_READONLY_RECOVERY       (SQLITE_READONLY | (1<<8))
#define SQLITE_READONLY_CANTLOCK       (SQLITE_READONLY | (2<<8))
8444
8445
8446
8447
8448
8449
8450














































































































8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
** transaction open on the database, or if the database is not a wal mode
** database.
**
** SQLITE_OK is returned if successful, or an SQLite error code otherwise.
*/
SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const char *zDb);















































































































/*
** Undo the hack that converts floating point types to integer for
** builds on processors without floating point support.
*/
#ifdef SQLITE_OMIT_FLOATING_POINT
# undef double
#endif

#ifdef __cplusplus
}  /* End of the 'extern "C"' block */
#endif
#endif /* SQLITE3_H */







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>












8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
** transaction open on the database, or if the database is not a wal mode
** database.
**
** SQLITE_OK is returned if successful, or an SQLite error code otherwise.
*/
SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const char *zDb);


/*
** CAPI3REF: Key/Value Access
** EXPERIMENTAL
**
** The sqlite3_kv object is used to access database tables using
** the key/value interface.
*/
typedef struct sqlite3_kv sqlite3_kv;


/*
** CAPI3REF: Open a key/value accessor object
** CONSTRUCTOR: sqlite3_kv
** EXPERIMENTAL
**
** This interface attempts create a new [sqlite3_kv] object and
** return a pointer to that object in the 5th parameter.
** SQLITE_OK is returned on success or an error code if something
** goes wrong.
*/
int sqlite3_kv_open(
  sqlite3 *db,
  const char *zDb,
  const char *zTable,
  unsigned int flags,   /* Must be zero.  Reserved for future expansion. */
  sqlite3_kv **ppKvOut
);

/*
** CAPI3REF: Close a key/value accessor object
** DESTRUCTOR: sqlite3_kv
** EXPERIMENTAL
**
** The sqlite3_kv_close(P) interface closes a key/value accessor P.
** The argument to sqlite3_kv_close(P) may be NULL, resulting in a harmless
** no-op.
*/
int sqlite3_kv_close(sqlite3_kv*);

/*
** CAPI3REF: Reposition a key/value accessor object
** METHOD: sqlite3_kv
** EXPERIMENTAL
**
** The sqlite3_kv_seek(P,I) interface attempts to reposition
** the key/value accessor object P so that it is pointing to a table
** entry with rowid I.  The sqlite3_kv_seek(P,I) interface returns
** SQLITE_OK on success or an error code if it is unable to complete
** the operation.  If no record exists with rowid I, then sqlite3_kv_seek(P,I)
** attempts to position itself at another nearby record and returns
** either SQLITE_KV_BEFORE or SQLITE_KV_AFTER depending on whether the
** 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
**
** The sqlite3_kv_bytes(P) interface returns the size of the value
** in the key/value pair that the key/value accessor object P is currently
** pointing to.  The sqlite3_kv_bytes(P) interface returns a negative
** number if the key/value accessor object P is not currently pointing
** to a valid entry in the table.
*/
int sqlite3_kv_bytes(sqlite3_kv*);

/*
** CAPI3REF: Read the value for a key/value pair
** METHOD: sqlite3_kv
** EXPERIMENTAL
**
** The sqlite3_kv_read(P,B,A,O) interface attempts to read A bytes of
** content beginning at offset O from the value that the key/value accessor P
** is currently pointing at, storing the results in buffer B.
** The caller must ensure that the buffer B is at least A bytes in length.
*/
int sqlite3_kv_read(sqlite3_kv*, void *pBuf, int amt, int offset);

/*
** CAPI3REF: Insert a new key/value pair
** METHOD: sqlite3_kv
** EXPERIMENTAL
**
** The sqlite3_kv_insert(P,I,N,B) interface inserts a key/value pair
** having key I and a value that is an N-byte BLOB pointed to by B.
** In a call to sqlite3_kv_insert(P,I,N,B), if a previous row with key I
** already exists in the table, then that previous row is replaced by
** the new row.
*/
int sqlite3_kv_insert(sqlite3_kv*, sqlite3_int64 rowid, int size, void *pBuf);

/*
** Undo the hack that converts floating point types to integer for
** builds on processors without floating point support.
*/
#ifdef SQLITE_OMIT_FLOATING_POINT
# undef double
#endif

#ifdef __cplusplus
}  /* End of the 'extern "C"' block */
#endif
#endif /* SQLITE3_H */

Changes to tool/mksqlite3c-noext.tcl.

334
335
336
337
338
339
340

341
342
343
344
345
346
347
   auth.c
   build.c
   callback.c
   delete.c
   func.c
   fkey.c
   insert.c

   legacy.c
   loadext.c
   pragma.c
   prepare.c
   select.c
   table.c
   trigger.c







>







334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
   auth.c
   build.c
   callback.c
   delete.c
   func.c
   fkey.c
   insert.c
   kvapi.c
   legacy.c
   loadext.c
   pragma.c
   prepare.c
   select.c
   table.c
   trigger.c

Changes to tool/mksqlite3c.tcl.

342
343
344
345
346
347
348

349
350
351
352
353
354
355
   auth.c
   build.c
   callback.c
   delete.c
   func.c
   fkey.c
   insert.c

   legacy.c
   loadext.c
   pragma.c
   prepare.c
   select.c
   table.c
   trigger.c







>







342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
   auth.c
   build.c
   callback.c
   delete.c
   func.c
   fkey.c
   insert.c
   kvapi.c
   legacy.c
   loadext.c
   pragma.c
   prepare.c
   select.c
   table.c
   trigger.c