Commit 16436c04 authored by Vincent Bechu's avatar Vincent Bechu

mappingstorage: test on reduce query number

parent 1d8863cf
...@@ -10,12 +10,15 @@ ...@@ -10,12 +10,15 @@
if (storage._no_sub_query_id) { if (storage._no_sub_query_id) {
throw new jIO.util.jIOError('no sub query id active', 404); throw new jIO.util.jIOError('no sub query id active', 404);
} }
if (value === undefined) { if (!value) {
throw new jIO.util.jIOError( throw new jIO.util.jIOError(
'can not find document with ' + key + ' : undefined', 'can not find document with ' + key + ' : undefined',
404 404
); );
} }
if (storage._mapping_id_memory_dict[value]) {
return storage._mapping_id_memory_dict[value];
}
query = new SimpleQuery({ query = new SimpleQuery({
key: key, key: key,
value: value, value: value,
...@@ -46,6 +49,7 @@ ...@@ -46,6 +49,7 @@
throw new TypeError("id must be unique field: " + key throw new TypeError("id must be unique field: " + key
+ ", result:" + data.data.rows.toString()); + ", result:" + data.data.rows.toString());
} }
storage._mapping_id_memory_dict[value] = data.data.rows[0].id;
return data.data.rows[0].id; return data.data.rows[0].id;
}); });
} }
...@@ -202,6 +206,7 @@ ...@@ -202,6 +206,7 @@
this._query.query = QueryFactory.create(this._query.query); this._query.query = QueryFactory.create(this._query.query);
} }
this._default_mapping = {}; this._default_mapping = {};
this._mapping_id_memory_dict = {};
initializeQueryAndDefaultMapping(this); initializeQueryAndDefaultMapping(this);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment