Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Merge all changes from branch-3.20. Improvements to the fts5() extension interface. Work around a gcc/valgrind bug in the sqlite3_value_pointer() interface. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
e0aca7d2c60d9859750a6e98d3e3b87f |
User & Date: | drh 2017-07-17 18:45:23.910 |
Context
2017-07-18
| ||
14:41 | Change the default command-line shell history depth to 2000 lines. (check-in: 0b69aa7e37 user: drh tags: trunk) | |
2017-07-17
| ||
20:21 | Merge all the latest fixes and enhancements from trunk. (check-in: e181225dc7 user: drh tags: apple-osx) | |
18:45 | Merge all changes from branch-3.20. Improvements to the fts5() extension interface. Work around a gcc/valgrind bug in the sqlite3_value_pointer() interface. (check-in: e0aca7d2c6 user: drh tags: trunk) | |
17:46 | Interchange to branches within an "if" statement in sqlite3_value_pointer() in order to work around a bug in gcc. (Closed-Leaf check-in: 8a606e4aba user: drh tags: branch-3.20) | |
13:37 | Merge the pointer-type enhancement from the 3.20 branch. (check-in: 9e8e1c4aa1 user: drh tags: trunk) | |
Changes
Changes to ext/fts5/fts5_main.c.
︙ | ︙ | |||
2605 2606 2607 2608 2609 2610 2611 | sqlite3_free(pGlobal); } static void fts5Fts5Func( sqlite3_context *pCtx, /* Function call context */ int nArg, /* Number of args */ | | | | | | | < | 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 | sqlite3_free(pGlobal); } static void fts5Fts5Func( sqlite3_context *pCtx, /* Function call context */ int nArg, /* Number of args */ sqlite3_value **apArg /* Function arguments */ ){ Fts5Global *pGlobal = (Fts5Global*)sqlite3_user_data(pCtx); fts5_api **ppApi; UNUSED_PARAM(nArg); assert( nArg==1 ); ppApi = (fts5_api**)sqlite3_value_pointer(apArg[0], "fts5_api_ptr"); if( ppApi ) *ppApi = &pGlobal->api; } /* ** Implementation of fts5_source_id() function. */ static void fts5SourceIdFunc( sqlite3_context *pCtx, /* Function call context */ |
︙ | ︙ | |||
2678 2679 2680 2681 2682 2683 2684 | if( rc==SQLITE_OK ) rc = sqlite3Fts5IndexInit(db); if( rc==SQLITE_OK ) rc = sqlite3Fts5ExprInit(pGlobal, db); if( rc==SQLITE_OK ) rc = sqlite3Fts5AuxInit(&pGlobal->api); if( rc==SQLITE_OK ) rc = sqlite3Fts5TokenizerInit(&pGlobal->api); if( rc==SQLITE_OK ) rc = sqlite3Fts5VocabInit(pGlobal, db); if( rc==SQLITE_OK ){ rc = sqlite3_create_function( | | | 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 | if( rc==SQLITE_OK ) rc = sqlite3Fts5IndexInit(db); if( rc==SQLITE_OK ) rc = sqlite3Fts5ExprInit(pGlobal, db); if( rc==SQLITE_OK ) rc = sqlite3Fts5AuxInit(&pGlobal->api); if( rc==SQLITE_OK ) rc = sqlite3Fts5TokenizerInit(&pGlobal->api); if( rc==SQLITE_OK ) rc = sqlite3Fts5VocabInit(pGlobal, db); if( rc==SQLITE_OK ){ rc = sqlite3_create_function( db, "fts5", 1, SQLITE_UTF8, p, fts5Fts5Func, 0, 0 ); } if( rc==SQLITE_OK ){ rc = sqlite3_create_function( db, "fts5_source_id", 0, SQLITE_UTF8, p, fts5SourceIdFunc, 0, 0 ); } |
︙ | ︙ |
Changes to ext/fts5/fts5_tcl.c.
︙ | ︙ | |||
95 96 97 98 99 100 101 | int rc = f5tDbPointer(interp, pObj, &db); if( rc!=TCL_OK ){ return TCL_ERROR; }else{ sqlite3_stmt *pStmt = 0; fts5_api *pApi = 0; | | | | < < < | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | int rc = f5tDbPointer(interp, pObj, &db); if( rc!=TCL_OK ){ return TCL_ERROR; }else{ sqlite3_stmt *pStmt = 0; fts5_api *pApi = 0; rc = sqlite3_prepare_v2(db, "SELECT fts5(?1)", -1, &pStmt, 0); if( rc!=SQLITE_OK ){ Tcl_AppendResult(interp, "error: ", sqlite3_errmsg(db), 0); return TCL_ERROR; } sqlite3_bind_pointer(pStmt, 1, (void*)&pApi, "fts5_api_ptr"); sqlite3_step(pStmt); if( sqlite3_finalize(pStmt)!=SQLITE_OK ){ Tcl_AppendResult(interp, "error: ", sqlite3_errmsg(db), 0); return TCL_ERROR; } *ppDb = db; |
︙ | ︙ |
Changes to ext/fts5/fts5_test_mi.c.
︙ | ︙ | |||
69 70 71 72 73 74 75 | ** handle (accessible using sqlite3_errcode()/errmsg()). */ static int fts5_api_from_db(sqlite3 *db, fts5_api **ppApi){ sqlite3_stmt *pStmt = 0; int rc; *ppApi = 0; | | > | < < < < | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | ** handle (accessible using sqlite3_errcode()/errmsg()). */ static int fts5_api_from_db(sqlite3 *db, fts5_api **ppApi){ sqlite3_stmt *pStmt = 0; int rc; *ppApi = 0; rc = sqlite3_prepare(db, "SELECT fts5(?1)", -1, &pStmt, 0); if( rc==SQLITE_OK ){ sqlite3_bind_pointer(pStmt, 1, (void*)ppApi, "fts5_api_ptr"); (void)sqlite3_step(pStmt); rc = sqlite3_finalize(pStmt); } return rc; } |
︙ | ︙ | |||
418 419 420 421 422 423 424 | /* Register the implementation of matchinfo() */ rc = pApi->xCreateFunction(pApi, "matchinfo", 0, fts5MatchinfoFunc, 0); return rc; } #endif /* SQLITE_ENABLE_FTS5 */ | < | 415 416 417 418 419 420 421 | /* Register the implementation of matchinfo() */ rc = pApi->xCreateFunction(pApi, "matchinfo", 0, fts5MatchinfoFunc, 0); return rc; } #endif /* SQLITE_ENABLE_FTS5 */ |
Changes to ext/fts5/test/fts5matchinfo.test.
︙ | ︙ | |||
468 469 470 471 472 473 474 | } ;# foreach_detail_mode #------------------------------------------------------------------------- # Test that a bad fts5() return is detected # reset_db proc xyz {} {} | | | 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 | } ;# foreach_detail_mode #------------------------------------------------------------------------- # Test that a bad fts5() return is detected # reset_db proc xyz {} {} db func fts5 -argcount 1 xyz do_test 13.1 { list [catch { sqlite3_fts5_register_matchinfo db } msg] $msg } {1 SQLITE_ERROR} #------------------------------------------------------------------------- # Test that an invalid matchinfo() flag is detected # |
︙ | ︙ |
Changes to src/vdbeapi.c.
︙ | ︙ | |||
198 199 200 201 202 203 204 | unsigned int sqlite3_value_subtype(sqlite3_value *pVal){ Mem *pMem = (Mem*)pVal; return ((pMem->flags & MEM_Subtype) ? pMem->eSubtype : 0); } void *sqlite3_value_pointer(sqlite3_value *pVal, const char *zPType){ Mem *p = (Mem*)pVal; if( p->flags==(MEM_Null|MEM_Subtype|MEM_Term|MEM_Static) | < > | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | unsigned int sqlite3_value_subtype(sqlite3_value *pVal){ Mem *pMem = (Mem*)pVal; return ((pMem->flags & MEM_Subtype) ? pMem->eSubtype : 0); } void *sqlite3_value_pointer(sqlite3_value *pVal, const char *zPType){ Mem *p = (Mem*)pVal; if( p->flags==(MEM_Null|MEM_Subtype|MEM_Term|MEM_Static) && zPType!=0 && p->eSubtype=='p' && strcmp(p->z, zPType)==0 ){ return p->u.pPtr; }else{ return 0; } } |
︙ | ︙ |