1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Allow R-Tree geometry functions to take 8-byte BLOB arguments which are

passed directly through to the underlying callback, and which can be used
to pass pointers into the callback.

FossilOrigin-Name: b271ed56532a78323accc8a7cb348d55f95c350e
This commit is contained in:
drh
2015-05-19 22:20:48 +00:00
parent dde548cb16
commit 856d446efe
3 changed files with 17 additions and 10 deletions

View File

@ -3401,11 +3401,18 @@ static void geomCallback(sqlite3_context *ctx, int nArg, sqlite3_value **aArg){
pBlob->cb = pGeomCtx[0];
pBlob->nParam = nArg;
for(i=0; i<nArg; i++){
if( sqlite3_value_type(aArg[i])==SQLITE_BLOB
&& sqlite3_value_bytes(aArg[i])==sizeof(sqlite3_rtree_dbl)
){
memcpy(&pBlob->aParam[i], sqlite3_value_blob(aArg[i]),
sizeof(sqlite3_rtree_dbl));
}else{
#ifdef SQLITE_RTREE_INT_ONLY
pBlob->aParam[i] = sqlite3_value_int64(aArg[i]);
pBlob->aParam[i] = sqlite3_value_int64(aArg[i]);
#else
pBlob->aParam[i] = sqlite3_value_double(aArg[i]);
pBlob->aParam[i] = sqlite3_value_double(aArg[i]);
#endif
}
}
sqlite3_result_blob(ctx, pBlob, nBlob, sqlite3_free);
}