Closed
Bug 403376
Opened 18 years ago
Closed 17 years ago
mozIStorageConnection::schemaVersion misleadingly returns PRAGMA user_version
Categories
(Core :: SQLite and Embedded Database Bindings, defect)
Core
SQLite and Embedded Database Bindings
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: myk, Unassigned)
References
Details
But 386366 adds a property to mozIStorageConnection for getting the user_version pragma, but it misleadingly calls it "schemaVersion", which makes it sound like it retrieves the schema_version pragma.
It seems like the property should be called "userVersion" instead, since that matches the SQLite documentation, and even though Places and the content prefs service both use the pragma to store their schema version, that pragma can be used for anything; it doesn't need to be used for schema versioning.
Comment 2•18 years ago
|
||
I'm inclined to WONTFIX this bug. mozStorage is supposed to be a database abstraction layer, and all this is is an abstraction. Users cannot actually use the schema version in sqlite, but they can store their own schema version in user_version.
Comment 3•18 years ago
|
||
(In reply to comment #2)
> I'm inclined to WONTFIX this bug. mozStorage is supposed to be a database
> abstraction layer, and all this is is an abstraction. Users cannot actually
> use the schema version in sqlite, but they can store their own schema version
> in user_version.
>
I think I agree with you; but probably there could be a rethink on calling it something other than schemaVersion.
schemaVersion unnecessarily gets confused with schema_version in pragma schema_version, and hence this bug.
Comment 4•18 years ago
|
||
How about calling it databaseVersion?
Comment 5•18 years ago
|
||
I don't quite like that - it's used to check the version of the database schema. I really think the only issue here is that sqlite uses schema_version internally, and as a result, causes this confusion. However, mozStorage is a database abstraction layer (currently only wrapping sqlite).
Reporter | ||
Comment 6•18 years ago
|
||
(In reply to comment #5)
> mozStorage is a database abstraction layer (currently only wrapping sqlite).
Is that really true? I've always thought of it as an API specifically for accessing SQLite through XPCOM. Its primitives closely mirror SQLite's, unlike the older mozSQL interface in extensions/sql, which was actually designed to be an abstraction layer. And MDC describes it like that, saying "Storage is a SQLite database API." <http://developer.mozilla.org/en/docs/Storage>
mozStorage also doesn't provide any schema manipulation facilities, and consumers can stick arbitrary values into the user_version pragma that it exposes through the schemaVersion attribute. They don't have to use it to store a schema version.
schemaVersion would make sense to me as an attribute in an API for managed schema revisions (which may or may not use the user_version pragma to track that value). But in the general API, and given that mozStorage developers frequently consult SQLite documentation to figure out how to use the API, it makes more sense to call it what it is.
Comment 7•18 years ago
|
||
While it is true that it currently closely maps to the SQLite api, I've been trying to move away from that because it's too easy to do things wrong. Please see the thread in dev.planning for mozStorage and moz2:
http://groups.google.com/group/mozilla.dev.planning/browse_thread/thread/240a264c08c6eb7a
Reporter | ||
Comment 8•18 years ago
|
||
(In reply to comment #7)
> While it is true that it currently closely maps to the SQLite api, I've been
> trying to move away from that because it's too easy to do things wrong. Please
> see the thread in dev.planning for mozStorage and moz2:
> http://groups.google.com/group/mozilla.dev.planning/browse_thread/thread/240a264c08c6eb7a
Yup, I'm aware of the thread, and I think your proposal is a great idea, but it's a great idea because it makes using SQLite safer and easier for consumers (for which there is great demand), not because it makes it possible for consumers to use mozStorage with other databases (for which, as far as I am aware, there is no demand).
And in any case, this attribute is not part of that proposed SQLAlchemy-like API, it's part of the existing SQLite-like API.
Comment 11•17 years ago
|
||
I am going to close this bug as WONTFIX. Other than the comments in this bug, I haven't heard any complaints about it, and the arguments made against it haven't convinced me to change my mind. Sorry.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → WONTFIX
Updated•1 year ago
|
Product: Toolkit → Core
You need to log in
before you can comment on or make changes to this bug.
Description
•