I find a file named test_vfs.c when I run the tcl tests in the source tree.
When I open a wal-file with a sqlite3_file* file descriptor pFile1, it
called sqlite3OsOpen(). The call tree is like the pic below:

sqlite3OsOpen(pFile1)
      |
      |
 pVfs->xOpen ==> tvfsOpen
                                  |
                                  |
                         sqlite3OsOpen(pFile2)
                                  |
                                  |
                          pVfs->xOpen ==> unixOpen(pFile2)

In some tests, test_vfs.c is involved and pVfs->xOpen() will bind to
tvfsOpen() instead of unixOpen() directly. 
And I find the address of pFile has changed to pFile2 when sqlite3OsOpen()
is called in the second time. 
Then unixOpen will initialize pFile2, such as set nFetchOut and some other
member elements in struct unixFile to 0. But the nFetchOut of pFile1 may not
be 0 when sqlite3OsOpen(pFile1) returns.

It makes me confused as I find db will not crash even if all the member
elements of the unixFile is not correct. Could it be said that these
elements will not be used before they are set to a right value?
And what is test_vfs.c for?

I am new bee to sqlite test and vfs. Could anyone explain me it is correct
that the nFetchOut of pFile1 is not 0 when sqlite3OsOpen(pFile1) returns? 

I am really confused. Thanks for any light you can shed. 



--
Sent from: http://sqlite.1065341.n5.nabble.com/
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to