SQLite

Check-in [573770f5a6]
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
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 573770f5a66fa4d708931b30350149eb739da607
User & Date: drh 2012-08-21 17:44:05.685
Context
2012-08-22
00:39
Modify the MSVC makefile to make it easier to select the heap subsystem to use. (check-in: b1dbf49086 user: mistachkin tags: trunk)
2012-08-21
23:33
Added sqlite3_win32_set_directory API to assist in portability to WinRT. (check-in: 600de08d40 user: mistachkin tags: win32SetDir)
17:46
Merge in all the latest trunk changes. (check-in: 45cdc32f1e 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: 573770f5a6 user: drh tags: trunk)
2012-08-20
17:24
Add the SQLITE_DISABLE_FTS4_DEFERRED compile time option. (check-in: e799222f3b user: dan tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/test_spellfix.c.
2504
2505
2506
2507
2508
2509
2510

2511
2512
2513

2514

2515
2516
2517
2518
2519

2520
2521
2522
2523
2524
2525
2526
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513

2514
2515
2516
2517
2518
2519
2520

2521
2522
2523
2524
2525
2526
2527
2528







+


-
+

+




-
+









/*
** Advance a cursor to its next row of output
*/
static int spellfix1Next(sqlite3_vtab_cursor *cur){
  spellfix1_cursor *pCur = (spellfix1_cursor *)cur;
  int rc = SQLITE_OK;
  if( pCur->iRow < pCur->nRow ){
    if( pCur->pFullScan ){
      int rc = sqlite3_step(pCur->pFullScan);
      rc = sqlite3_step(pCur->pFullScan);
      if( rc!=SQLITE_ROW ) pCur->iRow = pCur->nRow;
      if( rc==SQLITE_ROW || rc==SQLITE_DONE ) rc = SQLITE_OK;
    }else{
      pCur->iRow++;
    }
  }
  return SQLITE_OK;
  return rc;
}

/*
** Return TRUE if we are at the end-of-file
*/
static int spellfix1Eof(sqlite3_vtab_cursor *cur){
  spellfix1_cursor *pCur = (spellfix1_cursor *)cur;
2769
2770
2771
2772
2773
2774
2775
2776

2777
2778

2779

2780

2781


2782

2783


2784

2785


2786
2787





2788
2789
2790
2791
2792
2793
2794

2795
2796
2797
2798
2799
2800
2801
2771
2772
2773
2774
2775
2776
2777

2778
2779

2780
2781
2782

2783
2784
2785
2786

2787
2788
2789
2790

2791
2792
2793
2794


2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805

2806
2807
2808
2809
2810
2811
2812
2813







-
+

-
+

+
-
+

+
+
-
+

+
+
-
+

+
+
-
-
+
+
+
+
+






-
+







  spellfix1Rename,         /* xRename */
};

/*
** Register the various functions and the virtual table.
*/
static int spellfix1Register(sqlite3 *db){
  int nErr = 0;
  int rc = SQLITE_OK;
  int i;
  nErr += sqlite3_create_function(db, "spellfix1_translit", 1, SQLITE_UTF8, 0,
  rc = sqlite3_create_function(db, "spellfix1_translit", 1, SQLITE_UTF8, 0,
                                  transliterateSqlFunc, 0, 0);
  if( rc==SQLITE_OK ){
  nErr += sqlite3_create_function(db, "spellfix1_editdist", 2, SQLITE_UTF8, 0,
    rc = sqlite3_create_function(db, "spellfix1_editdist", 2, SQLITE_UTF8, 0,
                                  editdistSqlFunc, 0, 0);
  }
  if( rc==SQLITE_OK ){
  nErr += sqlite3_create_function(db, "spellfix1_phonehash", 1, SQLITE_UTF8, 0,
    rc = sqlite3_create_function(db, "spellfix1_phonehash", 1, SQLITE_UTF8, 0,
                                  phoneticHashSqlFunc, 0, 0);
  }
  if( rc==SQLITE_OK ){
  nErr += sqlite3_create_function(db, "spellfix1_scriptcode", 1, SQLITE_UTF8, 0,
    rc = sqlite3_create_function(db, "spellfix1_scriptcode", 1, SQLITE_UTF8, 0,
                                  scriptCodeSqlFunc, 0, 0);
  }
  if( rc==SQLITE_OK ){
  nErr += sqlite3_create_module(db, "spellfix1", &spellfix1Module, 0);
  nErr += editDist3Install(db);
    rc = sqlite3_create_module(db, "spellfix1", &spellfix1Module, 0);
  }
  if( rc==SQLITE_OK ){
    rc = editDist3Install(db);
  }

  /* Verify sanity of the translit[] table */
  for(i=0; i<sizeof(translit)/sizeof(translit[0])-1; i++){
    assert( translit[i].cFrom<translit[i+1].cFrom );
  }

  return nErr ? SQLITE_ERROR : SQLITE_OK;
  return rc;
}

#if SQLITE_CORE || defined(SQLITE_TEST)
/*
** Register the spellfix1 virtual table and its associated functions.
*/
int sqlite3Spellfix1Register(sqlite3 *db){