Dave Townsend (:Mossop) <
dtownsen...@oxymoronical.com> has not granted
Gregory Szorc [:gps] <
g...@mozilla.com>'s request for superreview:
------- Additional Comments from Dave Townsend (:Mossop)
<
dtownsen...@oxymoronical.com>
Review of attachment 694999:
-----------------------------------------------------------------
The UnopenedConnection object seems very strange to me, what is the point of
it? Why not just have an Sqlite.Connection which you then call open() on, or
just Sqlite.openConnection()? I'd like to understand that before signing off on
this.
::: toolkit/modules/Sqlite.jsm
@@ +194,5 @@
> + TRANSACTION_IMMEDIATE: Ci.mozIStorageConnection.TRANSACTION_IMMEDIATE,
> + TRANSACTION_EXCLUSIVE: Ci.mozIStorageConnection.TRANSACTION_EXCLUSIVE,
> +
> + get connectionReady() {
> + return this._connection.connectionReady;
this._connection may be null, maybe you want to call _ensureOpen() first.
@@ +208,5 @@
> + *
> + * It is recommended to only use this within transactions (which are
> + * handled as sequential statements via Tasks).
> + */
> + get lastInsertRowID() {
These always struck me as a big footgun in the sqlite API. Can we make this
better and just include this information along with each statement result or is
it expensive to get?
@@ +220,5 @@
> + *
> + * The same caveats regarding asynchronous execution for
> + * `lastInsertRowID` also apply here.
> + */
> + get affectedRows() {
As above.
@@ +423,5 @@
> + /**
> + * Whether a transaction is currently in progress.
> + */
> + get transactionInProgress() {
> + return this._connection.transactionInProgress;
this._connection may be null, maybe you want to call _ensureOpen() first.
@@ +454,5 @@
> + this._ensureOpen();
> +
> + if (this.transactionInProgress) {
> + throw new Error("A transaction is already active. Only one transaction
" +
> + "can be active at a time.");
This seems unfortunate, is this a limitation in sqlite or just this jsm? Can we
add a way to wait for the transaction to end?