Closed Bug 397235 Opened 17 years ago Closed 17 years ago

mozIStorageConnection.close() dumps NS_ERROR_FILE_IS_LOCKED

Categories

(Toolkit :: Storage, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 394789

People

(Reporter: mikek01, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a8) Gecko/2007091216 GranParadiso/3.0a8
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a8) Gecko/2007091216 GranParadiso/3.0a8

Trying to close a database connection dumps the following error: -

Error: uncaught exception: [Exception... "Component returned failure code: 0x8052000e (NS_ERROR_FILE_IS_LOCKED) [mozIStorageConnection.close]"  nsresult: "0x8052000e (NS_ERROR_FILE_IS_LOCKED)"

It seems only to dump the error after mozIStorageConnection.createStatement() has been used.

Reproducible: Always

Steps to Reproduce:
this.file = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties).get("ProfD", Ci.nsIFile);
this.file.append("foo.sqlite");
this.storageService = Cc["@mozilla.org/storage/service;1"].getService(Ci.mozIStorageService);
this.mDBConn = this.storageService.openDatabase(this.file);
var statement = this.mDBConn.createStatement("SELECT * FROM bar");
while (statement.executeStep()) {
  // do something here
}
statement.reset();
this.mDBConn.close();
Actual Results:  
Dumps NS_ERROR_FILE_IS_LOCKED as described above

Expected Results:  
Close connection to sqlite
You need to call finalize on the statement before attempting to close.
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → INVALID
It would be so nice if these things were documented somewhere.

I can't find any information on mozIStorageService.finalize(), mozIStorageConnection.finalize() or mozIStorageStatement.finalize().
The code only landed five days ago....
Resolution: INVALID → DUPLICATE
Well if mozIStorageStatement.finalize() is included in 3.0a8, it doesn't work.
...it landed five days ago, which was after the M8 freeze.  It will be in M9
Ahhhhh...

So M8 gives us mozIStorageStatement.close() which we can't use till we get mozIStorageStatement.finalize() in M9.

Cool. At least I know what's going on now... More-or-less :)

Thank you
you can use it - you are just dependent on the garbage collector.  You can use the initialize hack that was used in the bug dependent on the bug this is duped too, however I plan to remove that before M9 ships (that method doesn't need to be exposed, and probably shouldn't be exposed).
You need to log in before you can comment on or make changes to this bug.