On 29 Jun 2012, at 11:57am, Dennis Volodomanov <i...@psunrise.com> wrote:
> What I found is that after I delete the database file (using Windows explorer > or from the command-line, doesn't matter - this is all on Windows 7 x64) and > then let my application re-create it as normal, it already contains some > entries! Your app or the shell tool is running while you delete the file, or do you quit, delete, then restart them ? When you specify the database file to open are you specifying a full path, from the 'C:\' on down, or are you relying on some default folder being specified by something ? The usual trick is that your application is opening a database from one folder, the shell tool is opening the database from another folder, and the one you're deleting is one or none of them. Make sure everything specifies the full path, just until you've figured out this problem. > It's like the file is not created from scratch, but rather pulled from some > Windows cache, but only parts of it (doesn't make sense, as the integrity > check succeeds). So, the file would have all the proper tables, but the .dump > command in sqlite's utility would should an INSERT that's impossible to > happen as well mid-way through creating tables. I have table creation > surrounded by an explicit transaction and it happens before anything else can > happen and I've triple-stepped through my code just to make sure I'm not > crazy :) Possibly, this weird (can't say corrupt, just weird) file is what's > causing the strange SELECTs. > > As a test, I've renamed the db inside my application, so that it's not > re-using the filename all the time and this time the .dump showed all the > correct CREATE TABLE statements, without any rubbish in between. It's probably best to start off by assuming that the SQLite shell tool does exactly what it's documented to do 100% of the time. There are thousands of users of it out there and a bug like you describe would have been reported to this list many times by now. You should be able to use a database file as a messaging system. Put a row in it using the shell tool, then read it out using your app and make sure it has the right value. Then put a row in it using your app and read it out using the shell tool. If that's not working, they're opening different files, your app is buggy, or you have a hardware failure of some sort. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users