/ Check-in [573770f5]
Login

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

Overview
Comment:Update the spellfix virtual table so that all OOM errors are reported out to the application.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:573770f5a66fa4d708931b30350149eb739da607
User & Date: drh 2012-08-21 17:44:05
Context
2012-08-22
00:39
Modify the MSVC makefile to make it easier to select the heap subsystem to use. check-in: b1dbf490 user: mistachkin tags: trunk
2012-08-21
23:33
Added sqlite3_win32_set_directory API to assist in portability to WinRT. check-in: 600de08d user: mistachkin tags: win32SetDir
17:46
Merge in all the latest trunk changes. check-in: 45cdc32f user: drh tags: threads-sort-ex1
17:44
Update the spellfix virtual table so that all OOM errors are reported out to the application. check-in: 573770f5 user: drh tags: trunk
2012-08-20
17:24
Add the SQLITE_DISABLE_FTS4_DEFERRED compile time option. check-in: e799222f user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/test_spellfix.c.

  2504   2504   
  2505   2505   
  2506   2506   /*
  2507   2507   ** Advance a cursor to its next row of output
  2508   2508   */
  2509   2509   static int spellfix1Next(sqlite3_vtab_cursor *cur){
  2510   2510     spellfix1_cursor *pCur = (spellfix1_cursor *)cur;
         2511  +  int rc = SQLITE_OK;
  2511   2512     if( pCur->iRow < pCur->nRow ){
  2512   2513       if( pCur->pFullScan ){
  2513         -      int rc = sqlite3_step(pCur->pFullScan);
         2514  +      rc = sqlite3_step(pCur->pFullScan);
  2514   2515         if( rc!=SQLITE_ROW ) pCur->iRow = pCur->nRow;
         2516  +      if( rc==SQLITE_ROW || rc==SQLITE_DONE ) rc = SQLITE_OK;
  2515   2517       }else{
  2516   2518         pCur->iRow++;
  2517   2519       }
  2518   2520     }
  2519         -  return SQLITE_OK;
         2521  +  return rc;
  2520   2522   }
  2521   2523   
  2522   2524   /*
  2523   2525   ** Return TRUE if we are at the end-of-file
  2524   2526   */
  2525   2527   static int spellfix1Eof(sqlite3_vtab_cursor *cur){
  2526   2528     spellfix1_cursor *pCur = (spellfix1_cursor *)cur;
................................................................................
  2769   2771     spellfix1Rename,         /* xRename */
  2770   2772   };
  2771   2773   
  2772   2774   /*
  2773   2775   ** Register the various functions and the virtual table.
  2774   2776   */
  2775   2777   static int spellfix1Register(sqlite3 *db){
  2776         -  int nErr = 0;
         2778  +  int rc = SQLITE_OK;
  2777   2779     int i;
  2778         -  nErr += sqlite3_create_function(db, "spellfix1_translit", 1, SQLITE_UTF8, 0,
         2780  +  rc = sqlite3_create_function(db, "spellfix1_translit", 1, SQLITE_UTF8, 0,
  2779   2781                                     transliterateSqlFunc, 0, 0);
  2780         -  nErr += sqlite3_create_function(db, "spellfix1_editdist", 2, SQLITE_UTF8, 0,
         2782  +  if( rc==SQLITE_OK ){
         2783  +    rc = sqlite3_create_function(db, "spellfix1_editdist", 2, SQLITE_UTF8, 0,
  2781   2784                                     editdistSqlFunc, 0, 0);
  2782         -  nErr += sqlite3_create_function(db, "spellfix1_phonehash", 1, SQLITE_UTF8, 0,
         2785  +  }
         2786  +  if( rc==SQLITE_OK ){
         2787  +    rc = sqlite3_create_function(db, "spellfix1_phonehash", 1, SQLITE_UTF8, 0,
  2783   2788                                     phoneticHashSqlFunc, 0, 0);
  2784         -  nErr += sqlite3_create_function(db, "spellfix1_scriptcode", 1, SQLITE_UTF8, 0,
         2789  +  }
         2790  +  if( rc==SQLITE_OK ){
         2791  +    rc = sqlite3_create_function(db, "spellfix1_scriptcode", 1, SQLITE_UTF8, 0,
  2785   2792                                     scriptCodeSqlFunc, 0, 0);
  2786         -  nErr += sqlite3_create_module(db, "spellfix1", &spellfix1Module, 0);
  2787         -  nErr += editDist3Install(db);
         2793  +  }
         2794  +  if( rc==SQLITE_OK ){
         2795  +    rc = sqlite3_create_module(db, "spellfix1", &spellfix1Module, 0);
         2796  +  }
         2797  +  if( rc==SQLITE_OK ){
         2798  +    rc = editDist3Install(db);
         2799  +  }
  2788   2800   
  2789   2801     /* Verify sanity of the translit[] table */
  2790   2802     for(i=0; i<sizeof(translit)/sizeof(translit[0])-1; i++){
  2791   2803       assert( translit[i].cFrom<translit[i+1].cFrom );
  2792   2804     }
  2793   2805   
  2794         -  return nErr ? SQLITE_ERROR : SQLITE_OK;
         2806  +  return rc;
  2795   2807   }
  2796   2808   
  2797   2809   #if SQLITE_CORE || defined(SQLITE_TEST)
  2798   2810   /*
  2799   2811   ** Register the spellfix1 virtual table and its associated functions.
  2800   2812   */
  2801   2813   int sqlite3Spellfix1Register(sqlite3 *db){