Xojo Web Edition
I want to provide a facility for user to restore a database from an earlier backup.
I am following this process…
- select old backup file (FolderItem is olddb)
- close current db connection (db.close)
- delete current file (db.databasefile.delete)
- replace current with old (olddb.CopyFileTo db.databasefile)
Debugging this on Windows, I keep getting an Error 80 after the last step - which means “File Exists”. I believe this is telling me that I cannot copy the old file over the current one while the current one exists - but I am getting a successful LastErrorCode after deleting the current file in step 3.
What am I doing wrong?
Come on - no replies? I thought there we be something painfully obvious from you experts out there.
Web app. Running debug on Windows. Delete a file successfully (according to sourcefile.LastErrorCode = 0). Copy new file to where sourcefile was. Error code 80 says file already exists (even though I believe I deleted it from previous step).
No ideas ?!?!?
have you nil’d all your references to the db file in the app ?
Interesting. I did do a db.close.
But I will look for other references to the file elsewhere to see what else is happening.
Here’s a thought - does it matter if this file is a property in some global place like a module? What if it is a property in WebSession (which I believe is the case)?
Would something like this (below) work regardless of where the file is located as a property? (I probably won’t get to this until later today to check it out)
myActiveFile = Nil
myActiveFile = New FolderItem(file definition goes here)
make sure db.databasefile = nil too
Turns out there was a prepared statement lingering, was able to track it down and clean up my code.
All is good now - thanks!