SQLite

Check-in [9cd64ce453]
Login

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

Overview
Comment:Fix a problem causing a crash if an fts5vocab table was created to query an fts3/4 FTS index.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9cd64ce453e4435d80117b8610c22a0a4b53cd6e84b39815e70e684f6b0295c8
User & Date: dan 2019-01-14 15:35:15.573
Context
2019-01-14
16:16
Add the "prefixes" table-valued function in the ext/misc folder. (check-in: f0fd2163fc user: drh tags: trunk)
15:35
Fix a problem causing a crash if an fts5vocab table was created to query an fts3/4 FTS index. (check-in: 9cd64ce453 user: dan tags: trunk)
15:09
Fix a problem with querying a corrupt fts3 database. (check-in: 65e50706a0 user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to ext/fts5/fts5_main.c.
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249

2250
2251

2252
2253
2254
2255
2256
2257
2258
2259
2260
*/
Fts5Index *sqlite3Fts5IndexFromCsrid(
  Fts5Global *pGlobal,            /* FTS5 global context for db handle */
  i64 iCsrId,                     /* Id of cursor to find */
  Fts5Config **ppConfig           /* OUT: Configuration object */
){
  Fts5Cursor *pCsr;
  Fts5Table *pTab;

  pCsr = fts5CursorFromCsrid(pGlobal, iCsrId);

  pTab = (Fts5Table*)pCsr->base.pVtab;
  *ppConfig = pTab->pConfig;


  return pTab->pIndex;
}

/*
** Return a "position-list blob" corresponding to the current position of
** cursor pCsr via sqlite3_result_blob(). A position-list blob contains
** the current position-list for each phrase in the query associated with
** cursor pCsr.







<
<

>
|
|
>
|
|







2240
2241
2242
2243
2244
2245
2246


2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
*/
Fts5Index *sqlite3Fts5IndexFromCsrid(
  Fts5Global *pGlobal,            /* FTS5 global context for db handle */
  i64 iCsrId,                     /* Id of cursor to find */
  Fts5Config **ppConfig           /* OUT: Configuration object */
){
  Fts5Cursor *pCsr;


  pCsr = fts5CursorFromCsrid(pGlobal, iCsrId);
  if( pCsr ){
    Fts5Table *pTab = (Fts5Table*)pCsr->base.pVtab;
    *ppConfig = pTab->pConfig;
    return pTab->pIndex;
  }
  return 0;
}

/*
** Return a "position-list blob" corresponding to the current position of
** cursor pCsr via sqlite3_result_blob(). A position-list blob contains
** the current position-list for each phrase in the query associated with
** cursor pCsr.
Changes to ext/fts5/test/fts5vocab2.test.
197
198
199
200
201
202
203
































204
205
  three 2 {} {}
}

do_execsql_test 3.5 {
  DELETE FROM t1;
  SELECT * FROM v1;
} {}

































finish_test







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


197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
  three 2 {} {}
}

do_execsql_test 3.5 {
  DELETE FROM t1;
  SELECT * FROM v1;
} {}

#-------------------------------------------------------------------------
#
reset_db
do_execsql_test 4.0 {
  CREATE VIRTUAL TABLE v1 USING fts5vocab(nosuchtable, col);
}

do_catchsql_test 4.1 {
  SELECT * FROM v1 WHERE term=='nosuchterm';
} {1 {no such fts5 table: main.nosuchtable}}

do_execsql_test 4.2.1 {
  CREATE TABLE nosuchtable(nosuchtable, y, z);
}
do_catchsql_test 4.2.2 {
  SELECT * FROM v1 WHERE term=='nosuchterm';
} {1 {no such fts5 table: main.nosuchtable}}

ifcapable fts3 {
  do_execsql_test 4.3.1 {
    DROP TABLE nosuchtable;
    CREATE VIRTUAL TABLE nosuchtable USING fts3(a, b);
  } {}
  do_catchsql_test 4.3.2 {
    SELECT * FROM v1 WHERE term=='nosuchterm';
  } {1 {no such fts5 table: main.nosuchtable}}
  do_catchsql_test 4.3.3 {
    INSERT INTO nosuchtable VALUES('id', '*id');
    SELECT * FROM v1 WHERE term=='nosuchterm';
  } {1 {no such fts5 table: main.nosuchtable}}
}

finish_test