Here is an excerpt from a Node Webkit WebSQL wrapper I'm building and I'm running into a problem. See the <----
line below.
get_columns
is a simple JavaScript array:
['id','group_name','description']
But when they come out of the database the object (a.k.a. results.rows.item(i)
):
{'description','group_name','id'}
Is this because the browser or JavaScript wants to sort all objects in alphabetical order?
db.transaction(function(tx) {
var sql = 'SELECT ' + get_columns + ' FROM ' + table;
tx.executeSql(sql, [], function(tx, results) {
if (results.rows.length) {
for (var i = 0; i < results.rows.length; i++) {
_data.push(results.rows.item(i)); // <---- columns from WebSQL are in alphabetical order, so not cool.
}
}
deferred.resolve(_data);
});
});
My thoughts are to process the object and put the values of the object into my array as values for each key.