Open the database with `SQLITE_OPEN_CREATE`. 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 `src/os_win.c`. Search for ` Begin file os_win.c` in sqlite3.c to find that code.