Skip to content

statement wrappers have been deprecated

It’s a lot of fun removing old code; it’s less fun when removing that old code breaks lots of things.  That’s what happened when bug 589032 was checked in to mozilla-central last week. We had deprecated mozIStorageStatementWrapper over a year ago; bug 589032 removed mozIStorageStatementWrapper in favor of using mozIStorageStatement directly.

As there have been a couple reports of breakage (which likely means there’s a lot more breakage pending), and I have claimed in the bug that fixing said breakage is a straightforward process, here’s the quick-n-dirty guide to doing so. (Warning: may contain bugs or be incomplete. Please note any oversights in the comments.)

Code that created wrappers:

var wrapper = new Components.Constructor(";1",
function createStatement(db, aSQL) {
  return new wrapper(db.createStatement(aSQL));

or perhaps:

var wrapper = Cc[";1"]

should be replaced with:

function createStatement(db, aSQL) {
  return db.createStatement(aSQL);

Of course, that’s almost not worth having a separate function for. :)

Nearly all of the methods that you were calling on the wrapper remain unchanged, with the exception of:

foo = wrapped_stmt.execute();

That should be replaced with:

foo = stmt.executeStep();

Statements have an execute() method, but it does something slightly different than the wrapper’s execute() method.

Finally, where you finalize your statements (you are finalizing your statements, right?):


is now simply:


As I said earlier, please note any omissions or errors in the comments!


  1. If there’s a bug for this change, please be sure it has the dev-doc-needed keyword so we can ensure that it’s documented.

    Posted on 14-May-12 at 8:54 pm | Permalink
  2. Nathan Froyd

    Yup, dev-doc-needed is already there. :)

    Posted on 14-May-12 at 9:25 pm | Permalink
  3. Serge Gautherie

    it looks like execute() calls are unchanged,
    and executeStep() replaces step() rather.
    This needs to be clarified.

    Posted on 15-May-12 at 8:26 pm | Permalink