mozIStorageService
| IID: | 336d2741-8438-449d-8746-8c37c62a2ccb |
| Inherits From: | nsISupports |
The mozIStorageService interface is intended to be implemented by a service that can create storage connections (mozIStorageConnection) to either a well-known profile database or to a specific database file.
This is the only way to open a database connection.
This interface is implemented by the following components:
Methods
mozIStorageConnection openDatabase ( nsIFile databaseFile )
mozIStorageConnection openSpecialDatabase ( char* storageKey )
mozIStorageConnection openUnsharedDatabase ( nsIFile databaseFile )
mozIStorageConnection openDatabase ( nsIFile databaseFile )
Open a connection to the specified file.
========== DANGER ==========
If you have more than one connection to a file, you MUST use the EXACT SAME NAME for the file each time, including case. The sqlite code uses a simple string compare to see if there is already a connection. Opening a connection to "Foo.sqlite" and "foo.sqlite" will CORRUPT YOUR DATABASE.
The connection object returned by this function is not threadsafe. You must use it only from the thread you created it from.
If your database contains virtual tables (f.e. for full-text indexes), you must open it with openUnsharedDatabase, as those tables are incompatible with a shared cache. If you attempt to use this method to open a database containing virtual tables, it will think the database is corrupted and throw NS_ERROR_FILE_CORRUPTED.
- Arguments:
- databaseFile: a nsIFile of the database to open.
mozIStorageConnection openSpecialDatabase ( char* storageKey )
Get a connection to a named special database storage.
- Arguments:
- storageKey: a string key identifying the type of storage requested. Valid values include: "profile", "memory".
mozIStorageConnection openUnsharedDatabase ( nsIFile databaseFile )
Open a connection to the specified file that doesn't share a sqlite cache.
Each connection uses its own sqlite cache, which is inefficient, so you should use openDatabase instead of this method unless you need a feature of SQLite that is incompatible with a shared cache, like virtual table and full text indexing support.
========== DANGER ==========
If you have more than one connection to a file, you MUST use the EXACT SAME NAME for the file each time, including case. The sqlite code uses a simple string compare to see if there is already a connection. Opening a connection to "Foo.sqlite" and "foo.sqlite" will CORRUPT YOUR DATABASE.
The connection object returned by this function is not threadsafe. You must use it only from the thread you created it from.
- Arguments:
- databaseFile: a nsIFile of the database to open.
Reference documentation is generated from Mozilla's source.
