现在只记录了使用文件系统的解析,后续添加使用mem的解析
/*
* [CAPIREF: unqlite_kv_fetch()]
* Please refer to the official documentation for function purpose and expected parameters.
*/
int unqlite_kv_fetch(unqlite *pDb,const void *pKey,int nKeyLen,void *pBuf,unqlite_int64 *pBufLen)
{
...
/* Seek to the record position */
rc = pMethods->xSeek(pCur,pKey,nKeyLen,UNQLITE_CURSOR_MATCH_EXACT);
}
if( rc == UNQLITE_OK ){
if( pBuf == 0 ){
/* Data length only */
rc = pMethods->xDataLength(pCur,pBufLen);
}else{
SyBlob sBlob;
/* Initialize the data consumer */
SyBlobInitFromBuf(&sBlob,pBuf,(sxu32)*pBufLen);
/* Consume the data */
rc = pMethods->xData(pCur,unqliteDataConsumer,&sBlob);
/* Data length */
*pBufLen = (unqlite_int64)SyBlobLength(&sBlob