Skip to content

Commit

Permalink
comment doubtful place in setLimitOrder
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkSide666 committed Jul 29, 2016
1 parent 7a7e025 commit 0cbf4db
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Persistence_SQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,11 @@ protected function setLimitOrder($m, $q)
{
if ($m->limit && ($m->limit[0] || $m->limit[1])) {
if ($m->limit[0] === null) {
// really, SQL?
// This is max number which is allowed in MySQL server.
// But be aware, that PDO will downgrade this number even lower probably because
// in LIMIT it expects numeric value and converts string (we set float values as PDO_PARAM_STR)
// back to PDO_PARAM_INT which is goes back to max int value specific server can have.
// On my Win10,64-bit it is 2147483647, on Travis server 9223372036854775807 etc.
$m->limit[0] = '18446744073709551615';
}
$q->limit($m->limit[0], $m->limit[1]);
Expand Down

2 comments on commit 0cbf4db

@romaninsh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't it supposed to be a string?

@DarkSide666
Copy link
Member Author

@DarkSide666 DarkSide666 commented on 0cbf4db Aug 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that is OK, but we still set it as PDO_PARAM_STR (string) type, but SQL expects numeric value there so, probably PDO, converts it back to numeric value and max numeric value is server specific. I am not 100% exactly what converts it, but I am 100% sure, that this value gets converted somewhere on a way to SQL server and it converts to smaller value and it is different on different servers.

Please sign in to comment.