Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #160 limit issue #161

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ Connection.prototype._initializeSequel = function _initializeSequel(config, coll
Connection.prototype._getOriento = function _getOriento(config) {
var orientoOptions = {
host : config.host,
port : config.host,
port : config.port,
username : config.user,
password : config.password,
transport : config.options.transport,
Expand Down
16 changes: 16 additions & 0 deletions lib/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Query.prototype.normalizeCriteria = function normalizeCriteria(options) {

return _.mapValues(options, function (original, key) {
if (key === 'where') return self.parseWhere(original);
if (key === 'limit') return self.fixLimit(original);
return original;
});
};
Expand All @@ -71,6 +72,21 @@ Query.prototype.parseWhere = function parseWhere(original) {
return self.parseClause(original);
};

/**
* Parse Limit and round it between -1 to 2147483647 except 0
*
* <limit> ::= <clause>
*
* @api private
*
* @param original
* @returns {Number} - According to orient db
*/
Query.prototype.fixLimit = function fixLimit(original) {
// `original !== 0` Beacuse of old waterline version
return ( original < 2147483647 && original > -2 && original !== 0 ) ? original : null;
};


/**
* Parse Clause
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sails-orientdb",
"version": "0.10.60",
"version": "0.10.61",
"description": "OrientDB adapter for Waterline / Sails.js ORM",
"main": "./lib/adapter.js",
"scripts": {
Expand Down