Skip to content

Commit

Permalink
Fixes #192
Browse files Browse the repository at this point in the history
  • Loading branch information
wolf4ood committed Oct 28, 2016
1 parent 6546191 commit 779a628
Show file tree
Hide file tree
Showing 4 changed files with 201 additions and 166 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

###Bug Fixes

* [#192](https://github.com/orientechnologies/orientjs/issues/192) Fixed class name caching
* [#199](https://github.com/orientechnologies/orientjs/issues/199) Fixed multiple returns
* [#4485](https://github.com/orientechnologies/orientdb/issues/4485) Added More Tests for custom returns

###New Features

* [#200](https://github.com/orientechnologies/orientjs/issues/200) Added Extra paramenters `input` to the endQuery
* [#200](https://github.com/orientechnologies/orientjs/issues/200) Added Extra parameter `input` to the endQuery

####2.2.2

Expand Down
15 changes: 8 additions & 7 deletions lib/db/class/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ exports.list = function (refresh) {
}

return this.send('record-load', {
cluster: 0,
position: 1
})
cluster: 0,
position: 1
})
.bind(this)
.then(function (response) {
var record = response.records[0];
Expand Down Expand Up @@ -286,14 +286,15 @@ exports.drop = function (name) {
* @promise {Object} The class object if it exists.
*/
exports.get = function (name, refresh) {
if (!refresh && this.class.cached && this.class.cached.names[name]) {
return Promise.resolve(this.class.cached.names[name]);
var className = name.toLocaleUpperCase();
if (!refresh && this.class.cached && this.class.cached.names[className]) {
return Promise.resolve(this.class.cached.names[className]);
}
else if (!this.class.cached || refresh) {
return this.class.list(refresh)
.bind(this)
.then(function () {
return this.class.cached.names[name] || Promise.reject(new errors.Request('No such class: ' + name));
return this.class.cached.names[className] || Promise.reject(new errors.Request('No such class: ' + name));
});
}
else {
Expand Down Expand Up @@ -324,7 +325,7 @@ exports.cacheData = function (classes) {

for (i = 0; i < total; i++) {
item = classes[i];
this.class.cached.names[item.name] = item;
this.class.cached.names[item.name.toLocaleUpperCase()] = item;
}

return this;
Expand Down
Loading

0 comments on commit 779a628

Please sign in to comment.