Skip to content

Commit 84d0aaa

Browse files
committed
Fix SELECT command in Pipeline (#3301)
1 parent eb0fa1d commit 84d0aaa

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/main/java/redis/clients/jedis/Pipeline.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4272,7 +4272,7 @@ public Response<List<String>> time() {
42724272

42734273
@Override
42744274
public Response<String> select(final int index) {
4275-
return appendCommand(new CommandObject<>(commandObjects.commandArguments(Protocol.Command.SELECT), BuilderFactory.STRING));
4275+
return appendCommand(new CommandObject<>(commandObjects.commandArguments(Protocol.Command.SELECT).add(index), BuilderFactory.STRING));
42764276
}
42774277

42784278
@Override

src/test/java/redis/clients/jedis/PipeliningTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,13 @@ private void verifyHasBothValues(byte[] firstKey, byte[] secondKey, byte[] value
157157

158158
@Test
159159
public void pipelineSelect() {
160+
jedis.set("foo", "bar");
161+
jedis.swapDB(0, 1);
160162
Pipeline p = jedis.pipelined();
163+
p.get("foo");
161164
p.select(1);
162-
p.sync();
165+
p.get("foo");
166+
assertEquals(Arrays.<Object>asList(null, "OK", "bar"), p.syncAndReturnAll());
163167
}
164168

165169
@Test

0 commit comments

Comments
 (0)