Limit is not converted to integer
See original GitHub issueI have this function:
exports.lastCovers = function(page, pageSize) {
console.log(typeof pageSize)
console.log(typeof page)
return Cover.collection().query(function(qb) {
qb.orderBy('registration_date', 'desc').limit(pageSize).offset((page - 1) * pageSize);
}).fetch();
}
It prints:
string
string
And happens this error:
{ __cid: '__cid8',
method: 'select',
options: undefined,
bindings: [ '20', 0 ],
sql: 'select `cover`.* from `cover` order by `registration_date` desc limit ? offset ?' }
{ [Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''20' offset 0' at line 1]
code: 'ER_PARSE_ERROR',
errno: 1064,
sqlState: '42000',
index: 0 }
The offset is converted to integer but limit is not.
Issue Analytics
- State:
- Created 9 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Limit is not converted to integer · Issue #393 - GitHub
The offset is converted to integer but limit is not.
Read more >ValueError: Exceeds the limit (4300) for integer string conversion
No efficient algorithm exists to do otherwise. It is quite common for Python code implementing network protocols and data serialization to do ...
Read more >`int('1' * 4301)` will raise ValueError starting with Python 3.10.7
See the integer string conversion length limitation documentation. The default limit is 4300 digits in string form.
Read more >Convert 18 digit string into number using int function
I am trying to make a flow that requires that i convert 18 digit "string" value into number. But since int have limit...
Read more >Int/str conversions broken in latest Python bugfix releases
... Exceeds the limit (4300) for integer string conversion ... A library should not generally alter global state like this so it isn't ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In Postgres, at least, one can do “LIMIT ALL” in a query. It would be nice to be able to send in “ALL” (or an equivalent) into limit() and have it not emote a warning everytime.
@VincentVazzo Please open a new issue with this feature request. This issue is closed.