Place in the code where can understand that the file was created
Hello! Tell me, in which line of the source code of the sqlite3.c file, you can clearly understand that a new database file has been created int res = sqlite3_open_v2( “D:\\MyNewDB.db”, /* Database filename (UTF-8) */ &db_handle, /* OUT: SQLite db handle */ SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE|SQLITE_OPEN_FULLMUTEX, /* Flags */ NULL /* Name of VFS module to use */ ); Prompt the line number or a piece of code from sqlite3.c where i can clearly understand that the non-existent file “D:\\MyNewDB.db” was created. And if the database was created it was also clear
If I understand previous comments here correctly, SQLite doesn't do any file access until it needs to. For example, if you do
sqlite3_open_v2() and then
sqlite3_close_v2(), no file access is done. This would suggest that
sqlite3_open_v2() by itself would not create a database file.
It's possible that this was behaviour for
sqlite3_open_v2() does something different. But it might be worth a test.
If you want to know whether a file of a particularly path/name exists, I think you're expected to use a file system call.
Open the database with
If it returns an error, the file already existed.
The details are handled in the VFS module for your operating system, in your case probably
Begin file os_win.c in sqlite3.c to find that code.
Look for the code around the string 'Only allow sensible combinations" in sqlite3.c, it does not consider SQLITE_OPEN_CREATE without an accompanying SQLITE_OPEN_READWRITE to be a sensible combination. This check is in the common open function before the VFS gets involved.