Add the edit_cost_table= command to the spellfix1 virtual table, permitting

the edit distance cost table to be changed at runtime.

FossilOrigin-Name: 89d6368250f9ba2f49e930bbe5524f3da615ce70
This commit is contained in:
drh
2013-02-19 11:51:27 +00:00
parent c8ac0d1649
commit 5cee8a7af5
4 changed files with 59 additions and 11 deletions
+12
View File
@@ -2681,6 +2681,18 @@ static int spellfix1Update(
p->pConfig3 = 0;
return SQLITE_OK;
}
if( memcmp(zCmd,"edit_cost_table=",16)==0 ){
editDist3ConfigDelete(p->pConfig3);
p->pConfig3 = 0;
sqlite3_free(p->zCostTable);
p->zCostTable = spellfix1Dequote(zCmd+16);
if( p->zCostTable==0 ) return SQLITE_NOMEM;
if( p->zCostTable[0]==0 || sqlite3_stricmp(p->zCostTable,"null")==0 ){
sqlite3_free(p->zCostTable);
p->zCostTable = 0;
}
return SQLITE_OK;
}
pVTab->zErrMsg = sqlite3_mprintf("unknown value for %s.command: \"%w\"",
p->zTableName, zCmd);
return SQLITE_ERROR;