Opened 14 years ago
Closed 14 years ago
#7990 closed defect (duplicate)
dojox.data.ClientFilter: querySuperSet function returns successful if query is not an object
Reported by: | dustint | Owned by: | Jared Jurkiewicz |
---|---|---|---|
Priority: | high | Milestone: | tbd |
Component: | DojoX Data | Version: | 1.2.0 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
Take the following example: dojox.store.ServiceStore?.fetch({[Error: Query filter requires field and constraints separated by a "="]}); dojox.store.ServiceStore?.fetch({[Error: Query filter requires field and constraints separated by a "="]});
Now, when we call the fetch for the query of 2, we test to see if the queries are the same: argsSuper.query == argsSub.query, which won't evaluate to true because 1 != 2
However, then we try to mixin the query: dojo.mixin({},1) which doesnt make any sense, so we never get to the return false logic and end up returning the clientQuery, resulting in success.
To fix this, we should wrap the mixin and following code with tests to ensure the queries are actually objects. Eg:
if(typeof argsSub.query == 'object' && argsSub.query == 'object'){
var clientQuery = dojo.mixin({},argsSub.query); for(var i in argsSuper.query){
if(clientQuery[i] == argsSuper.query[i]){
delete clientQuery[i];
}else if(!(typeof argsSuper.query[i] == 'string' && dojo.data.util.filter.patternToRegExp(argsSuper.query[i]).test(clientQuery[i]))){
return false;
}
}
}else{
return false;
}
Change History (2)
comment:1 Changed 14 years ago by
comment:2 Changed 14 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
This ticket is a duplicate of 7989. The server seemed like it messed up, but in the end created two. Sorry for the confusion