| 967 | } |
| 968 | |
| 969 | void hrenameCommand(client *c) { |
| 970 | robj *o = nullptr; |
| 971 | const unsigned char *vstr; |
| 972 | unsigned int vlen; |
| 973 | long long ll; |
| 974 | |
| 975 | if ((o = lookupKeyWriteOrReply(c,c->argv[1],shared.null[c->resp])) == nullptr || |
| 976 | checkType(c,o,OBJ_HASH)) return; |
| 977 | |
| 978 | if (hashTypeGetValue(o, szFromObj(c->argv[2]), &vstr, &vlen, &ll) != C_OK) |
| 979 | { |
| 980 | addReplyError(c, "hash key doesn't exist"); |
| 981 | return; |
| 982 | } |
| 983 | |
| 984 | sds sdsT = nullptr; |
| 985 | if (vstr != nullptr) |
| 986 | { |
| 987 | sdsT = sdsnewlen(vstr, vlen); |
| 988 | } |
| 989 | else |
| 990 | { |
| 991 | sdsT = sdsfromlonglong(ll); |
| 992 | } |
| 993 | |
| 994 | hashTypeDelete(o, szFromObj(c->argv[2])); |
| 995 | hashTypeSet(o, szFromObj(c->argv[3]), sdsT, HASH_SET_TAKE_VALUE); |
| 996 | addReplyLongLong(c, 1); |
| 997 | } |
| 998 | |
| 999 | static void harndfieldReplyWithZiplist(client *c, unsigned int count, ziplistEntry *keys, ziplistEntry *vals) { |
| 1000 | for (unsigned long i = 0; i < count; i++) { |
nothing calls this directly
no test coverage detected