2021SC@SDUSC
第八篇到第十一篇讲解了所有sqlite3_file方法的实现。
接下来是Sqlite的OS Interface部分收尾阶段。
首先是定义了win32一些vfs方法的两个向量。
/*该向量定义了对Win 32的sqlite 3_file进行操作的所有方法。*/
static const sqlite3_io_methods winIoMethod = {
3, /* 版本号 */
winClose,
winRead,
winWrite,
winTruncate,
winSync,
winFileSize,
winLock,
winUnlock,
winCheckReservedLock,
winFileControl,
winSectorSize,
winDeviceCharacteristics,
winShmMap,
winShmLock,
winShmBarrier,
winShmUnmap,
winFetch,
winUnfetch
};
/*该向量定义了所有可以对Win 32的sqlite 3_file进行操作而不执行任何锁定的方法。*/
static const sqlite3_io_methods winIoNolockMethod = {
3, /* 版本号 */
winClose,
winRead,
winWrite,
winTruncate,
winSync,
winFileSize,
winNolockLock,
winNolockUnlock,
winNolockCheckReservedLock,
winFileControl,
winSectorSize,
winDeviceCharacteristics,
winShmMap,
winShmLock,
winShmBarrier,
winShmUnmap,
winFetch,
winUnfetch
};
static winVfsAppData winAppData = {
&winIoMethod, /* pMethod */
0, /* pAppData */
0 /* bNoLock */
};