Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix bug in spellfix1 xUpdate() method introduced by the previous commit. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | spellfix-matchlen |
Files: | files | file ages | folders |
SHA1: |
b31aafa5a3b753b76a3c276503c17e94 |
User & Date: | dan 2012-07-13 11:09:41.901 |
Context
2012-07-13
| ||
11:09 | Fix bug in spellfix1 xUpdate() method introduced by the previous commit. (Closed-Leaf check-in: b31aafa5a3 user: dan tags: spellfix-matchlen) | |
2012-07-12
| ||
19:43 | Add the "matchlen" column to the spellfix virtual table. (check-in: 4a582c4d30 user: dan tags: spellfix-matchlen) | |
Changes
Changes to src/test_spellfix.c.
︙ | ︙ | |||
313 314 315 316 317 318 319 320 321 322 323 324 325 326 | #define CCLASS_M 7 #define CCLASS_W 8 #define CCLASS_Y 9 #define CCLASS_DIGIT 10 #define CCLASS_SPACE 11 #define CCLASS_OTHER 12 /* ** The following table gives the character class for non-initial ASCII ** characters. */ static const unsigned char midClass[] = { /* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xa xb xc xd xe xf */ /* 0x */ 12, 12, 12, 12, 12, 12, 12, 12, 12, 11, 11, 12, 11, 12, 12, 12, | > > > > > > > > > > > > > | 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | #define CCLASS_M 7 #define CCLASS_W 8 #define CCLASS_Y 9 #define CCLASS_DIGIT 10 #define CCLASS_SPACE 11 #define CCLASS_OTHER 12 /* Columns in spellfix1 virtual tables. */ #define COLUMN_WORD 0 #define COLUMN_RANK 1 #define COLUMN_DISTANCE 2 #define COLUMN_LANGID 3 #define COLUMN_SCORE 4 #define COLUMN_MATCHLEN 5 #define COLUMN_TOP 6 #define COLUMN_SCOPE 7 #define COLUMN_SRCHCNT 8 #define COLUMN_SOUNDSLIKE 9 /* ** The following table gives the character class for non-initial ASCII ** characters. */ static const unsigned char midClass[] = { /* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xa xb xc xd xe xf */ /* 0x */ 12, 12, 12, 12, 12, 12, 12, 12, 12, 11, 11, 12, 11, 12, 12, 12, |
︙ | ︙ | |||
1795 1796 1797 1798 1799 1800 1801 | /* ** Return columns from the current row. */ static int spellfix1Column(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i){ spellfix1_cursor *pCur = (spellfix1_cursor*)cur; switch( i ){ | | | | | | | | | | | 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 | /* ** Return columns from the current row. */ static int spellfix1Column(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i){ spellfix1_cursor *pCur = (spellfix1_cursor*)cur; switch( i ){ case COLUMN_WORD: { sqlite3_result_text(ctx, pCur->a[pCur->iRow].zWord, -1, SQLITE_STATIC); break; } case COLUMN_RANK: { sqlite3_result_int(ctx, pCur->a[pCur->iRow].iRank); break; } case COLUMN_DISTANCE: { sqlite3_result_int(ctx, pCur->a[pCur->iRow].iDistance); break; } case COLUMN_LANGID: { sqlite3_result_int(ctx, pCur->iLang); break; } case COLUMN_SCORE: { sqlite3_result_int(ctx, pCur->a[pCur->iRow].iScore); break; } case COLUMN_MATCHLEN: { sqlite3_result_int(ctx, pCur->a[pCur->iRow].iMatchlen); break; } case COLUMN_TOP: { sqlite3_result_int(ctx, pCur->iTop); break; } case COLUMN_SCOPE: { sqlite3_result_int(ctx, pCur->iScope); break; } case COLUMN_SRCHCNT: { sqlite3_result_int(ctx, pCur->nSearch); break; } default: { sqlite3_result_null(ctx); break; } |
︙ | ︙ | |||
1869 1870 1871 1872 1873 1874 1875 | if( argc==1 ){ /* A delete operation on the rowid given by argv[0] */ rowid = *pRowid = sqlite3_value_int64(argv[0]); spellfix1DbExec(&rc, db, "DELETE FROM \"%w\".\"%w_vocab\" " " WHERE id=%lld", p->zDbName, p->zTableName, rowid); }else{ | | | | | | | > > > | 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 | if( argc==1 ){ /* A delete operation on the rowid given by argv[0] */ rowid = *pRowid = sqlite3_value_int64(argv[0]); spellfix1DbExec(&rc, db, "DELETE FROM \"%w\".\"%w_vocab\" " " WHERE id=%lld", p->zDbName, p->zTableName, rowid); }else{ const unsigned char *zWord = sqlite3_value_text(argv[2+COLUMN_WORD]); int nWord = sqlite3_value_bytes(argv[2+COLUMN_WORD]); int iLang = sqlite3_value_int(argv[2+COLUMN_LANGID]); int iRank = sqlite3_value_int(argv[2+COLUMN_RANK]); const unsigned char *zSoundslike; int nSoundslike; char *zK1, *zK2; int i; char c; zSoundslike = sqlite3_value_text(argv[2+COLUMN_SOUNDSLIKE]); nSoundslike = sqlite3_value_bytes(argv[2+COLUMN_SOUNDSLIKE]); if( zWord==0 ){ pVTab->zErrMsg = sqlite3_mprintf("%w.word may not be NULL", p->zTableName); return SQLITE_CONSTRAINT; } if( iRank<1 ) iRank = 1; if( zSoundslike ){ |
︙ | ︙ |