Commit 2c008adb authored by Vincent Bechu's avatar Vincent Bechu

[querystorage] Handle schema capacity

parent f3c1c232
/*jslint nomen: true*/ /*jslint nomen: true*/
/*global RSVP*/ /*global RSVP, jIO*/
(function (jIO, RSVP) { (function (jIO, RSVP) {
"use strict"; "use strict";
...@@ -8,7 +8,9 @@ ...@@ -8,7 +8,9 @@
* *
* @class QueryStorage * @class QueryStorage
* @constructor * @constructor
*
*/ */
function QueryStorage(spec) { function QueryStorage(spec) {
this._sub_storage = jIO.createJIO(spec.sub_storage); this._sub_storage = jIO.createJIO(spec.sub_storage);
this._key_schema = spec.key_schema; this._key_schema = spec.key_schema;
...@@ -47,7 +49,8 @@ ...@@ -47,7 +49,8 @@
var this_storage_capacity_list = ["limit", var this_storage_capacity_list = ["limit",
"sort", "sort",
"select", "select",
"query"]; "query",
"schema"];
if (this_storage_capacity_list.indexOf(name) !== -1) { if (this_storage_capacity_list.indexOf(name) !== -1) {
return true; return true;
...@@ -57,6 +60,7 @@ ...@@ -57,6 +60,7 @@
} }
return false; return false;
}; };
QueryStorage.prototype.buildQuery = function (options) { QueryStorage.prototype.buildQuery = function (options) {
var substorage = this._sub_storage, var substorage = this._sub_storage,
context = this, context = this,
...@@ -75,11 +79,14 @@ ...@@ -75,11 +79,14 @@
((options.select_list === undefined) || ((options.select_list === undefined) ||
(substorage.hasCapacity("select"))) && (substorage.hasCapacity("select"))) &&
((options.limit === undefined) || ((options.limit === undefined) ||
(substorage.hasCapacity("limit")))) { (substorage.hasCapacity("limit"))) &&
((options.schema === undefined) ||
(substorage.hasCapacity("schema")))) {
sub_options.query = options.query; sub_options.query = options.query;
sub_options.sort_on = options.sort_on; sub_options.sort_on = options.sort_on;
sub_options.select_list = options.select_list; sub_options.select_list = options.select_list;
sub_options.limit = options.limit; sub_options.limit = options.limit;
sub_options.schema = options.schema;
} }
} catch (error) { } catch (error) {
if ((error instanceof jIO.util.jIOError) && if ((error instanceof jIO.util.jIOError) &&
......
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