Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Changes to the TCL interface header to allow it to be compiled independently from the amalgamation. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
58113932d93926b4aa037a7487105a55 |
User & Date: | drh 2009-12-01 13:57:49.000 |
Context
2009-12-01
| ||
14:31 | Reorder function declarations in mutex_os2.c. This is a blind change - we have no capability of testing on OS/2. Ticket [97214a34d814] (check-in: c40e4ef094 user: drh tags: trunk) | |
13:57 | Changes to the TCL interface header to allow it to be compiled independently from the amalgamation. (check-in: 58113932d9 user: drh tags: trunk) | |
13:48 | Open a savepoint within the FTS3 optimize() function. (check-in: 4924fbb244 user: dan tags: trunk) | |
Changes
Changes to ext/fts3/fts3.c.
︙ | ︙ | |||
470 471 472 473 474 475 476 | *pp = 0; }else{ fts3GetDeltaVarint(pp, pVal); } } | < < < < < < < | 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | *pp = 0; }else{ fts3GetDeltaVarint(pp, pVal); } } static Fts3Table *cursor_vtab(Fts3Cursor *c){ return (Fts3Table *) c->base.pVtab; } /* ** The xDisconnect() virtual table method. */ |
︙ | ︙ | |||
1823 1824 1825 1826 1827 1828 1829 | if( !zSql ){ rc = SQLITE_NOMEM; }else{ rc = sqlite3_prepare_v2(p->db, zSql, -1, &pCsr->pStmt, 0); sqlite3_free(zSql); } if( rc!=SQLITE_OK ) return rc; | | | 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 | if( !zSql ){ rc = SQLITE_NOMEM; }else{ rc = sqlite3_prepare_v2(p->db, zSql, -1, &pCsr->pStmt, 0); sqlite3_free(zSql); } if( rc!=SQLITE_OK ) return rc; pCsr->eSearch = idxNum; if( idxNum==FTS3_DOCID_SEARCH ){ rc = sqlite3_bind_value(pCsr->pStmt, 1, apVal[0]); }else if( idxNum!=FTS3_FULLSCAN_SEARCH ){ int iCol = idxNum-FTS3_FULLTEXT_SEARCH; const char *zQuery = (const char *)sqlite3_value_text(apVal[0]); |
︙ | ︙ |
Changes to ext/fts3/fts3Int.h.
︙ | ︙ | |||
77 78 79 80 81 82 83 | ** arguments. */ struct Fts3Table { sqlite3_vtab base; /* Base class used by SQLite core */ sqlite3 *db; /* The database connection */ const char *zDb; /* logical database name */ const char *zName; /* virtual table name */ | | | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | ** arguments. */ struct Fts3Table { sqlite3_vtab base; /* Base class used by SQLite core */ sqlite3 *db; /* The database connection */ const char *zDb; /* logical database name */ const char *zName; /* virtual table name */ int nColumn; /* number of named columns in virtual table */ char **azColumn; /* column names. malloced */ sqlite3_tokenizer *pTokenizer; /* tokenizer for inserts and queries */ /* Precompiled statements used by the implementation. Each of these ** statements is run and reset within a single virtual table API call. */ sqlite3_stmt *aStmt[18]; |
︙ | ︙ | |||
116 117 118 119 120 121 122 | /* ** When the core wants to read from the virtual table, it creates a ** virtual table cursor (an instance of the following structure) using ** the xOpen method. Cursors are destroyed using the xClose method. */ struct Fts3Cursor { sqlite3_vtab_cursor base; /* Base class used by SQLite core */ | | < | | > > > > > > > > > > > > > > > > > > > > | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | /* ** When the core wants to read from the virtual table, it creates a ** virtual table cursor (an instance of the following structure) using ** the xOpen method. Cursors are destroyed using the xClose method. */ struct Fts3Cursor { sqlite3_vtab_cursor base; /* Base class used by SQLite core */ i16 eSearch; /* Search strategy (see below) */ u8 isEof; /* True if at End Of Results */ u8 isRequireSeek; /* True if must seek pStmt to %_content row */ sqlite3_stmt *pStmt; /* Prepared statement in use by the cursor */ Fts3Expr *pExpr; /* Parsed MATCH query string */ sqlite3_int64 iPrevId; /* Previous id read from aDoclist */ char *pNextId; /* Pointer into the body of aDoclist */ char *aDoclist; /* List of docids for full-text queries */ int nDoclist; /* Size of buffer at aDoclist */ }; /* ** The Fts3Cursor.eSearch member is always set to one of the following. ** Actualy, Fts3Cursor.eSearch can be greater than or equal to ** FTS3_FULLTEXT_SEARCH. If so, then Fts3Cursor.eSearch - 2 is the index ** of the column to be searched. For example, in ** ** CREATE VIRTUAL TABLE ex1 USING fts3(a,b,c,d); ** SELECT docid FROM ex1 WHERE b MATCH 'one two three'; ** ** Because the LHS of the MATCH operator is 2nd column "b", ** Fts3Cursor.eSearch will be set to FTS3_FULLTEXT_SEARCH+1. (+0 for a, ** +1 for b, +2 for c, +3 for d.) If the LHS of MATCH were "ex1" ** indicating that all columns should be searched, ** then eSearch would be set to FTS3_FULLTEXT_SEARCH+4. */ #define FTS3_FULLSCAN_SEARCH 0 /* Linear scan of %_content table */ #define FTS3_DOCID_SEARCH 1 /* Lookup by rowid on %_content table */ #define FTS3_FULLTEXT_SEARCH 2 /* Full-text index search */ /* ** A "phrase" is a sequence of one or more tokens that must match in ** sequence. A single token is the base case and the most common case. ** For a sequence of tokens contained in "...", nToken will be the number ** of tokens in the string. */ struct Fts3Phrase { |
︙ | ︙ |
Changes to ext/fts3/fts3_snippet.c.
︙ | ︙ | |||
25 26 27 28 29 30 31 32 33 34 | ** matching-word offset information and snippets. */ struct Snippet { int nMatch; /* Total number of matches */ int nAlloc; /* Space allocated for aMatch[] */ struct snippetMatch { /* One entry for each matching term */ char snStatus; /* Status flag for use while constructing snippets */ short int iCol; /* The column that contains the match */ short int iTerm; /* The index in Query.pTerms[] of the matching term */ int iToken; /* The index of the matching document token */ | > < | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | ** matching-word offset information and snippets. */ struct Snippet { int nMatch; /* Total number of matches */ int nAlloc; /* Space allocated for aMatch[] */ struct snippetMatch { /* One entry for each matching term */ char snStatus; /* Status flag for use while constructing snippets */ short int nByte; /* Number of bytes in the term */ short int iCol; /* The column that contains the match */ short int iTerm; /* The index in Query.pTerms[] of the matching term */ int iToken; /* The index of the matching document token */ int iStart; /* The offset to the first character of the term */ } *aMatch; /* Points to space obtained from malloc */ char *zOffset; /* Text rendering of aMatch[] */ int nOffset; /* strlen(zOffset) */ char *zSnippet; /* Snippet text */ int nSnippet; /* strlen(zSnippet) */ }; |
︙ | ︙ | |||
437 438 439 440 441 442 443 | } /* ** Compute all offsets for the current row of the query. ** If the offsets have already been computed, this routine is a no-op. */ static int snippetAllOffsets(Fts3Cursor *pCsr, Snippet **ppSnippet){ | | | | > | > | | 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | } /* ** Compute all offsets for the current row of the query. ** If the offsets have already been computed, this routine is a no-op. */ static int snippetAllOffsets(Fts3Cursor *pCsr, Snippet **ppSnippet){ Fts3Table *p = (Fts3Table *)pCsr->base.pVtab; /* The FTS3 virtual table */ int nColumn; /* Number of columns. Docid does count */ int iColumn; /* Index of of a column */ int i; /* Loop index */ int iFirst; /* First column to search */ int iLast; /* Last coumn to search */ int iTerm = 0; Snippet *pSnippet; int rc = SQLITE_OK; if( pCsr->pExpr==0 ){ return SQLITE_OK; } pSnippet = (Snippet *)sqlite3_malloc(sizeof(Snippet)); *ppSnippet = pSnippet; if( !pSnippet ){ return SQLITE_NOMEM; } memset(pSnippet, 0, sizeof(Snippet)); nColumn = p->nColumn; iColumn = (pCsr->eSearch - 2); if( iColumn<0 || iColumn>=nColumn ){ /* Look for matches over all columns of the full-text index */ iFirst = 0; iLast = nColumn-1; }else{ /* Look for matches in the iColumn-th column of the index only */ iFirst = iColumn; |
︙ | ︙ |
Changes to src/tclsqlite.c.
︙ | ︙ | |||
29 30 31 32 33 34 35 | #include <errno.h> /* ** Some additional include files are needed if this file is not ** appended to the amalgamation. */ #ifndef SQLITE_AMALGAMATION | | > | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | #include <errno.h> /* ** Some additional include files are needed if this file is not ** appended to the amalgamation. */ #ifndef SQLITE_AMALGAMATION # include "sqlite3.h" # include <stdlib.h> # include <string.h> # include <assert.h> typedef unsigned char u8; #endif #include <ctype.h> /* * Windows needs to know which symbols to export. Unix does not. * BUILD_sqlite should be undefined for Unix. */ |
︙ | ︙ |