mirror of
https://github.com/predis/predis.git
synced 2026-08-21 19:30:57 +00:00
Changed the way arguments of SORT are prepared before serialization to be compatible with an eventual switch to multi-bulk requests.
This commit is contained in:
+11
-5
@@ -2188,21 +2188,26 @@ class Sort extends \Predis\InlineCommand {
|
||||
$sortParams = $arguments[1];
|
||||
|
||||
if (isset($sortParams['by'])) {
|
||||
$query[] = 'BY ' . $sortParams['by'];
|
||||
$query[] = 'BY';
|
||||
$query[] = $sortParams['by'];
|
||||
}
|
||||
if (isset($sortParams['get'])) {
|
||||
$getargs = $sortParams['get'];
|
||||
if (is_array($getargs)) {
|
||||
foreach ($getargs as $getarg) {
|
||||
$query[] = 'GET ' . $getarg;
|
||||
$query[] = 'GET';
|
||||
$query[] = $getarg;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$query[] = 'GET ' . $getargs;
|
||||
$query[] = 'GET';
|
||||
$query[] = $getargs;
|
||||
}
|
||||
}
|
||||
if (isset($sortParams['limit']) && is_array($sortParams['limit'])) {
|
||||
$query[] = 'LIMIT ' . $sortParams['limit'][0] . ' ' . $sortParams['limit'][1];
|
||||
$query[] = 'LIMIT';
|
||||
$query[] = $sortParams['limit'][0];
|
||||
$query[] = $sortParams['limit'][1];
|
||||
}
|
||||
if (isset($sortParams['sort'])) {
|
||||
$query[] = strtoupper($sortParams['sort']);
|
||||
@@ -2211,7 +2216,8 @@ class Sort extends \Predis\InlineCommand {
|
||||
$query[] = 'ALPHA';
|
||||
}
|
||||
if (isset($sortParams['store']) && $sortParams['store'] == true) {
|
||||
$query[] = 'STORE ' . $sortParams['store'];
|
||||
$query[] = 'STORE';
|
||||
$query[] = $sortParams['store'];
|
||||
}
|
||||
|
||||
return $query;
|
||||
|
||||
Reference in New Issue
Block a user