diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-06-04 10:36:39 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2013-06-04 11:00:55 +0200 |
commit | 1dbbecda8b4e34196d07ecfea65de87b0bd8b83a (patch) | |
tree | a3e027c397ad5d44d5acdb624d245b2b1d6d416a /src/imports | |
parent | 734f65f151ccd491a2dd79fe511a7822016cf52b (diff) |
Simplify the object iterator API
We were really missing methods to get both the key and the value
in one go.
Change-Id: I996bde79265f45312e68fcc6bdce76704385ea5b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/localstorage/plugin.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp index 92df9c3755..323b89b3e5 100644 --- a/src/imports/localstorage/plugin.cpp +++ b/src/imports/localstorage/plugin.cpp @@ -268,17 +268,17 @@ static Value qmlsqldatabase_executeSql(SimpleCallContext *ctx) } else if (Object *object = values.asObject()) { ObjectIterator it(object, ObjectIterator::WithProtoChain|ObjectIterator::EnumerableOnly); while (1) { - String *name; - uint index; - PropertyAttributes attrs; - Property *p = it.next(&name, &index, &attrs); - if (!p) + Value value; + Value key = it.nextPropertyName(&value); + if (key.isNull()) break; - QVariant v = engine->toVariant(object->getValue(ctx, p, attrs), -1); - if (name) - query.bindValue(name->toQString(), v); - else - query.bindValue(index, v); + QVariant v = engine->toVariant(value, -1); + if (key.isString()) { + query.bindValue(key.stringValue()->toQString(), v); + } else { + assert(key.isInteger()); + query.bindValue(key.integerValue(), v); + } } } else { query.bindValue(0, engine->toVariant(values, -1)); |