Compare commits

...

3 Commits

Author SHA1 Message Date
drh 7f71dfe2ef Add new interfaces sqlite3_result_pointer(), and
sqlite3_value_pointer() and use them to transfer the eponymous FTS3 column
pointer to the snippet() and offsets() routines.  This is a cherry-pick
of [f0f49224] which was in turn inspired by [72de49f2].

FossilOrigin-Name: 5a3022e0811e24c9d968527eec447f4c2db6c36757f252601d287d9d1b337c72
2017-07-21 04:08:41 +00:00
drh 93029b9702 Version 3.8.10.2
FossilOrigin-Name: 2ef4f3a5b1d1d0c4338f8243d40a2452cc1f7fe4
2015-05-20 18:17:19 +00:00
drh 6eb0123967 Ensure that when the VM applies TEXT affinity to a value it discards
any existing REAL or INTEGER value. Fix for [34cd55d6].
Increase the version number to 3.8.10.2.

FossilOrigin-Name: 40f67265c46572cdcfb802a2464d315a821f9be1
2015-05-19 19:52:32 +00:00
10 changed files with 2291 additions and 4465 deletions
+1 -1
View File
@@ -1 +1 @@
3.8.10.1
3.8.10.2
Vendored
+2239 -4440
View File
File diff suppressed because it is too large Load Diff
+3 -6
View File
@@ -3303,7 +3303,7 @@ static int fts3ColumnMethod(
}else if( iCol==p->nColumn ){
/* The extra column whose name is the same as the table.
** Return a blob which is a pointer to the cursor. */
sqlite3_result_blob(pCtx, &pCsr, sizeof(pCsr), SQLITE_TRANSIENT);
sqlite3_result_pointer(pCtx, pCsr);
}else if( iCol==p->nColumn+2 && pCsr->pExpr ){
sqlite3_result_int64(pCtx, pCsr->iLangid);
}else{
@@ -3515,16 +3515,13 @@ static int fts3FunctionArg(
sqlite3_value *pVal, /* argv[0] passed to function */
Fts3Cursor **ppCsr /* OUT: Store cursor handle here */
){
Fts3Cursor *pRet;
if( sqlite3_value_type(pVal)!=SQLITE_BLOB
|| sqlite3_value_bytes(pVal)!=sizeof(Fts3Cursor *)
){
Fts3Cursor *pRet = (Fts3Cursor*)sqlite3_value_pointer(pVal);
if( pRet==0 ){
char *zErr = sqlite3_mprintf("illegal first argument to %s", zFunc);
sqlite3_result_error(pContext, zErr, -1);
sqlite3_free(zErr);
return SQLITE_ERROR;
}
memcpy(&pRet, sqlite3_value_blob(pVal), sizeof(Fts3Cursor *));
*ppCsr = pRet;
return SQLITE_OK;
}
+13 -16
View File
@@ -1,12 +1,12 @@
C Version\s3.8.10.1
D 2015-05-09T12:14:55.159
C Add\snew\sinterfaces\ssqlite3_result_pointer(),\sand\nsqlite3_value_pointer()\sand\suse\sthem\sto\stransfer\sthe\seponymous\sFTS3\scolumn\npointer\sto\sthe\ssnippet()\sand\soffsets()\sroutines.\s\sThis\sis\sa\scherry-pick\nof\s[f0f49224]\swhich\swas\sin\sturn\sinspired\sby\s[72de49f2].
D 2017-07-21T04:08:41.087
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 08728ecbeddca339c77bfd564d3484b523dffdb1
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F Makefile.msc c6241f7fa2912427410ef15429c8ab5601e19a71
F Makefile.vxworks e1b65dea203f054e71653415bd8f96dcaed47858
F README.md d58e3bebc0a4145e0f2a87994015fdb575a8e866
F VERSION 8af05c43e00f7de32be74ff9984d792c96cdb0de
F VERSION 527b4c5a3d1a29e3b16162473d0903b569c6d7cb
F aclocal.m4 a5c22d164aff7ed549d53a90fa56d56955281f50
F addopcodes.awk 9eb448a552d5c0185cf62c463f9c173cedae3811
F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2
@@ -38,7 +38,7 @@ F autoconf/tea/win/rules.vc c511f222b80064096b705dbeb97060ee1d6b6d63
F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977
F config.h.in 42b71ad3fe21c9e88fa59e8458ca1a6bc72eb0c0
F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55
F configure dae9f0ec4df32a9e300befbcdbc4ff8874731357 x
F configure 17b518102f77344a1709422da84afebb57f0fcfe x
F configure.ac 0b775d383c536bbaafc1e46dd3cbb81a7ea11aeb
F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad
F doc/lemon.html 334dbf6621b8fb8790297ec1abf3cfa4621709d1
@@ -78,7 +78,7 @@ F ext/fts3/README.content fdc666a70d5257a64fee209f97cf89e0e6e32b51
F ext/fts3/README.syntax a19711dc5458c20734b8e485e75fb1981ec2427a
F ext/fts3/README.tokenizers e0a8b81383ea60d0334d274fadf305ea14a8c314
F ext/fts3/README.txt 8c18f41574404623b76917b9da66fcb0ab38328d
F ext/fts3/fts3.c 2fb98467f4b670c8934cdd97d1ba3ffa7382764c
F ext/fts3/fts3.c ca29618d3b09e148aeabbc4221e1f131d6f38be27f434b0da3626418c3ea7254
F ext/fts3/fts3.h 3a10a0af180d502cecc50df77b1b22df142817fe
F ext/fts3/fts3Int.h 59ecaa2d7af0da44c70b6aeaebdcfc070d14abab
F ext/fts3/fts3_aux.c 9edc3655fcb287f0467d0a4b886a01c6185fe9f1
@@ -233,7 +233,7 @@ F src/resolve.c 99eabf7eff0bfa65b75939b46caa82e2b2133f28
F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e
F src/select.c 1b0bfc7d59e48c26b895a6b719157111a617d9e3
F src/shell.c 07dda7cd692911d2f22269953418d049f2e2c0ee
F src/sqlite.h.in ca27603a36fcacdaac5a19d8ee35aaff8ce8516f
F src/sqlite.h.in 62a1403d6e97164b5332aea4b5fca310822bba7806cf588bd12bb66ddcee173d
F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad
F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d
F src/sqliteInt.h 20d9c59fd82774503b8953acfbcc6ecbdd9ee6aa
@@ -293,10 +293,10 @@ F src/update.c 3c4ecc282accf12d39edb8d524cf089645e55a13
F src/utf.c fc6b889ba0779b7722634cdeaa25f1930d93820c
F src/util.c a6431c92803b975b7322724a7b433e538d243539
F src/vacuum.c 2ddd5cad2a7b9cef7f9e431b8c7771634c6b1701
F src/vdbe.c d437887d02d13d79dc69ac018f788aefac3b3972
F src/vdbe.c 163e045d58ec5ff5384020e48b12ea49950c2922
F src/vdbe.h 7e538ecf47dccb307ea2d087c3ddc2dd8d70e79d
F src/vdbeInt.h 9cbaa84f53ddd2d09a0cf61a94337a3a035d08a0
F src/vdbeapi.c 583d56b129dd27f12bed518270de9ebe521e6a75
F src/vdbeInt.h 7738dd1d851856f2003db199d160c573b04ac383f4a3db9461a34efefe995d20
F src/vdbeapi.c 4a2806064657aedd3f3d078e8228e02a8f47cf5e44e884803420eef501fac09d
F src/vdbeaux.c 03591cca98ec50e1493043f0ff7abbece0b9c83d
F src/vdbeblob.c 4f2e8e075d238392df98c5e03a64342465b03f90
F src/vdbemem.c 7bfbeef0978a2e1a05d979641fdbf7c189b7ddf4
@@ -1081,7 +1081,7 @@ F test/trans.test 6e1b4c6a42dba31bd65f8fa5e61a2708e08ddde6
F test/trans2.test 62bd045bfc7a1c14c5ba83ba64d21ade31583f76
F test/trans3.test 91a100e5412b488e22a655fe423a14c26403ab94
F test/transitive1.test 03f532954f46cdf5608f7766bff0b0c52bf2a7cd
F test/trigger1.test dc47573ac79ffe0ee3eecaa517d70d8dacbccd03
F test/trigger1.test ea9624cc1dae05645469df6119fa815f9e6f1e8c
F test/trigger2.test 5cd7d69a7ba1143ee045e4ae2963ff32ae4c87a6
F test/trigger3.test aa640bb2bbb03edd5ff69c055117ea088f121945
F test/trigger4.test 74700b76ebf3947b2f7a92405141eb2cf2a5d359
@@ -1256,10 +1256,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 9c6bf0c1865896c83ca69bf7f2e37735a71ca9a6
R 52ad5aed0a515212a5cae24455eec5a5
T +bgcolor * #d0c0ff
T +sym-release *
T +sym-version-3.8.10.1 *
P 2ef4f3a5b1d1d0c4338f8243d40a2452cc1f7fe4
R 57c9ecc74c17781f7a17d2351db02123
U drh
Z 2f070bdd5b3f9c1cfd8326cf20ed9566
Z af4da6d30db88c66ae1b769ce7b943ef
+1 -1
View File
@@ -1 +1 @@
05b4b1f2a937c06c90db70c09890038f6c98ec40
5a3022e0811e24c9d968527eec447f4c2db6c36757f252601d287d9d1b337c72
+2
View File
@@ -4342,6 +4342,7 @@ int sqlite3_value_bytes16(sqlite3_value*);
double sqlite3_value_double(sqlite3_value*);
int sqlite3_value_int(sqlite3_value*);
sqlite3_int64 sqlite3_value_int64(sqlite3_value*);
void *sqlite3_value_pointer(sqlite3_value*);
const unsigned char *sqlite3_value_text(sqlite3_value*);
const void *sqlite3_value_text16(sqlite3_value*);
const void *sqlite3_value_text16le(sqlite3_value*);
@@ -4621,6 +4622,7 @@ void sqlite3_result_error_code(sqlite3_context*, int);
void sqlite3_result_int(sqlite3_context*, int);
void sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
void sqlite3_result_null(sqlite3_context*);
void sqlite3_result_pointer(sqlite3_context*, void*);
void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
void sqlite3_result_text64(sqlite3_context*, const char*,sqlite3_uint64,
void(*)(void*), unsigned char encoding);
+1
View File
@@ -296,6 +296,7 @@ static void applyAffinity(
if( 0==(pRec->flags&MEM_Str) && (pRec->flags&(MEM_Real|MEM_Int)) ){
sqlite3VdbeMemStringify(pRec, enc, 1);
}
pRec->flags &= ~(MEM_Real|MEM_Int);
}
}
+3 -1
View File
@@ -166,6 +166,7 @@ struct Mem {
double r; /* Real value used when MEM_Real is set in flags */
i64 i; /* Integer value used when MEM_Int is set in flags */
int nZero; /* Used when bit MEM_Zero is set in flags */
void *pPtr; /* Pointer when flags==MEM_Ptr|MEM_Null */
FuncDef *pDef; /* Used only when flags==MEM_Agg */
RowSet *pRowSet; /* Used only when flags==MEM_RowSet */
VdbeFrame *pFrame; /* Used when flags==MEM_Frame */
@@ -216,6 +217,7 @@ struct Mem {
** policy for Mem.z. The MEM_Term flag tells us whether or not the
** string is \000 or \u0000 terminated
*/
#define MEM_Ptr 0x8000 /* u.pPtr is valid if type==SQLITE_NULL */
#define MEM_Term 0x0200 /* String rep is nul terminated */
#define MEM_Dyn 0x0400 /* Need to call Mem.xDel() on Mem.z */
#define MEM_Static 0x0800 /* Mem.z points to a static string */
@@ -231,7 +233,7 @@ struct Mem {
** Clear any existing type flags from a Mem and replace them with f
*/
#define MemSetTypeFlag(p, f) \
((p)->flags = ((p)->flags&~(MEM_TypeMask|MEM_Zero))|f)
((p)->flags = ((p)->flags&~(MEM_TypeMask|MEM_Zero|MEM_Ptr))|f)
/*
** Return true if a memory cell is not marked as invalid. This macro
+12
View File
@@ -156,6 +156,11 @@ int sqlite3_value_int(sqlite3_value *pVal){
sqlite_int64 sqlite3_value_int64(sqlite3_value *pVal){
return sqlite3VdbeIntValue((Mem*)pVal);
}
void *sqlite3_value_pointer(sqlite3_value *pVal){
Mem *p = (Mem*)pVal;
if( (p->flags&(MEM_TypeMask|MEM_Ptr))==(MEM_Null|MEM_Ptr) ) return p->u.pPtr;
return 0;
}
const unsigned char *sqlite3_value_text(sqlite3_value *pVal){
return (const unsigned char *)sqlite3ValueText(pVal, SQLITE_UTF8);
}
@@ -300,6 +305,13 @@ void sqlite3_result_int64(sqlite3_context *pCtx, i64 iVal){
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
sqlite3VdbeMemSetInt64(pCtx->pOut, iVal);
}
void sqlite3_result_pointer(sqlite3_context *pCtx, void *pPtr){
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
sqlite3VdbeMemSetNull(pCtx->pOut);
assert( (pCtx->pOut->flags & (MEM_TypeMask|MEM_Ptr))==MEM_Null );
pCtx->pOut->flags |= MEM_Ptr;
pCtx->pOut->u.pPtr = pPtr;
}
void sqlite3_result_null(sqlite3_context *pCtx){
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
sqlite3VdbeMemSetNull(pCtx->pOut);
+16
View File
@@ -712,4 +712,20 @@ do_test trigger1-16.7 {
}
} {1 {the INDEXED BY clause is not allowed on UPDATE or DELETE statements within triggers}}
#-------------------------------------------------------------------------
# Test that bug [34cd55d68e0e6e7c] has been fixed.
#
do_execsql_test trigger1-17.0 {
CREATE TABLE t17a(ii INT);
CREATE TABLE t17b(tt TEXT PRIMARY KEY, ss);
CREATE TRIGGER t17a_ai AFTER INSERT ON t17a BEGIN
INSERT INTO t17b(tt) VALUES(new.ii);
END;
CREATE TRIGGER t17b_ai AFTER INSERT ON t17b BEGIN
UPDATE t17b SET ss = 4;
END;
INSERT INTO t17a(ii) VALUES('1');
PRAGMA integrity_check;
} {ok}
finish_test