From that same page:
On November 18, 2010, the W3C announced that Web SQL database is a deprecated specification. This is a recommendation for web developers to no longer use the technology as effectively the spec will receive no new updates and browser vendors aren't encouraged to support this technology.
Also see the big warning at http://www.w3.org/TR/webdatabase
But to answer your question: As far as I know: no. You could write a 'wrapper' though, replacing your own placeholders with actual values, but I think it won't be worth bothering.
Another shot in the dark would by trying to use :foo
as placeholder. AFAIK most browsers use(d) SQLite for their webdatabase implementation and, from the top of my head having looked it up, SQLite supports named parameters in the :parametername
-form several forms. No idea how you would actually supply values, though I imagine something like [{'foo': 'bar'}, {'baz': 'bat'}]
EDIT
I have tried many permutations on your example like this:
var p = {};
p.aa = todoText;
p.bb = addedOn;
tx.executeSql("INSERT INTO todo(todo, added_on) VALUES (:aa, :bb)",
p,
...
});
Or:
tx.executeSql("INSERT INTO todo(todo, added_on) VALUES (:aa, :bb)",
{"aa": todoText, "bb": addedOn},
...
});
Or:
tx.executeSql("INSERT INTO todo(todo, added_on) VALUES (@aa, @bb)",
{"aa": todoText, "bb": addedOn},
...
});
Or:
tx.executeSql("INSERT INTO todo(todo, added_on) VALUES (?aa, ?bb)",
{"aa": todoText, "bb": addedOn},
...
});
...and many more in Chrome 25; none of them seem to indicate named parameters are supported. All I can get to work is a simple n
th position value to map to an n
th parameter position (or index if you will).
I'm not saying there is absolutely no way, maybe I just couldn't find it or guess the correct way to use it, but I think you're out of luck. And, again as mentioned in the comments, even should I or someone else get it to work I wouldn't rely on it (because: undocumented, as well as deprecated anyway) and it will probably fail in many (most?) other browsers. To be honest: trying to get this to work is a waste of your time.