immutable chrome sqlite return objects immutable chrome sqlite return objects google-chrome google-chrome

immutable chrome sqlite return objects


The WebSQL spec doesn't require for the returned item to be sealed, but it's up to the implementation (the spec does require for the item to be an ordered dictionary with the properties in the same order as the columns in your query).

And no, there is no way to explicitly request a mutable object, so you'll want to do something like the convert_to_mutable() approach suggested by Stan.

BTW, assuming you're using a 3rd party library, it probably has a function for this, for example jQuery.extend() or _.extend().


Building on Stepan's answer, but for people like me that want a quick fix from SO.
You can create another basic object and copy the sqlite row properties onto it.
Something like this:

var immutable_book = results.rows.item(0);var book = {};for (var prop in immutable_book) {    if (immutable_book.hasOwnProperty(prop)) {        book[prop] = immutable_book[prop];    }}

That goes in the _successCallback, and then later you can do this:

book.title=book.title+"more text"; // works now !

I came across this issue in iOS Safari, but in Chrome and Android web-kit browsers I was able to update properties of the returned row object directly.