1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Initial changes to get FTS5 working with MSVC.

FossilOrigin-Name: ef2052f81e33ca98e85a60f8a78cdd19a7c1c35c
This commit is contained in:
mistachkin
2015-06-26 04:34:36 +00:00
parent 3e65f89ef6
commit ed52f9ff48
10 changed files with 73 additions and 28 deletions

View File

@@ -204,7 +204,7 @@ void sqlite3Fts5BufferSet(int*, Fts5Buffer*, int, const u8*);
void sqlite3Fts5BufferAppendPrintf(int *, Fts5Buffer*, char *zFmt, ...);
void sqlite3Fts5BufferAppend32(int*, Fts5Buffer*, int);
char *sqlite3Fts5Mprintf(int *pRc, char *zFmt, ...);
char *sqlite3Fts5Mprintf(int *pRc, const char *zFmt, ...);
#define fts5BufferZero(x) sqlite3Fts5BufferZero(x)
#define fts5BufferGrow(a,b,c) sqlite3Fts5BufferGrow(a,b,c)

View File

@@ -125,7 +125,7 @@ void sqlite3Fts5BufferAppendPrintf(
}
}
char *sqlite3Fts5Mprintf(int *pRc, char *zFmt, ...){
char *sqlite3Fts5Mprintf(int *pRc, const char *zFmt, ...){
char *zRet = 0;
if( *pRc==SQLITE_OK ){
va_list ap;

View File

@@ -602,7 +602,6 @@ int sqlite3Fts5ConfigDeclareVtab(Fts5Config *pConfig){
int i;
int rc = SQLITE_OK;
char *zSql;
char *zOld;
zSql = sqlite3Fts5Mprintf(&rc, "CREATE TABLE x(");
for(i=0; zSql && i<pConfig->nCol; i++){

View File

@@ -1046,7 +1046,7 @@ static int fts5ExprNodeNext(
case FTS5_OR: {
int i;
int iLast = pNode->iRowid;
i64 iLast = pNode->iRowid;
for(i=0; rc==SQLITE_OK && i<pNode->nChild; i++){
Fts5ExprNode *p1 = pNode->apChild[i];
@@ -1915,7 +1915,7 @@ static void fts5ExprFunction(
sqlite3_result_error_code(pCtx, rc);
}
}
sqlite3_free(azConfig);
sqlite3_free((void *)azConfig);
sqlite3Fts5ConfigFree(pConfig);
sqlite3Fts5ExprFree(pExpr);
}

View File

@@ -3549,15 +3549,15 @@ static void fts5IndexAutomerge(
){
if( p->rc==SQLITE_OK && p->pConfig->nAutomerge>0 ){
Fts5Structure *pStruct = *ppStruct;
i64 nWrite; /* Initial value of write-counter */
u64 nWrite; /* Initial value of write-counter */
int nWork; /* Number of work-quanta to perform */
int nRem; /* Number of leaf pages left to write */
/* Update the write-counter. While doing so, set nWork. */
nWrite = pStruct->nWriteCounter;
nWork = ((nWrite + nLeaf) / p->nWorkUnit) - (nWrite / p->nWorkUnit);
nWork = (int)(((nWrite + nLeaf) / p->nWorkUnit) - (nWrite / p->nWorkUnit));
pStruct->nWriteCounter += nLeaf;
nRem = p->nWorkUnit * nWork * pStruct->nLevel;
nRem = (int)(p->nWorkUnit * nWork * pStruct->nLevel);
fts5IndexMerge(p, ppStruct, nRem);
}
@@ -4552,11 +4552,11 @@ int sqlite3Fts5IndexSetCookie(Fts5Index *p, int iNew){
int rc; /* Return code */
Fts5Config *pConfig = p->pConfig; /* Configuration object */
u8 aCookie[4]; /* Binary representation of iNew */
sqlite3_blob *pBlob = 0;
assert( p->rc==SQLITE_OK );
sqlite3Fts5Put32(aCookie, iNew);
sqlite3_blob *pBlob = 0;
rc = sqlite3_blob_open(pConfig->db, pConfig->zDb, p->zDataTbl,
"block", FTS5_STRUCTURE_ROWID, 1, &pBlob
);

View File

@@ -1387,8 +1387,8 @@ static int fts5UpdateMethod(
rc = sqlite3Fts5StorageDelete(pTab->pStorage, iDel);
}
}else{
assert( nArg>1 );
sqlite3_value *pCmd = apVal[2 + pConfig->nCol];
assert( nArg>1 );
if( SQLITE_NULL!=sqlite3_value_type(pCmd) ){
const char *z = (const char*)sqlite3_value_text(pCmd);
if( pConfig->eContent!=FTS5_CONTENT_NORMAL
@@ -2224,7 +2224,7 @@ static void fts5Fts5Func(
sqlite3_result_blob(pCtx, buf, sizeof(pGlobal), SQLITE_TRANSIENT);
}
#ifdef _WIN32_
#ifdef _WIN32
__declspec(dllexport)
#endif
int sqlite3_fts5_init(

View File

@@ -158,8 +158,10 @@ static int fts5ExecPrintf(
){
int rc;
va_list ap; /* ... printf arguments */
char *zSql;
va_start(ap, zFormat);
char *zSql = sqlite3_vmprintf(zFormat, ap);
zSql = sqlite3_vmprintf(zFormat, ap);
if( zSql==0 ){
rc = SQLITE_NOMEM;